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