PartialPivLU_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  * LU decomposition with partial pivoting based on LAPACKE_?getrf function.
30  ********************************************************************************
31 */
32 
33 #ifndef EIGEN_PARTIALLU_LAPACK_H
34 #define EIGEN_PARTIALLU_LAPACK_H
35 
36 namespace Eigen {
37 
38 namespace internal {
39 
42 #define EIGEN_LAPACKE_LU_PARTPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \
43 template<int StorageOrder> \
44 struct partial_lu_impl<EIGTYPE, StorageOrder, lapack_int> \
45 { \
46  /* \internal performs the LU decomposition in-place of the matrix represented */ \
47  static lapack_int blocked_lu(Index rows, Index cols, EIGTYPE* lu_data, Index luStride, lapack_int* row_transpositions, lapack_int& nb_transpositions, lapack_int maxBlockSize=256) \
48  { \
49  EIGEN_UNUSED_VARIABLE(maxBlockSize);\
50  lapack_int matrix_order, first_zero_pivot; \
51  lapack_int m, n, lda, *ipiv, info; \
52  EIGTYPE* a; \
53 /* Set up parameters for ?getrf */ \
54  matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
55  lda = convert_index<lapack_int>(luStride); \
56  a = lu_data; \
57  ipiv = row_transpositions; \
58  m = convert_index<lapack_int>(rows); \
59  n = convert_index<lapack_int>(cols); \
60  nb_transpositions = 0; \
61 \
62  info = LAPACKE_##LAPACKE_PREFIX##getrf( matrix_order, m, n, (LAPACKE_TYPE*)a, lda, ipiv ); \
63 \
64  for(int i=0;i<m;i++) { ipiv[i]--; if (ipiv[i]!=i) nb_transpositions++; } \
65 \
66  eigen_assert(info >= 0); \
67 /* something should be done with nb_transpositions */ \
68 \
69  first_zero_pivot = info; \
70  return first_zero_pivot; \
71  } \
72 };
73 
74 EIGEN_LAPACKE_LU_PARTPIV(double, double, d)
75 EIGEN_LAPACKE_LU_PARTPIV(float, float, s)
78 
79 } // end namespace internal
80 
81 } // end namespace Eigen
82 
83 #endif // EIGEN_PARTIALLU_LAPACK_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
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
EIGEN_LAPACKE_LU_PARTPIV
#define EIGEN_LAPACKE_LU_PARTPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX)
Definition: PartialPivLU_LAPACKE.h:42
lapack_complex_float
#define lapack_complex_float
Definition: lapacke.h:76
Eigen::scomplex
std::complex< float > scomplex
Definition: MKL_support.h:126
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 Sat Nov 16 2024 04:03:31