12 #ifndef EIGEN_COMPLEX_SCHUR_H
13 #define EIGEN_COMPLEX_SCHUR_H
23 template <
typename MatrixType,
bool IsComplex>
24 struct complex_schur_reduce_to_hessenberg;
55 template <
typename MatrixType_>
117 template <
typename InputType>
192 template <
typename InputType>
212 template <
typename HessMatrixType,
typename OrthMatrixType>
214 bool computeU =
true);
263 template <typename MatrixType>
275 template <
typename MatrixType>
278 if ((iter == 10 || iter == 20) && iu > 1) {
296 RealScalar eival1_norm = numext::norm1(eival1);
297 RealScalar eival2_norm = numext::norm1(eival2);
300 if (eival1_norm > eival2_norm)
301 eival2 = det / eival1;
303 eival1 = det / eival2;
306 if (numext::norm1(eival1 -
t.coeff(1, 1)) < numext::norm1(eival2 -
t.coeff(1, 1)))
307 return normt * eival1;
309 return normt * eival2;
312 template <
typename MatrixType>
313 template <
typename InputType>
319 m_matT =
matrix.derived().template cast<ComplexScalar>();
320 if (computeU)
m_matU = ComplexMatrixType::Identity(1, 1);
333 template <
typename MatrixType>
334 template <
typename HessMatrixType,
typename OrthMatrixType>
336 const OrthMatrixType& matrixQ,
339 if (computeU)
m_matU = matrixQ;
346 template <
typename MatrixType,
bool IsComplex>
356 template <
typename MatrixType>
367 _this.
m_matU =
Q.template cast<ComplexScalar>();
375 template <
typename MatrixType>
403 if (totalIter > maxIters)
break;
420 if (computeU)
m_matU.applyOnTheRight(il, il + 1,
rot);
422 for (
Index i = il + 1;
i < iu;
i++) {
427 if (computeU)
m_matU.applyOnTheRight(
i,
i + 1,
rot);
431 if (totalIter <= maxIters)
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
int i
Definition: BiCGSTAB_step_by_step.cpp:9
MatrixXf Q
Definition: HouseholderQR_householderQ.cpp:1
#define eigen_assert(x)
Definition: Macros.h:910
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Performs a complex Schur decomposition of a real or complex square matrix.
Definition: ComplexSchur.h:56
ComputationInfo info() const
Reports whether previous computation was successful.
Definition: ComplexSchur.h:220
bool m_matUisUptodate
Definition: ComplexSchur.h:250
const ComplexMatrixType & matrixU() const
Returns the unitary matrix in the Schur decomposition.
Definition: ComplexSchur.h:142
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType_.
Definition: ComplexSchur.h:68
const ComplexMatrixType & matrixT() const
Returns the triangular matrix in the Schur decomposition.
Definition: ComplexSchur.h:165
bool m_isInitialized
Definition: ComplexSchur.h:249
HessenbergDecomposition< MatrixType > m_hess
Definition: ComplexSchur.h:247
NumTraits< Scalar >::Real RealScalar
Definition: ComplexSchur.h:69
ComplexSchur(Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
Default constructor.
Definition: ComplexSchur.h:100
void reduceToTriangularForm(bool computeU)
Definition: ComplexSchur.h:376
MatrixType_ MatrixType
Definition: ComplexSchur.h:58
Index getMaxIterations()
Returns the maximum number of iterations.
Definition: ComplexSchur.h:236
ComplexMatrixType m_matU
Definition: ComplexSchur.h:246
static const int m_maxIterationsPerRow
Maximum number of iterations per row.
Definition: ComplexSchur.h:243
Eigen::Index Index
Definition: ComplexSchur.h:70
std::complex< RealScalar > ComplexScalar
Complex scalar type for MatrixType_.
Definition: ComplexSchur.h:78
ComplexSchur & computeFromHessenberg(const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU=true)
Compute Schur decomposition from a given Hessenberg matrix.
@ MaxRowsAtCompileTime
Definition: ComplexSchur.h:63
@ Options
Definition: ComplexSchur.h:62
@ ColsAtCompileTime
Definition: ComplexSchur.h:61
@ MaxColsAtCompileTime
Definition: ComplexSchur.h:64
@ RowsAtCompileTime
Definition: ComplexSchur.h:60
ComplexMatrixType m_matT
Definition: ComplexSchur.h:246
ComplexSchur & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
Definition: ComplexSchur.h:230
ComplexSchur(const EigenBase< InputType > &matrix, bool computeU=true)
Constructor; computes Schur decomposition of given matrix.
Definition: ComplexSchur.h:118
bool subdiagonalEntryIsNeglegible(Index i)
Definition: ComplexSchur.h:264
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > ComplexMatrixType
Type for the matrices in the Schur decomposition.
Definition: ComplexSchur.h:87
ComplexScalar computeShift(Index iu, Index iter)
Definition: ComplexSchur.h:276
ComputationInfo m_info
Definition: ComplexSchur.h:248
Index m_maxIters
Definition: ComplexSchur.h:251
ComplexSchur & compute(const EigenBase< InputType > &matrix, bool computeU=true)
Computes Schur decomposition of given matrix.
HessenbergDecomposition & compute(const EigenBase< InputType > &matrix)
Computes Hessenberg decomposition of given matrix.
Definition: HessenbergDecomposition.h:147
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
Definition: HessenbergDecomposition.h:250
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
Definition: HessenbergDecomposition.h:225
Rotation given by a cosine-sine pair.
Definition: Jacobi.h:38
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:217
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:198
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:192
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:191
@ IsComplex
Definition: common.h:73
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
float real
Definition: datatypes.h:10
#define min(a, b)
Definition: datatypes.h:22
ComputationInfo
Definition: Constants.h:438
@ Success
Definition: Constants.h:440
@ NoConvergence
Definition: Constants.h:444
EIGEN_BLAS_FUNC() rot(int *n, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pc, Scalar *ps)
Definition: level1_real_impl.h:88
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1916
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool is_exactly_zero(const X &x)
Definition: Meta.h:592
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
int c
Definition: calibrate.py:100
Definition: Eigen_Colamd.h:49
t
Definition: plotPSD.py:36
Definition: EigenBase.h:33
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
static void run(ComplexSchur< MatrixType > &_this, const MatrixType &matrix, bool computeU)
Definition: ComplexSchur.h:358
Definition: ComplexSchur.h:347
static void run(ComplexSchur< MatrixType > &_this, const MatrixType &matrix, bool computeU)
Definition: ComplexSchur.h:349
Definition: ForwardDeclarations.h:21