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(dgeqp3)(const INTEGER    *M,
11                     const INTEGER    *N,
12                     DOUBLE           *A,
13                     const INTEGER    *LDA,
14                     INTEGER          *JPVT,
15                     DOUBLE           *TAU,
16                     DOUBLE           *WORK,
17                     const INTEGER    *LWORK,
18                     INTEGER          *INFO)
19 {
20     DEBUG_FLENS_LAPACK("dgeqp3");
21 
22     using std::max;
23     using std::min;
24 //
25 //  Test the input parameters so that we pass LAPACK error checks
26 //
27     *INFO = 0;
28     if (*M<0) {
29         *INFO = -1;
30     } else if (*N<0) {
31         *INFO = -2;
32     } else if (*LDA<std::max(INTEGER(1), *M)) {
33         *INFO = -4;
34     } else if (*LWORK<3*(*N)+1) {
35         *INFO = -8;
36     }
37     if (*INFO!=0) {
38         *INFO = -(*INFO);
39         LAPACK_ERROR("DGEQP3", INFO);
40         *INFO = -(*INFO);
41         return;
42     }
43 
44     DGeMatrixView       _A      = DFSView(*M, *N, A, *LDA);
45     IDenseVectorView    _JPVT   = IArrayView(*N, JPVT, 1);
46     DDenseVectorView    _TAU    = DArrayView(min(*M,*N), TAU, 1);
47     DDenseVectorView    _WORK   = DArrayView(*LWORK, WORK, 1);
48 
49     qp3(_A, _JPVT, _TAU, _WORK);
50 }
51 
52 // extern "C"
53 
54 } } // namespace lapack, flens