Eigen  3.3.3
RealSchur_LAPACKE.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 LAPACKe
00029  *    Real Schur needed to real unsymmetrical eigenvalues/eigenvectors.
00030  ********************************************************************************
00031 */
00032 
00033 #ifndef EIGEN_REAL_SCHUR_LAPACKE_H
00034 #define EIGEN_REAL_SCHUR_LAPACKE_H
00035 
00036 namespace Eigen { 
00037 
00040 #define EIGEN_LAPACKE_SCHUR_REAL(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW) \
00041 template<> template<typename InputType> inline \
00042 RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
00043 RealSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, bool computeU) \
00044 { \
00045   eigen_assert(matrix.cols() == matrix.rows()); \
00046 \
00047   lapack_int n = internal::convert_index<lapack_int>(matrix.cols()), sdim, info; \
00048   lapack_int matrix_order = LAPACKE_COLROW; \
00049   char jobvs, sort='N'; \
00050   LAPACK_##LAPACKE_PREFIX_U##_SELECT2 select = 0; \
00051   jobvs = (computeU) ? 'V' : 'N'; \
00052   m_matU.resize(n, n); \
00053   lapack_int ldvs  = internal::convert_index<lapack_int>(m_matU.outerStride()); \
00054   m_matT = matrix; \
00055   lapack_int lda = internal::convert_index<lapack_int>(m_matT.outerStride()); \
00056   Matrix<EIGTYPE, Dynamic, Dynamic> wr, wi; \
00057   wr.resize(n, 1); wi.resize(n, 1); \
00058   info = LAPACKE_##LAPACKE_PREFIX##gees( matrix_order, jobvs, sort, select, n, (LAPACKE_TYPE*)m_matT.data(), lda, &sdim, (LAPACKE_TYPE*)wr.data(), (LAPACKE_TYPE*)wi.data(), (LAPACKE_TYPE*)m_matU.data(), ldvs ); \
00059   if(info == 0) \
00060     m_info = Success; \
00061   else \
00062     m_info = NoConvergence; \
00063 \
00064   m_isInitialized = true; \
00065   m_matUisUptodate = computeU; \
00066   return *this; \
00067 \
00068 }
00069 
00070 EIGEN_LAPACKE_SCHUR_REAL(double,   double, d, D, ColMajor, LAPACK_COL_MAJOR)
00071 EIGEN_LAPACKE_SCHUR_REAL(float,    float,  s, S, ColMajor, LAPACK_COL_MAJOR)
00072 EIGEN_LAPACKE_SCHUR_REAL(double,   double, d, D, RowMajor, LAPACK_ROW_MAJOR)
00073 EIGEN_LAPACKE_SCHUR_REAL(float,    float,  s, S, RowMajor, LAPACK_ROW_MAJOR)
00074 
00075 } // end namespace Eigen
00076 
00077 #endif // EIGEN_REAL_SCHUR_LAPACKE_H
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends