LLT_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  * LLt decomposition based on LAPACKE_?potrf function.
30  ********************************************************************************
31 */
32 
33 #ifndef EIGEN_LLT_LAPACKE_H
34 #define EIGEN_LLT_LAPACKE_H
35 
36 namespace Eigen {
37 
38 namespace internal {
39 
40 template<typename Scalar> struct lapacke_llt;
41 
42 #define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX) \
43 template<> struct lapacke_llt<EIGTYPE> \
44 { \
45  template<typename MatrixType> \
46  static inline Index potrf(MatrixType& m, char uplo) \
47  { \
48  lapack_int matrix_order; \
49  lapack_int size, lda, info, StorageOrder; \
50  EIGTYPE* a; \
51  eigen_assert(m.rows()==m.cols()); \
52  /* Set up parameters for ?potrf */ \
53  size = convert_index<lapack_int>(m.rows()); \
54  StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \
55  matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
56  a = &(m.coeffRef(0,0)); \
57  lda = convert_index<lapack_int>(m.outerStride()); \
58 \
59  info = LAPACKE_##LAPACKE_PREFIX##potrf( matrix_order, uplo, size, (BLASTYPE*)a, lda ); \
60  info = (info==0) ? -1 : info>0 ? info-1 : size; \
61  return info; \
62  } \
63 }; \
64 template<> struct llt_inplace<EIGTYPE, Lower> \
65 { \
66  template<typename MatrixType> \
67  static Index blocked(MatrixType& m) \
68  { \
69  return lapacke_llt<EIGTYPE>::potrf(m, 'L'); \
70  } \
71  template<typename MatrixType, typename VectorType> \
72  static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
73  { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \
74 }; \
75 template<> struct llt_inplace<EIGTYPE, Upper> \
76 { \
77  template<typename MatrixType> \
78  static Index blocked(MatrixType& m) \
79  { \
80  return lapacke_llt<EIGTYPE>::potrf(m, 'U'); \
81  } \
82  template<typename MatrixType, typename VectorType> \
83  static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
84  { \
85  Transpose<MatrixType> matt(mat); \
86  return llt_inplace<EIGTYPE, Lower>::rankUpdate(matt, vec.conjugate(), sigma); \
87  } \
88 };
89 
90 EIGEN_LAPACKE_LLT(double, double, d)
91 EIGEN_LAPACKE_LLT(float, float, s)
94 
95 } // end namespace internal
96 
97 } // end namespace Eigen
98 
99 #endif // EIGEN_LLT_LAPACKE_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
s
RealScalar s
Definition: level1_cplx_impl.h:126
d
static const double d[K][N]
Definition: igam.h:11
EIGEN_LAPACKE_LLT
#define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX)
Definition: LLT_LAPACKE.h:42
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
lapack_complex_float
#define lapack_complex_float
Definition: lapacke.h:76
Eigen::scomplex
std::complex< float > scomplex
Definition: MKL_support.h:126
Eigen::internal::lapacke_llt
Definition: LLT_LAPACKE.h:40
Eigen::dcomplex
std::complex< double > dcomplex
Definition: MKL_support.h:125
lapack_complex_double
#define lapack_complex_double
Definition: lapacke.h:92
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
internal
Definition: BandTriangularSolver.h:13


gtsam
Author(s):
autogenerated on Thu Nov 28 2024 04:03:23