12 #ifndef EIGEN_COMPLEX_SCHUR_H
13 #define EIGEN_COMPLEX_SCHUR_H
22 template<
typename MatrixType,
bool IsComplex>
struct complex_schur_reduce_to_hessenberg;
114 template<
typename InputType>
192 template<
typename InputType>
212 template<
typename HessMatrixType,
typename OrthMatrixType>
267 template<typename MatrixType>
282 template<
typename MatrixType>
286 if (iter == 10 || iter == 20)
305 RealScalar eival1_norm = numext::norm1(eival1);
306 RealScalar eival2_norm = numext::norm1(eival2);
309 if(eival1_norm > eival2_norm)
310 eival2 = det / eival1;
312 eival1 = det / eival2;
315 if(numext::norm1(eival1-t.
coeff(1,1)) < numext::norm1(eival2-t.
coeff(1,1)))
316 return normt * eival1;
318 return normt * eival2;
322 template<
typename MatrixType>
323 template<
typename InputType>
329 if(matrix.
cols() == 1)
332 if(computeU)
m_matU = ComplexMatrixType::Identity(1,1);
339 internal::complex_schur_reduce_to_hessenberg<MatrixType, NumTraits<Scalar>::IsComplex>::run(*
this, matrix.
derived(), computeU);
344 template<
typename MatrixType>
345 template<
typename HessMatrixType,
typename OrthMatrixType>
357 template<
typename MatrixType,
bool IsComplex>
358 struct complex_schur_reduce_to_hessenberg
369 template<
typename MatrixType>
370 struct complex_schur_reduce_to_hessenberg<
MatrixType, false>
372 static void run(ComplexSchur<MatrixType>& _this,
const MatrixType& matrix,
bool computeU)
377 _this.m_hess.compute(matrix);
378 _this.m_matT = _this.m_hess.matrixH().template cast<ComplexScalar>();
383 _this.m_matU =
Q.template cast<ComplexScalar>();
391 template<
typename MatrixType>
423 if(totalIter > maxIters)
break;
440 m_matT.topRows((
std::min)(il+2,iu)+1).applyOnTheRight(il, il+1, rot);
441 if(computeU)
m_matU.applyOnTheRight(il, il+1, rot);
449 if(computeU)
m_matU.applyOnTheRight(
i,
i+1, rot);
453 if(totalIter <= maxIters)
const AbsReturnType abs() const
RealReturnType real() const
Matrix< float, 1, Dynamic > MatrixType
Performs a complex Schur decomposition of a real or complex square matrix.
ComputationInfo info() const
Reports whether previous computation was successful.
const ComplexMatrixType & matrixU() const
Returns the unitary matrix in the Schur decomposition.
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType_.
const ComplexMatrixType & matrixT() const
Returns the triangular matrix in the Schur decomposition.
HessenbergDecomposition< MatrixType > m_hess
NumTraits< Scalar >::Real RealScalar
ComplexSchur(Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
Default constructor.
void reduceToTriangularForm(bool computeU)
Index getMaxIterations()
Returns the maximum number of iterations.
static const int m_maxIterationsPerRow
Maximum number of iterations per row.
std::complex< RealScalar > ComplexScalar
Complex scalar type for MatrixType_.
ComplexSchur & computeFromHessenberg(const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU=true)
Compute Schur decomposition from a given Hessenberg matrix.
ComplexSchur & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
ComplexSchur(const EigenBase< InputType > &matrix, bool computeU=true)
Constructor; computes Schur decomposition of given matrix.
bool subdiagonalEntryIsNeglegible(Index i)
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > ComplexMatrixType
Type for the matrices in the Schur decomposition.
ComplexScalar computeShift(Index iu, Index iter)
ComplexSchur & compute(const EigenBase< InputType > &matrix, bool computeU=true)
Computes Schur decomposition of given matrix.
internal::traits< Derived >::Scalar Scalar
HessenbergDecomposition & compute(const EigenBase< InputType > &matrix)
Computes Hessenberg decomposition of given matrix.
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
Rotation given by a cosine-sine pair.
JacobiRotation adjoint() const
void makeGivens(const Scalar &p, const Scalar &q, Scalar *r=0)
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
constexpr const Scalar & coeff(Index rowId, Index colId) const
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
constexpr Scalar & coeffRef(Index rowId, Index colId)
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
bool is_exactly_zero(const X &x)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs_op< typename Derived::Scalar >, const Derived > abs(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sqrt_op< typename Derived::Scalar >, const Derived > sqrt(const Eigen::ArrayBase< Derived > &x)
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.