1 //#define CXXBLAS_DEBUG_OUT(x) std::cerr << x << std::endl;
2
3 #define STR(x) #x
4 #define STRING(x) STR(x)
5
6 #define FLENS_DEFAULT_INDEXTYPE int
7
8 #include <flens/lapack/interface/include/config.h>
9
10
11 namespace flens { namespace lapack {
12
13 extern "C" {
14
15 //-- dgesv ---------------------------------------------------------------------
16 void
17 LAPACK_DECL(dgesv)(const INTEGER *N,
18 const INTEGER *NRHS,
19 DOUBLE *A,
20 const INTEGER *LDA,
21 INTEGER *IPIV,
22 DOUBLE *B,
23 const INTEGER *LDB,
24 INTEGER *INFO)
25 {
26 DEBUG_FLENS_LAPACK("dgesv");
27 //
28 // Test the input parameters so that we pass LAPACK error checks
29 //
30 *INFO = 0;
31 if (*N<0) {
32 *INFO = -1;
33 } else if (*NRHS<0) {
34 *INFO = -2;
35 } else if (*LDA<std::max(INTEGER(1), *N)) {
36 *INFO = -4;
37 } else if (*LDB<std::max(INTEGER(1), *N)) {
38 *INFO = -7;
39 }
40 if (*INFO!=0) {
41 *INFO = -(*INFO);
42 LAPACK_ERROR("DGESV", INFO);
43 *INFO = -(*INFO);
44 return;
45 }
46 //
47 // Call FLENS implementation
48 //
49 DGeMatrixView _A = DFSView(*N, *N, A, *LDA);
50 IDenseVectorView _IPIV = IArrayView(*N, IPIV, 1);
51 DGeMatrixView _B = DFSView(*N, *NRHS, B, *LDB);
52
53 sv(_A, _IPIV, _B);
54 }
55
56 } // extern "C"
57
58 } } // namespace lapack, flens
2
3 #define STR(x) #x
4 #define STRING(x) STR(x)
5
6 #define FLENS_DEFAULT_INDEXTYPE int
7
8 #include <flens/lapack/interface/include/config.h>
9
10
11 namespace flens { namespace lapack {
12
13 extern "C" {
14
15 //-- dgesv ---------------------------------------------------------------------
16 void
17 LAPACK_DECL(dgesv)(const INTEGER *N,
18 const INTEGER *NRHS,
19 DOUBLE *A,
20 const INTEGER *LDA,
21 INTEGER *IPIV,
22 DOUBLE *B,
23 const INTEGER *LDB,
24 INTEGER *INFO)
25 {
26 DEBUG_FLENS_LAPACK("dgesv");
27 //
28 // Test the input parameters so that we pass LAPACK error checks
29 //
30 *INFO = 0;
31 if (*N<0) {
32 *INFO = -1;
33 } else if (*NRHS<0) {
34 *INFO = -2;
35 } else if (*LDA<std::max(INTEGER(1), *N)) {
36 *INFO = -4;
37 } else if (*LDB<std::max(INTEGER(1), *N)) {
38 *INFO = -7;
39 }
40 if (*INFO!=0) {
41 *INFO = -(*INFO);
42 LAPACK_ERROR("DGESV", INFO);
43 *INFO = -(*INFO);
44 return;
45 }
46 //
47 // Call FLENS implementation
48 //
49 DGeMatrixView _A = DFSView(*N, *N, A, *LDA);
50 IDenseVectorView _IPIV = IArrayView(*N, IPIV, 1);
51 DGeMatrixView _B = DFSView(*N, *NRHS, B, *LDB);
52
53 sv(_A, _IPIV, _B);
54 }
55
56 } // extern "C"
57
58 } } // namespace lapack, flens