00001 /* 00002 Copyright (c) 2011, Intel Corporation. All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without modification, 00005 are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright notice, this 00008 list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright notice, 00010 this list of conditions and the following disclaimer in the documentation 00011 and/or other materials provided with the distribution. 00012 * Neither the name of Intel Corporation nor the names of its contributors may 00013 be used to endorse or promote products derived from this software without 00014 specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00020 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00023 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 00027 ******************************************************************************** 00028 * Content : Eigen bindings to Intel(R) MKL 00029 * Householder QR decomposition of a matrix w/o pivoting based on 00030 * LAPACKE_?geqrf function. 00031 ******************************************************************************** 00032 */ 00033 00034 #ifndef EIGEN_QR_MKL_H 00035 #define EIGEN_QR_MKL_H 00036 00037 #include "../Core/util/MKL_support.h" 00038 00039 namespace Eigen { 00040 00041 namespace internal { 00042 00045 #define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \ 00046 template<typename MatrixQR, typename HCoeffs> \ 00047 struct householder_qr_inplace_blocked<MatrixQR, HCoeffs, EIGTYPE, true> \ 00048 { \ 00049 static void run(MatrixQR& mat, HCoeffs& hCoeffs, \ 00050 typename MatrixQR::Index = 32, \ 00051 typename MatrixQR::Scalar* = 0) \ 00052 { \ 00053 lapack_int m = (lapack_int) mat.rows(); \ 00054 lapack_int n = (lapack_int) mat.cols(); \ 00055 lapack_int lda = (lapack_int) mat.outerStride(); \ 00056 lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 00057 LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \ 00058 hCoeffs.adjointInPlace(); \ 00059 } \ 00060 }; 00061 00062 EIGEN_MKL_QR_NOPIV(double, double, d) 00063 EIGEN_MKL_QR_NOPIV(float, float, s) 00064 EIGEN_MKL_QR_NOPIV(dcomplex, MKL_Complex16, z) 00065 EIGEN_MKL_QR_NOPIV(scomplex, MKL_Complex8, c) 00066 00067 } // end namespace internal 00068 00069 } // end namespace Eigen 00070 00071 #endif // EIGEN_QR_MKL_H