1 #include <flens/lapack/interface/include/config.h>
2
3
4 namespace flens { namespace lapack {
5
6 extern "C" {
7
8 //-- dgeqrf --------------------------------------------------------------------
9 void
10 LAPACK_DECL(dgeqrf)(const INTEGER *M,
11 const INTEGER *N,
12 DOUBLE *A,
13 const INTEGER *LDA,
14 DOUBLE *TAU,
15 DOUBLE *WORK,
16 const INTEGER *LWORK,
17 INTEGER *INFO)
18 {
19 DEBUG_FLENS_LAPACK("dgeqrf");
20
21 using std::max;
22 using std::min;
23 //
24 // Test the input parameters so that we pass LAPACK error checks
25 //
26 bool lQuery = (*LWORK==-1);
27
28 *INFO = 0;
29 if (*M<0) {
30 *INFO = -1;
31 } else if (*N<0) {
32 *INFO = -2;
33 } else if (*LDA<std::max(INTEGER(1), *M)) {
34 *INFO = -4;
35 } else if ((*LWORK<max(INTEGER(1), *N)) && (!lQuery)) {
36 *INFO = -7;
37 }
38 if (*INFO!=0) {
39 *INFO = -(*INFO);
40 LAPACK_ERROR("DGEQRF", INFO);
41 *INFO = -(*INFO);
42 return;
43 }
44 //
45 // Handle worksize query
46 //
47 if (lQuery) {
48 // TODO: implement qrf_wsq
49 ASSERT(0);
50 }
51 //
52 // Call FLENS implementation
53 //
54 DGeMatrixView _A = DFSView(*M, *N, A, *LDA);
55 DDenseVectorView _TAU = DArrayView(min(*M,*N), TAU, 1);
56 DDenseVectorView _WORK = DArrayView(*LWORK, WORK, 1);
57
58 qrf(_A, _TAU, _WORK);
59 }
60
61 } // extern "C"
62
63 } } // namespace lapack, flens
2
3
4 namespace flens { namespace lapack {
5
6 extern "C" {
7
8 //-- dgeqrf --------------------------------------------------------------------
9 void
10 LAPACK_DECL(dgeqrf)(const INTEGER *M,
11 const INTEGER *N,
12 DOUBLE *A,
13 const INTEGER *LDA,
14 DOUBLE *TAU,
15 DOUBLE *WORK,
16 const INTEGER *LWORK,
17 INTEGER *INFO)
18 {
19 DEBUG_FLENS_LAPACK("dgeqrf");
20
21 using std::max;
22 using std::min;
23 //
24 // Test the input parameters so that we pass LAPACK error checks
25 //
26 bool lQuery = (*LWORK==-1);
27
28 *INFO = 0;
29 if (*M<0) {
30 *INFO = -1;
31 } else if (*N<0) {
32 *INFO = -2;
33 } else if (*LDA<std::max(INTEGER(1), *M)) {
34 *INFO = -4;
35 } else if ((*LWORK<max(INTEGER(1), *N)) && (!lQuery)) {
36 *INFO = -7;
37 }
38 if (*INFO!=0) {
39 *INFO = -(*INFO);
40 LAPACK_ERROR("DGEQRF", INFO);
41 *INFO = -(*INFO);
42 return;
43 }
44 //
45 // Handle worksize query
46 //
47 if (lQuery) {
48 // TODO: implement qrf_wsq
49 ASSERT(0);
50 }
51 //
52 // Call FLENS implementation
53 //
54 DGeMatrixView _A = DFSView(*M, *N, A, *LDA);
55 DDenseVectorView _TAU = DArrayView(min(*M,*N), TAU, 1);
56 DDenseVectorView _WORK = DArrayView(*LWORK, WORK, 1);
57
58 qrf(_A, _TAU, _WORK);
59 }
60
61 } // extern "C"
62
63 } } // namespace lapack, flens