Eigne Matrix Class Library

Dependents:   MPC_current_control HydraulicControlBoard_SW AHRS Test_ekf ... more

Committer:
ykuroda
Date:
Thu Oct 13 04:07:23 2016 +0000
Revision:
0:13a5d365ba16
First commint, Eigne Matrix Class Library

Who changed what in which revision?

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