Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MPC_current_control HydraulicControlBoard_SW AHRS Test_ekf ... more
ComplexSchur_MKL.h
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 * Complex Schur needed to complex unsymmetrical eigenvalues/eigenvectors. 00030 ******************************************************************************** 00031 */ 00032 00033 #ifndef EIGEN_COMPLEX_SCHUR_MKL_H 00034 #define EIGEN_COMPLEX_SCHUR_MKL_H 00035 00036 #include "Eigen/src/Core/util/MKL_support.h" 00037 00038 namespace Eigen { 00039 00040 /** \internal Specialization for the data types supported by MKL */ 00041 00042 #define EIGEN_MKL_SCHUR_COMPLEX(EIGTYPE, MKLTYPE, MKLPREFIX, MKLPREFIX_U, EIGCOLROW, MKLCOLROW) \ 00043 template<> inline \ 00044 ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \ 00045 ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW>& matrix, bool computeU) \ 00046 { \ 00047 typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \ 00048 typedef MatrixType::RealScalar RealScalar; \ 00049 typedef std::complex<RealScalar> ComplexScalar; \ 00050 \ 00051 eigen_assert(matrix.cols() == matrix.rows()); \ 00052 \ 00053 m_matUisUptodate = false; \ 00054 if(matrix.cols() == 1) \ 00055 { \ 00056 m_matT = matrix.cast<ComplexScalar>(); \ 00057 if(computeU) m_matU = ComplexMatrixType::Identity(1,1); \ 00058 m_info = Success; \ 00059 m_isInitialized = true; \ 00060 m_matUisUptodate = computeU; \ 00061 return *this; \ 00062 } \ 00063 lapack_int n = matrix.cols(), sdim, info; \ 00064 lapack_int lda = matrix.outerStride(); \ 00065 lapack_int matrix_order = MKLCOLROW; \ 00066 char jobvs, sort='N'; \ 00067 LAPACK_##MKLPREFIX_U##_SELECT1 select = 0; \ 00068 jobvs = (computeU) ? 'V' : 'N'; \ 00069 m_matU.resize(n, n); \ 00070 lapack_int ldvs = m_matU.outerStride(); \ 00071 m_matT = matrix; \ 00072 Matrix<EIGTYPE, Dynamic, Dynamic> w; \ 00073 w.resize(n, 1);\ 00074 info = LAPACKE_##MKLPREFIX##gees( matrix_order, jobvs, sort, select, n, (MKLTYPE*)m_matT.data(), lda, &sdim, (MKLTYPE*)w.data(), (MKLTYPE*)m_matU.data(), ldvs ); \ 00075 if(info == 0) \ 00076 m_info = Success; \ 00077 else \ 00078 m_info = NoConvergence; \ 00079 \ 00080 m_isInitialized = true; \ 00081 m_matUisUptodate = computeU; \ 00082 return *this; \ 00083 \ 00084 } 00085 00086 EIGEN_MKL_SCHUR_COMPLEX(dcomplex, MKL_Complex16, z, Z, ColMajor, LAPACK_COL_MAJOR) 00087 EIGEN_MKL_SCHUR_COMPLEX(scomplex, MKL_Complex8, c, C, ColMajor, LAPACK_COL_MAJOR) 00088 EIGEN_MKL_SCHUR_COMPLEX(dcomplex, MKL_Complex16, z, Z, RowMajor, LAPACK_ROW_MAJOR) 00089 EIGEN_MKL_SCHUR_COMPLEX(scomplex, MKL_Complex8, c, C, RowMajor, LAPACK_ROW_MAJOR) 00090 00091 } // end namespace Eigen 00092 00093 #endif // EIGEN_COMPLEX_SCHUR_MKL_H
Generated on Tue Jul 12 2022 17:34:10 by
