Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/eigen3/Eigen/src/LU/PartialPivLU_LAPACKE.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  Copyright (c) 2011, Intel Corporation. All rights reserved.
0003 
0004  Redistribution and use in source and binary forms, with or without modification,
0005  are permitted provided that the following conditions are met:
0006 
0007  * Redistributions of source code must retain the above copyright notice, this
0008    list of conditions and the following disclaimer.
0009  * Redistributions in binary form must reproduce the above copyright notice,
0010    this list of conditions and the following disclaimer in the documentation
0011    and/or other materials provided with the distribution.
0012  * Neither the name of Intel Corporation nor the names of its contributors may
0013    be used to endorse or promote products derived from this software without
0014    specific prior written permission.
0015 
0016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
0017  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0018  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0019  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
0020  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
0021  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0022  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
0023  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0024  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0025  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0026 
0027  ********************************************************************************
0028  *   Content : Eigen bindings to LAPACKe
0029  *     LU decomposition with partial pivoting based on LAPACKE_?getrf function.
0030  ********************************************************************************
0031 */
0032 
0033 #ifndef EIGEN_PARTIALLU_LAPACK_H
0034 #define EIGEN_PARTIALLU_LAPACK_H
0035 
0036 namespace Eigen { 
0037 
0038 namespace internal {
0039 
0040 /** \internal Specialization for the data types supported by LAPACKe */
0041 
0042 #define EIGEN_LAPACKE_LU_PARTPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \
0043 template<int StorageOrder> \
0044 struct partial_lu_impl<EIGTYPE, StorageOrder, lapack_int> \
0045 { \
0046   /* \internal performs the LU decomposition in-place of the matrix represented */ \
0047   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) \
0048   { \
0049     EIGEN_UNUSED_VARIABLE(maxBlockSize);\
0050     lapack_int matrix_order, first_zero_pivot; \
0051     lapack_int m, n, lda, *ipiv, info; \
0052     EIGTYPE* a; \
0053 /* Set up parameters for ?getrf */ \
0054     matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
0055     lda = convert_index<lapack_int>(luStride); \
0056     a = lu_data; \
0057     ipiv = row_transpositions; \
0058     m = convert_index<lapack_int>(rows); \
0059     n = convert_index<lapack_int>(cols); \
0060     nb_transpositions = 0; \
0061 \
0062     info = LAPACKE_##LAPACKE_PREFIX##getrf( matrix_order, m, n, (LAPACKE_TYPE*)a, lda, ipiv ); \
0063 \
0064     for(int i=0;i<m;i++) { ipiv[i]--; if (ipiv[i]!=i) nb_transpositions++; } \
0065 \
0066     eigen_assert(info >= 0); \
0067 /* something should be done with nb_transpositions */ \
0068 \
0069     first_zero_pivot = info; \
0070     return first_zero_pivot; \
0071   } \
0072 };
0073 
0074 EIGEN_LAPACKE_LU_PARTPIV(double, double, d)
0075 EIGEN_LAPACKE_LU_PARTPIV(float, float, s)
0076 EIGEN_LAPACKE_LU_PARTPIV(dcomplex, lapack_complex_double, z)
0077 EIGEN_LAPACKE_LU_PARTPIV(scomplex, lapack_complex_float,  c)
0078 
0079 } // end namespace internal
0080 
0081 } // end namespace Eigen
0082 
0083 #endif // EIGEN_PARTIALLU_LAPACK_H