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 //-- dlatrs --------------------------------------------------------------------
16 void
17 LAPACK_DECL(dlatrs)(const char *UPLO,
18 const char *TRANS,
19 const char *DIAG,
20 const char *NORMIN,
21 const INTEGER *N,
22 const DOUBLE *A,
23 const INTEGER *LDA,
24 DOUBLE *X,
25 DOUBLE *SCALE,
26 DOUBLE *CNORM,
27 INTEGER *INFO)
28 {
29 DEBUG_FLENS_LAPACK("dlatrs");
30 //
31 // Test the input parameters so that we pass LAPACK error checks
32 //
33 *INFO = 0;
34 if (*UPLO!='U' && *UPLO!='L') {
35 *INFO = -1;
36 } else if (*TRANS!='N' && *TRANS!='C' && *TRANS!='T') {
37 *INFO = -2;
38 } else if (*DIAG!='N' && *DIAG!='U') {
39 *INFO = -3;
40 } else if (*NORMIN!='Y' && *NORMIN!='N') {
41 *INFO = -4;
42 } else if (*N<0) {
43 *INFO = -5;
44 } else if (*LDA<std::max(INTEGER(1), *N)) {
45 *INFO = -7;
46 }
47 if (*INFO!=0) {
48 *INFO = -(*INFO);
49 LAPACK_ERROR("DLATRS", INFO);
50 *INFO = -(*INFO);
51 return;
52 }
53 //
54 // Call FLENS implementation
55 //
56 const bool normIn = (*NORMIN=='Y') ? true : false;
57 Transpose trans = cxxblas::getCxxBlasEnum<Transpose>(*TRANS);
58 Diag diag = cxxblas::getCxxBlasEnum<Diag>(*DIAG);
59 StorageUpLo upLo = cxxblas::getCxxBlasEnum<StorageUpLo>(*UPLO);
60 DConstTrMatrixView _A(DConstFSView(*N, *N, A, *LDA), upLo, diag);
61 DDenseVectorView _X = DArrayView(*N, X, 1);
62 DDenseVectorView _CNORM = DArrayView(*N, CNORM, 1);
63
64 latrs(trans, normIn, _A, _X, *SCALE, _CNORM);
65 }
66
67 } // extern "C"
68
69 } } // 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 //-- dlatrs --------------------------------------------------------------------
16 void
17 LAPACK_DECL(dlatrs)(const char *UPLO,
18 const char *TRANS,
19 const char *DIAG,
20 const char *NORMIN,
21 const INTEGER *N,
22 const DOUBLE *A,
23 const INTEGER *LDA,
24 DOUBLE *X,
25 DOUBLE *SCALE,
26 DOUBLE *CNORM,
27 INTEGER *INFO)
28 {
29 DEBUG_FLENS_LAPACK("dlatrs");
30 //
31 // Test the input parameters so that we pass LAPACK error checks
32 //
33 *INFO = 0;
34 if (*UPLO!='U' && *UPLO!='L') {
35 *INFO = -1;
36 } else if (*TRANS!='N' && *TRANS!='C' && *TRANS!='T') {
37 *INFO = -2;
38 } else if (*DIAG!='N' && *DIAG!='U') {
39 *INFO = -3;
40 } else if (*NORMIN!='Y' && *NORMIN!='N') {
41 *INFO = -4;
42 } else if (*N<0) {
43 *INFO = -5;
44 } else if (*LDA<std::max(INTEGER(1), *N)) {
45 *INFO = -7;
46 }
47 if (*INFO!=0) {
48 *INFO = -(*INFO);
49 LAPACK_ERROR("DLATRS", INFO);
50 *INFO = -(*INFO);
51 return;
52 }
53 //
54 // Call FLENS implementation
55 //
56 const bool normIn = (*NORMIN=='Y') ? true : false;
57 Transpose trans = cxxblas::getCxxBlasEnum<Transpose>(*TRANS);
58 Diag diag = cxxblas::getCxxBlasEnum<Diag>(*DIAG);
59 StorageUpLo upLo = cxxblas::getCxxBlasEnum<StorageUpLo>(*UPLO);
60 DConstTrMatrixView _A(DConstFSView(*N, *N, A, *LDA), upLo, diag);
61 DDenseVectorView _X = DArrayView(*N, X, 1);
62 DDenseVectorView _CNORM = DArrayView(*N, CNORM, 1);
63
64 latrs(trans, normIn, _A, _X, *SCALE, _CNORM);
65 }
66
67 } // extern "C"
68
69 } } // namespace lapack, flens