12 #ifndef EIGEN_COMPLEX_SCHUR_H
13 #define EIGEN_COMPLEX_SCHUR_H
20 template<
typename MatrixType,
bool IsComplex>
struct complex_schur_reduce_to_hessenberg;
64 typedef typename MatrixType::Scalar
Scalar;
112 template<
typename InputType>
114 :
m_matT(matrix.rows(),matrix.cols()),
115 m_matU(matrix.rows(),matrix.cols()),
190 template<
typename InputType>
210 template<
typename HessMatrixType,
typename OrthMatrixType>
265 template<typename MatrixType>
280 template<
typename MatrixType>
284 if (iter == 10 || iter == 20)
303 RealScalar eival1_norm = numext::norm1(eival1);
304 RealScalar eival2_norm = numext::norm1(eival2);
307 if(eival1_norm > eival2_norm)
308 eival2 = det / eival1;
310 eival1 = det / eival2;
313 if(numext::norm1(eival1-t.
coeff(1,1)) < numext::norm1(eival2-t.
coeff(1,1)))
314 return normt * eival1;
316 return normt * eival2;
320 template<
typename MatrixType>
321 template<
typename InputType>
327 if(matrix.
cols() == 1)
330 if(computeU)
m_matU = ComplexMatrixType::Identity(1,1);
342 template<
typename MatrixType>
343 template<
typename HessMatrixType,
typename OrthMatrixType>
355 template<
typename MatrixType,
bool IsComplex>
367 template<
typename MatrixType>
381 _this.
m_matU = Q.template cast<ComplexScalar>();
389 template<
typename MatrixType>
421 if(totalIter > maxIters)
break;
438 m_matT.topRows((
std::min)(il+2,iu)+1).applyOnTheRight(il, il+1, rot);
439 if(computeU)
m_matU.applyOnTheRight(il, il+1, rot);
441 for(
Index i=il+1 ; i<iu ; i++)
446 m_matT.topRows((
std::min)(i+2,iu)+1).applyOnTheRight(i, i+1, rot);
447 if(computeU)
m_matU.applyOnTheRight(i, i+1, rot);
451 if(totalIter <= maxIters)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
Definition: ArrayCwiseUnaryOps.h:52
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition: ArrayCwiseUnaryOps.h:187
EIGEN_DEVICE_FUNC RealReturnType real() const
Definition: CommonCwiseUnaryOps.h:100
#define eigen_assert(x)
Definition: Macros.h:1037
Performs a complex Schur decomposition of a real or complex square matrix.
Definition: ComplexSchur.h:52
ComplexSchur & computeFromHessenberg(const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU=true)
Compute Schur decomposition from a given Hessenberg matrix.
@ MaxRowsAtCompileTime
Definition: ComplexSchur.h:59
@ RowsAtCompileTime
Definition: ComplexSchur.h:56
@ MaxColsAtCompileTime
Definition: ComplexSchur.h:60
@ ColsAtCompileTime
Definition: ComplexSchur.h:57
@ Options
Definition: ComplexSchur.h:58
ComplexMatrixType m_matT
Definition: ComplexSchur.h:248
Index m_maxIters
Definition: ComplexSchur.h:253
Index getMaxIterations()
Returns the maximum number of iterations.
Definition: ComplexSchur.h:235
ComplexSchur & compute(const EigenBase< InputType > &matrix, bool computeU=true)
Computes Schur decomposition of given matrix.
NumTraits< Scalar >::Real RealScalar
Definition: ComplexSchur.h:65
bool m_isInitialized
Definition: ComplexSchur.h:251
ComplexMatrixType m_matU
Definition: ComplexSchur.h:248
void reduceToTriangularForm(bool computeU)
Definition: ComplexSchur.h:390
Eigen::Index Index
Definition: ComplexSchur.h:66
ComplexSchur & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
Definition: ComplexSchur.h:228
bool m_matUisUptodate
Definition: ComplexSchur.h:252
ComputationInfo info() const
Reports whether previous computation was successful.
Definition: ComplexSchur.h:217
MatrixType::Scalar Scalar
Scalar type for matrices of type _MatrixType.
Definition: ComplexSchur.h:64
ComplexSchur(const EigenBase< InputType > &matrix, bool computeU=true)
Constructor; computes Schur decomposition of given matrix.
Definition: ComplexSchur.h:113
bool subdiagonalEntryIsNeglegible(Index i)
Definition: ComplexSchur.h:266
ComplexScalar computeShift(Index iu, Index iter)
Definition: ComplexSchur.h:281
static const int m_maxIterationsPerRow
Maximum number of iterations per row.
Definition: ComplexSchur.h:245
ComplexSchur(Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
Default constructor.
Definition: ComplexSchur.h:94
ComputationInfo m_info
Definition: ComplexSchur.h:250
const ComplexMatrixType & matrixT() const
Returns the triangular matrix in the Schur decomposition.
Definition: ComplexSchur.h:162
std::complex< RealScalar > ComplexScalar
Complex scalar type for _MatrixType.
Definition: ComplexSchur.h:74
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > ComplexMatrixType
Type for the matrices in the Schur decomposition.
Definition: ComplexSchur.h:81
HessenbergDecomposition< MatrixType > m_hess
Definition: ComplexSchur.h:249
_MatrixType MatrixType
Definition: ComplexSchur.h:54
const ComplexMatrixType & matrixU() const
Returns the unitary matrix in the Schur decomposition.
Definition: ComplexSchur.h:138
HessenbergDecomposition & compute(const EigenBase< InputType > &matrix)
Computes Hessenberg decomposition of given matrix.
Definition: HessenbergDecomposition.h:152
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
Definition: HessenbergDecomposition.h:234
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
Definition: HessenbergDecomposition.h:262
Rotation given by a cosine-sine pair.
Definition: Jacobi.h:35
EIGEN_DEVICE_FUNC void makeGivens(const Scalar &p, const Scalar &q, Scalar *r=0)
Definition: Jacobi.h:162
EIGEN_DEVICE_FUNC JacobiRotation adjoint() const
Definition: Jacobi.h:67
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:175
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:145
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:143
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:152
ComputationInfo
Definition: Constants.h:440
@ Success
Definition: Constants.h:442
@ NoConvergence
Definition: Constants.h:446
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16() min(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:571
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1940
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
Definition: Constants.h:22
Definition: document.h:416
Definition: EigenBase.h:30
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:46
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: EigenBase.h:63
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: EigenBase.h:60
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
static void run(ComplexSchur< MatrixType > &_this, const MatrixType &matrix, bool computeU)
Definition: ComplexSchur.h:370
Definition: ComplexSchur.h:357
static void run(ComplexSchur< MatrixType > &_this, const MatrixType &matrix, bool computeU)
Definition: ComplexSchur.h:359