Matrix r4655
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/* Copy and paste from WRE : */
5
6// before any R headers, or define in PKG_CPPFLAGS
7#ifndef USE_FC_LEN_T
8# define USE_FC_LEN_T
9#endif
10#include <Rconfig.h>
11
12#ifdef PR18534fixed
13# define usePR18534fix
14#endif
15
16#include <R_ext/Lapack.h>
17#ifndef FCONE
18# define FCONE
19#endif
20
21#define ERROR_LAPACK_1(_ROUTINE_, _INFO_) \
22do { \
23 if ((_INFO_) < 0) \
24 error(_("LAPACK routine '%s': argument %d had illegal value"), \
25 #_ROUTINE_, -(_INFO_)); \
26} while (0)
27
28#define ERROR_LAPACK_2(_ROUTINE_, _INFO_, _WARN_, _LETTER_) \
29do { \
30 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
31 if ((_INFO_) > 0 && (_WARN_) > 0) { \
32 if (_WARN_ > 1) \
33 error (_("LAPACK routine '%s': matrix is exactly singular, %s[i,i]=0, i=%d"), \
34 #_ROUTINE_, #_LETTER_, (_INFO_)); \
35 else \
36 warning(_("LAPACK routine '%s': matrix is exactly singular, %s[i,i]=0, i=%d"), \
37 #_ROUTINE_, #_LETTER_, (_INFO_)); \
38 } \
39} while (0)
40
41#define ERROR_LAPACK_3(_ROUTINE_, _INFO_, _WARN_, _NPROTECT_) \
42do { \
43 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
44 if ((_INFO_) > 0 && (_WARN_) > 0) { \
45 if (_WARN_ > 1) \
46 error (_("LAPACK routine '%s': leading principal minor of order %d is not positive"), \
47 #_ROUTINE_, (_INFO_)); \
48 else { \
49 warning(_("LAPACK routine '%s': leading principal minor of order %d is not positive"), \
50 #_ROUTINE_, (_INFO_)); \
51 UNPROTECT(_NPROTECT_); \
52 return ScalarInteger(_INFO_); \
53 } \
54 } \
55} while (0)
56
57#define ERROR_LAPACK_4(_ROUTINE_, _INFO_, _RANK_, _WARN_) \
58 do { \
59 ERROR_LAPACK_1(_ROUTINE_, _INFO_); \
60 if ((_INFO_) > 0 && (_WARN_) > 0) { \
61 if (_WARN_ > 1) \
62 error (_("LAPACK routine '%s': matrix is rank deficient or not positive definite, the _computed_ rank is %d"), \
63 #_ROUTINE_, (_RANK_)); \
64 else \
65 warning(_("LAPACK routine '%s': matrix is rank deficient or not positive definite, the _computed_ rank is %d"), \
66 #_ROUTINE_, (_RANK_)); \
67 } \
68 } while (0)
69
70#endif /* MATRIX_LAPACK_ETC_H */