Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/eigen3/Eigen/src/Eigenvalues/ComplexSchur_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  *    Complex Schur needed to complex unsymmetrical eigenvalues/eigenvectors.
0030  ********************************************************************************
0031 */
0032 
0033 #ifndef EIGEN_COMPLEX_SCHUR_LAPACKE_H
0034 #define EIGEN_COMPLEX_SCHUR_LAPACKE_H
0035 
0036 namespace Eigen { 
0037 
0038 /** \internal Specialization for the data types supported by LAPACKe */
0039 
0040 #define EIGEN_LAPACKE_SCHUR_COMPLEX(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW) \
0041 template<> template<typename InputType> inline \
0042 ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
0043 ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, bool computeU) \
0044 { \
0045   typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \
0046   typedef MatrixType::RealScalar RealScalar; \
0047   typedef std::complex<RealScalar> ComplexScalar; \
0048 \
0049   eigen_assert(matrix.cols() == matrix.rows()); \
0050 \
0051   m_matUisUptodate = false; \
0052   if(matrix.cols() == 1) \
0053   { \
0054     m_matT = matrix.derived().template cast<ComplexScalar>(); \
0055     if(computeU)  m_matU = ComplexMatrixType::Identity(1,1); \
0056       m_info = Success; \
0057       m_isInitialized = true; \
0058       m_matUisUptodate = computeU; \
0059       return *this; \
0060   } \
0061   lapack_int n = internal::convert_index<lapack_int>(matrix.cols()), sdim, info; \
0062   lapack_int matrix_order = LAPACKE_COLROW; \
0063   char jobvs, sort='N'; \
0064   LAPACK_##LAPACKE_PREFIX_U##_SELECT1 select = 0; \
0065   jobvs = (computeU) ? 'V' : 'N'; \
0066   m_matU.resize(n, n); \
0067   lapack_int ldvs  = internal::convert_index<lapack_int>(m_matU.outerStride()); \
0068   m_matT = matrix; \
0069   lapack_int lda = internal::convert_index<lapack_int>(m_matT.outerStride()); \
0070   Matrix<EIGTYPE, Dynamic, Dynamic> w; \
0071   w.resize(n, 1);\
0072   info = LAPACKE_##LAPACKE_PREFIX##gees( matrix_order, jobvs, sort, select, n, (LAPACKE_TYPE*)m_matT.data(), lda, &sdim, (LAPACKE_TYPE*)w.data(), (LAPACKE_TYPE*)m_matU.data(), ldvs ); \
0073   if(info == 0) \
0074     m_info = Success; \
0075   else \
0076     m_info = NoConvergence; \
0077 \
0078   m_isInitialized = true; \
0079   m_matUisUptodate = computeU; \
0080   return *this; \
0081 \
0082 }
0083 
0084 EIGEN_LAPACKE_SCHUR_COMPLEX(dcomplex, lapack_complex_double, z, Z, ColMajor, LAPACK_COL_MAJOR)
0085 EIGEN_LAPACKE_SCHUR_COMPLEX(scomplex, lapack_complex_float,  c, C, ColMajor, LAPACK_COL_MAJOR)
0086 EIGEN_LAPACKE_SCHUR_COMPLEX(dcomplex, lapack_complex_double, z, Z, RowMajor, LAPACK_ROW_MAJOR)
0087 EIGEN_LAPACKE_SCHUR_COMPLEX(scomplex, lapack_complex_float,  c, C, RowMajor, LAPACK_ROW_MAJOR)
0088 
0089 } // end namespace Eigen
0090 
0091 #endif // EIGEN_COMPLEX_SCHUR_LAPACKE_H