11 #ifndef EIGEN_EIGENSOLVER_H 12 #define EIGEN_EIGENSOLVER_H 80 typedef typename MatrixType::Scalar
Scalar;
146 template<
typename InputType>
148 :
m_eivec(matrix.rows(), matrix.cols()),
153 m_matT(matrix.rows(), matrix.cols()),
277 template<
typename InputType>
323 template<
typename MatrixType>
330 for (
Index i=0; i<n; ++i)
344 template<
typename MatrixType>
352 for (
Index j=0; j<n; ++j)
357 matV.col(j) =
m_eivec.col(j).template cast<ComplexScalar>();
358 matV.col(j).normalize();
363 for (
Index i=0; i<n; ++i)
368 matV.col(j).normalize();
369 matV.col(j+1).normalize();
376 template<
typename MatrixType>
377 template<
typename InputType>
396 if (computeEigenvectors)
402 while (i < matrix.
cols())
429 z = maxval *
sqrt(
abs(p0 * p0 + t0 * t1));
446 if (computeEigenvectors)
457 template<
typename MatrixType>
477 for (
Index n = size-1; n >= 0; n--)
485 Scalar lastr(0), lastw(0);
489 for (
Index i = n-1; i >= 0; i--)
505 m_matT.coeffRef(i,n) = -r / w;
507 m_matT.coeffRef(i,n) = -r / (eps * norm);
514 Scalar t = (x * lastr - lastw * r) / denom;
517 m_matT.coeffRef(i+1,n) = (-r - w * t) / x;
519 m_matT.coeffRef(i+1,n) = (-lastr - y * t) / lastw;
524 if ((eps * t) * t >
Scalar(1))
525 m_matT.col(n).tail(size-i) /= t;
529 else if (q <
Scalar(0) && n > 0)
531 Scalar lastra(0), lastsa(0), lastw(0);
548 for (
Index i = n-2; i >= 0; i--)
584 m_matT.coeffRef(i+1,n-1) = (-ra - w *
m_matT.coeff(i,n-1) + q *
m_matT.coeff(i,n)) / x;
597 if ((eps * t) * t >
Scalar(1))
598 m_matT.block(i, n-1, size-i, 2) /= t;
608 eigen_assert(0 &&
"Internal bug in EigenSolver (INF or NaN has not been detected)");
613 for (
Index j = size-1; j >= 0; j--)
622 #endif // EIGEN_EIGENSOLVER_H
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isfinite(const half &a)
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > EigenvectorsType
Type for matrix of eigenvectors as returned by eigenvectors().
EigenSolver & compute(const EigenBase< InputType > &matrix, bool computeEigenvectors=true)
Computes eigendecomposition of given matrix.
EIGEN_DEVICE_FUNC RealReturnType real() const
EigenvectorsType eigenvectors() const
Returns the eigenvectors of given matrix.
EigenSolver(Index size)
Default constructor with memory preallocation.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const
const MatrixType & matrixU() const
Returns the orthogonal matrix in the Schur decomposition.
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Index getMaxIterations()
Returns the maximum number of iterations.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
ComputationInfo info() const
Reports whether previous computation was successful.
ComputationInfo info() const
const MatrixType & matrixT() const
Returns the quasi-triangular matrix in the Schur decomposition.
RealSchur< MatrixType > m_realSchur
Index getMaxIterations()
Returns the maximum number of iterations.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
EigenSolver(const EigenBase< InputType > &matrix, bool computeEigenvectors=true)
Constructor; computes eigendecomposition of given matrix.
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() max(const half &a, const half &b)
Matrix< Scalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > ColumnVectorType
MatrixType pseudoEigenvalueMatrix() const
Returns the block-diagonal matrix in the pseudo-eigendecomposition.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
NumTraits< Scalar >::Real RealScalar
const MatrixType & pseudoEigenvectors() const
Returns the pseudo-eigenvectors of given matrix.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
mpreal maxval(mp_prec_t prec=mpreal::get_default_prec())
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
EIGEN_DEVICE_FUNC const Scalar & q
RealSchur & compute(const EigenBase< InputType > &matrix, bool computeU=true)
Computes Schur decomposition of given matrix.
EigenSolver & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
std::complex< RealScalar > ComplexScalar
Complex scalar type for MatrixType.
EIGEN_DEVICE_FUNC Index cols() const
_MatrixType MatrixType
Synonym for the template parameter _MatrixType.
TFSIMD_FORCE_INLINE const tfScalar & z() const
EigenSolver()
Default constructor.
TFSIMD_FORCE_INLINE const tfScalar & w() const
RealSchur & setMaxIterations(Index maxIters)
Sets the maximum number of iterations allowed.
EIGEN_DEVICE_FUNC Index rows() const
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
void doComputeEigenvectors()
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
Computes eigenvalues and eigenvectors of general matrices.
EigenvalueType m_eivalues
EIGEN_DEVICE_FUNC Derived & derived()
const EigenvalueType & eigenvalues() const
Returns the eigenvalues of given matrix.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > EigenvalueType
Type for vector of eigenvalues as returned by eigenvalues().
static void check_template_parameters()