TR-mbed 1.0
Loading...
Searching...
No Matches
ComplexSchur_LAPACKE.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2011, Intel Corporation. All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6
7 * Redistributions of source code must retain the above copyright notice, this
8 list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright notice,
10 this list of conditions and the following disclaimer in the documentation
11 and/or other materials provided with the distribution.
12 * Neither the name of Intel Corporation nor the names of its contributors may
13 be used to endorse or promote products derived from this software without
14 specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27 ********************************************************************************
28 * Content : Eigen bindings to LAPACKe
29 * Complex Schur needed to complex unsymmetrical eigenvalues/eigenvectors.
30 ********************************************************************************
31*/
32
33#ifndef EIGEN_COMPLEX_SCHUR_LAPACKE_H
34#define EIGEN_COMPLEX_SCHUR_LAPACKE_H
35
36namespace Eigen {
37
40#define EIGEN_LAPACKE_SCHUR_COMPLEX(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW) \
41template<> template<typename InputType> inline \
42ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >& \
43ComplexSchur<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> >::compute(const EigenBase<InputType>& matrix, bool computeU) \
44{ \
45 typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW> MatrixType; \
46 typedef MatrixType::RealScalar RealScalar; \
47 typedef std::complex<RealScalar> ComplexScalar; \
48\
49 eigen_assert(matrix.cols() == matrix.rows()); \
50\
51 m_matUisUptodate = false; \
52 if(matrix.cols() == 1) \
53 { \
54 m_matT = matrix.derived().template cast<ComplexScalar>(); \
55 if(computeU) m_matU = ComplexMatrixType::Identity(1,1); \
56 m_info = Success; \
57 m_isInitialized = true; \
58 m_matUisUptodate = computeU; \
59 return *this; \
60 } \
61 lapack_int n = internal::convert_index<lapack_int>(matrix.cols()), sdim, info; \
62 lapack_int matrix_order = LAPACKE_COLROW; \
63 char jobvs, sort='N'; \
64 LAPACK_##LAPACKE_PREFIX_U##_SELECT1 select = 0; \
65 jobvs = (computeU) ? 'V' : 'N'; \
66 m_matU.resize(n, n); \
67 lapack_int ldvs = internal::convert_index<lapack_int>(m_matU.outerStride()); \
68 m_matT = matrix; \
69 lapack_int lda = internal::convert_index<lapack_int>(m_matT.outerStride()); \
70 Matrix<EIGTYPE, Dynamic, Dynamic> w; \
71 w.resize(n, 1);\
72 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 ); \
73 if(info == 0) \
74 m_info = Success; \
75 else \
76 m_info = NoConvergence; \
77\
78 m_isInitialized = true; \
79 m_matUisUptodate = computeU; \
80 return *this; \
81\
82}
83
88
89} // end namespace Eigen
90
91#endif // EIGEN_COMPLEX_SCHUR_LAPACKE_H
#define EIGEN_LAPACKE_SCHUR_COMPLEX(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW)
Definition ComplexSchur_LAPACKE.h:40
Scalar Scalar * c
Definition benchVecAdd.cpp:17
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
#define Z
Definition icosphere.cpp:21
#define LAPACK_COL_MAJOR
Definition lapacke.h:123
#define LAPACK_ROW_MAJOR
Definition lapacke.h:122
#define lapack_complex_double
Definition lapacke.h:92
#define lapack_complex_float
Definition lapacke.h:76
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
std::complex< double > dcomplex
Definition MKL_support.h:125
std::complex< float > scomplex
Definition MKL_support.h:126