-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathxerbla.cpp
73 lines (64 loc) · 2.55 KB
/
xerbla.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
-- MAGMA (version 2.1.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date August 2016
@author Mark Gates
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "magma_internal.h"
/***************************************************************************//**
Purpose
-------
magma_xerbla is an error handler for the MAGMA routines.
It is called by a MAGMA routine if an input parameter has an
invalid value. It prints an error message.
Installers may consider modifying it to
call system-specific exception-handling facilities.
Arguments
---------
@param[in]
srname CHAR*
The name of the subroutine that called XERBLA.
In C/C++ it is convenient to use "__func__".
@param[in]
neg_info INTEGER
Error code.
Note neg_info's sign is opposite info's normal sign.
Normally:
- neg_info > 0: The position of the invalid parameter
in the parameter list of the calling routine.
The conditions below are also reported, but normally code should not
call xerbla for these runtime errors:
- neg_info < 0: Function-specific error.
- neg_info >= -MAGMA_ERR: Pre-defined MAGMA error, such as malloc failure.
- neg_info == 0: No error.
@ingroup magma_error
*******************************************************************************/
extern "C"
void magma_xerbla(const char *srname, magma_int_t neg_info)
{
// the first 3 cases are unusual for calling xerbla;
// normally runtime errors are passed back in info.
if ( neg_info < 0 ) {
fprintf( stderr, "Error in %s, function-specific error (info = %lld)\n",
srname, (long long) -neg_info );
}
else if ( neg_info == 0 ) {
fprintf( stderr, "No error, why is %s calling xerbla? (info = %lld)\n",
srname, (long long) -neg_info );
}
else if ( neg_info >= -MAGMA_ERR ) {
fprintf( stderr, "Error in %s, %s (info = %lld)\n",
srname, magma_strerror(-neg_info), (long long) -neg_info );
}
else {
// this is the normal case for calling xerbla;
// invalid parameter values are usually logic errors, not runtime errors.
fprintf( stderr, "On entry to %s, parameter %lld had an illegal value (info = %lld)\n",
srname, (long long) neg_info, (long long) -neg_info );
}
}