Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_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  *    Self-adjoint eigenvalues/eigenvectors.
0030  ********************************************************************************
0031 */
0032 
0033 #ifndef EIGEN_SAEIGENSOLVER_LAPACKE_H
0034 #define EIGEN_SAEIGENSOLVER_LAPACKE_H
0035 
0036 namespace Eigen { 
0037 
0038 /** \internal Specialization for the data types supported by LAPACKe */
0039 
0040 #define EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, EIGCOLROW ) \
0041 template<> template<typename InputType> inline \
0042 SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
0043 SelfAdjointEigenSolver<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, int options) \
0044 { \
0045   eigen_assert(matrix.cols() == matrix.rows()); \
0046   eigen_assert((options&~(EigVecMask|GenEigMask))==0 \
0047           && (options&EigVecMask)!=EigVecMask \
0048           && "invalid option parameter"); \
0049   bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; \
0050   lapack_int n = internal::convert_index<lapack_int>(matrix.cols()), lda, info; \
0051   m_eivalues.resize(n,1); \
0052   m_subdiag.resize(n-1); \
0053   m_eivec = matrix; \
0054 \
0055   if(n==1) \
0056   { \
0057     m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0)); \
0058     if(computeEigenvectors) m_eivec.setOnes(n,n); \
0059     m_info = Success; \
0060     m_isInitialized = true; \
0061     m_eigenvectorsOk = computeEigenvectors; \
0062     return *this; \
0063   } \
0064 \
0065   lda = internal::convert_index<lapack_int>(m_eivec.outerStride()); \
0066   char jobz, uplo='L'/*, range='A'*/; \
0067   jobz = computeEigenvectors ? 'V' : 'N'; \
0068 \
0069   info = LAPACKE_##LAPACKE_NAME( LAPACK_COL_MAJOR, jobz, uplo, n, (LAPACKE_TYPE*)m_eivec.data(), lda, (LAPACKE_RTYPE*)m_eivalues.data() ); \
0070   m_info = (info==0) ? Success : NoConvergence; \
0071   m_isInitialized = true; \
0072   m_eigenvectorsOk = computeEigenvectors; \
0073   return *this; \
0074 }
0075 
0076 #define EIGEN_LAPACKE_EIG_SELFADJ(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME )              \
0077         EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, ColMajor )  \
0078         EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, RowMajor ) 
0079 
0080 EIGEN_LAPACKE_EIG_SELFADJ(double,   double,                double, dsyev)
0081 EIGEN_LAPACKE_EIG_SELFADJ(float,    float,                 float,  ssyev)
0082 EIGEN_LAPACKE_EIG_SELFADJ(dcomplex, lapack_complex_double, double, zheev)
0083 EIGEN_LAPACKE_EIG_SELFADJ(scomplex, lapack_complex_float,  float,  cheev)
0084 
0085 } // end namespace Eigen
0086 
0087 #endif // EIGEN_SAEIGENSOLVER_H