Matrix r5059
Loading...
Searching...
No Matches
Lapack-etc.h
Go to the documentation of this file.
1#ifndef MATRIX_LAPACK_ETC_H
2#define MATRIX_LAPACK_ETC_H
3
4#ifndef USE_FC_LEN_T
5# define USE_FC_LEN_T
6#endif
7#include <Rconfig.h>
8#ifdef PR18534fixed
9# define usePR18534fix
10#endif
11#include <R_ext/Lapack.h>
12#ifndef FCONE
13# define FCONE
14#endif
15
16#include <R_ext/Error.h>
17
18#define ERROR_LAPACK_1(_ROUTINE_, _INFO_) \
19do { \
20 if ((_INFO_) < 0) \
21 Rf_error(_("LAPACK routine '%s': argument %d had illegal value"), \
22 #_ROUTINE_, -(_INFO_)); \
23} while (0)
24
25#define ERROR_LAPACK_2(_ROUTINE_, _INFO_, _WARN_, _LETTER_) \
26do { \
27 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
28 if ((_INFO_) > 0 && (_WARN_) > 0) { \
29 if (_WARN_ > 1) \
30 Rf_error (_("LAPACK routine '%s': matrix is exactly singular, %s[i,i]=0, i=%d"), \
31 #_ROUTINE_, #_LETTER_, (_INFO_)); \
32 else \
33 Rf_warning(_("LAPACK routine '%s': matrix is exactly singular, %s[i,i]=0, i=%d"), \
34 #_ROUTINE_, #_LETTER_, (_INFO_)); \
35 } \
36} while (0)
37
38#define ERROR_LAPACK_3(_ROUTINE_, _INFO_, _WARN_) \
39do { \
40 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
41 if ((_INFO_) > 0 && (_WARN_) > 0) { \
42 if (_WARN_ > 1) \
43 Rf_error (_("LAPACK routine '%s': leading principal minor of order %d is not positive"), \
44 #_ROUTINE_, (_INFO_)); \
45 else \
46 Rf_warning(_("LAPACK routine '%s': leading principal minor of order %d is not positive"), \
47 #_ROUTINE_, (_INFO_)); \
48 } \
49} while (0)
50
51#define ERROR_LAPACK_4(_ROUTINE_, _INFO_, _WARN_, _RANK_) \
52 do { \
53 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
54 if ((_INFO_) > 0 && (_WARN_) > 0) { \
55 if (_WARN_ > 1) \
56 Rf_error (_("LAPACK routine '%s': matrix is rank deficient or not positive definite, the _computed_ rank is %d"), \
57 #_ROUTINE_, (_RANK_)); \
58 else \
59 Rf_warning(_("LAPACK routine '%s': matrix is rank deficient or not positive definite, the _computed_ rank is %d"), \
60 #_ROUTINE_, (_RANK_)); \
61 } \
62 } while (0)
63
64#define ERROR_LAPACK_5(_ROUTINE_, _INFO_, _WARN_) \
65 do { \
66 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
67 if ((_INFO_) > 0 && (_WARN_) > 0) { \
68 if (_WARN_ > 1) \
69 Rf_error (_("LAPACK routine '%s': failed to compute all eigenvalues"), \
70 #_ROUTINE_); \
71 else \
72 Rf_warning(_("LAPACK routine '%s': failed to compute all eigenvalues"), \
73 #_ROUTINE_); \
74 } \
75 } while (0)
76
77#endif /* MATRIX_LAPACK_ETC_H */