HouseholderQR_LAPACKE.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2011, Intel Corporation. All rights reserved.
3 
4  Redistribution and use in source and binary forms, with or without modification,
5  are permitted provided that the following conditions are met:
6 
7  * Redistributions of source code must retain the above copyright notice, this
8  list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright notice,
10  this list of conditions and the following disclaimer in the documentation
11  and/or other materials provided with the distribution.
12  * Neither the name of Intel Corporation nor the names of its contributors may
13  be used to endorse or promote products derived from this software without
14  specific prior written permission.
15 
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27  ********************************************************************************
28  * Content : Eigen bindings to LAPACKe
29  * Householder QR decomposition of a matrix w/o pivoting based on
30  * LAPACKE_?geqrf function.
31  ********************************************************************************
32 */
33 
34 #ifndef EIGEN_QR_LAPACKE_H
35 #define EIGEN_QR_LAPACKE_H
36 
37 #include "./InternalHeaderCheck.h"
38 
39 namespace Eigen {
40 
41 namespace internal {
42 
43 namespace lapacke_helpers {
44 
45 template<typename MatrixQR, typename HCoeffs>
46 struct lapacke_hqr
47 {
48  static void run(MatrixQR& mat, HCoeffs& hCoeffs, Index = 32, typename MatrixQR::Scalar* = 0)
49  {
50  lapack_int m = to_lapack(mat.rows());
51  lapack_int n = to_lapack(mat.cols());
52  lapack_int lda = to_lapack(mat.outerStride());
53  lapack_int matrix_order = lapack_storage_of(mat);
54  geqrf(matrix_order, m, n, to_lapack(mat.data()), lda, to_lapack(hCoeffs.data()));
55  hCoeffs.adjointInPlace();
56  }
57 };
58 
59 }
60 
62 #define EIGEN_LAPACKE_HH_QR(EIGTYPE) \
63 template<typename MatrixQR, typename HCoeffs> \
64 struct householder_qr_inplace_blocked<MatrixQR, HCoeffs, EIGTYPE, true> : public lapacke_helpers::lapacke_hqr<MatrixQR, HCoeffs> {};
65 
66 EIGEN_LAPACKE_HH_QR(double)
68 EIGEN_LAPACKE_HH_QR(std::complex<double>)
69 EIGEN_LAPACKE_HH_QR(std::complex<float>)
70 
71 #undef EIGEN_LAPACKE_HH_QR
72 
73 } // end namespace internal
74 
75 } // end namespace Eigen
76 
77 #endif // EIGEN_QR_LAPACKE_H
Matrix3f m
int n
#define EIGEN_LAPACKE_HH_QR(EIGTYPE)
#define lapack_int
Definition: lapacke.h:52
: InteropHeaders
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82