Go to the documentation of this file.
11 #ifndef EIGEN_TRIDIAGONALIZATION_H
12 #define EIGEN_TRIDIAGONALIZATION_H
19 template<
typename MatrixType>
21 :
public traits<typename MatrixType::PlainObject>
27 template<
typename MatrixType,
typename CoeffVectorType>
75 Size = MatrixType::RowsAtCompileTime,
78 MaxSize = MatrixType::MaxRowsAtCompileTime,
129 template<
typename InputType>
156 template<
typename InputType>
305 template<
typename MatrixType>
309 eigen_assert(m_isInitialized &&
"Tridiagonalization is not initialized.");
310 return m_matrix.diagonal().real();
313 template<
typename MatrixType>
317 eigen_assert(m_isInitialized &&
"Tridiagonalization is not initialized.");
318 return m_matrix.template diagonal<-1>().
real();
346 template<
typename MatrixType,
typename CoeffVectorType>
356 for (
Index i = 0; i<
n-1; ++i)
358 Index remainingSize =
n-i-1;
361 matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
365 matA.col(i).coeffRef(i+1) = 1;
367 hCoeffs.tail(
n-i-1).noalias() = (matA.bottomRightCorner(remainingSize,remainingSize).template selfadjointView<Lower>()
368 * (
conj(h) * matA.col(i).tail(remainingSize)));
370 hCoeffs.tail(
n-i-1) += (
conj(h)*
RealScalar(-0.5)*(hCoeffs.tail(remainingSize).dot(matA.col(i).tail(remainingSize)))) * matA.col(i).tail(
n-i-1);
372 matA.bottomRightCorner(remainingSize, remainingSize).template selfadjointView<Lower>()
373 .rankUpdate(matA.col(i).tail(remainingSize), hCoeffs.tail(remainingSize),
Scalar(-1));
375 matA.col(i).coeffRef(i+1) = beta;
376 hCoeffs.coeffRef(i) = h;
382 int Size=MatrixType::ColsAtCompileTime,
426 template<
typename MatrixType,
typename DiagonalType,
typename SubDiagonalType>
436 template<
typename MatrixType,
int Size,
bool IsComplex>
437 struct tridiagonalization_inplace_selector
441 template<
typename DiagonalType,
typename SubDiagonalType>
442 static void run(
MatrixType&
mat, DiagonalType& diag, SubDiagonalType& subdiag,
bool extractQ)
446 diag =
mat.diagonal().real();
447 subdiag =
mat.template diagonal<-1>().
real();
459 template<
typename MatrixType>
465 template<
typename DiagonalType,
typename SubDiagonalType>
466 static void run(
MatrixType&
mat, DiagonalType& diag, SubDiagonalType& subdiag,
bool extractQ)
476 subdiag[0] =
mat(1,0);
477 subdiag[1] =
mat(2,1);
488 diag[1] =
mat(1,1) + m02*
q;
489 diag[2] =
mat(2,2) - m02*
q;
491 subdiag[1] =
mat(2,1) - m01 *
q;
505 template<
typename MatrixType,
bool IsComplex>
510 template<
typename DiagonalType,
typename SubDiagonalType>
526 template<
typename MatrixType>
struct TridiagonalizationMatrixTReturnType
527 :
public ReturnByValue<TridiagonalizationMatrixTReturnType<MatrixType> >
536 template <
typename ResultType>
537 inline void evalTo(ResultType& result)
const
541 result.diagonal() =
m_matrix.diagonal();
542 result.template diagonal<-1>() =
m_matrix.template diagonal<-1>();
556 #endif // EIGEN_TRIDIAGONALIZATION_H
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
MatrixType::Scalar Scalar
const EIGEN_DEVICE_FUNC SqrtReturnType sqrt() const
const MatrixType & packedMatrix() const
Returns the internal representation of the decomposition.
internal::conditional< NumTraits< Scalar >::IsComplex, typename internal::add_const_on_value_type< typename Diagonal< const MatrixType >::RealReturnType >::type, const Diagonal< const MatrixType > >::type DiagonalReturnType
Map< Matrix< Scalar, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > MatrixType
Tridiagonalization< MatrixType >::CoeffVectorType CoeffVectorType
Tridiagonal decomposition of a selfadjoint matrix.
HouseholderSequence & setShift(Index shift)
Sets the shift of the Householder sequence.
SubDiagonalReturnType subDiagonal() const
Returns the subdiagonal of the tridiagonal matrix T in the decomposition.
NumTraits< Scalar >::Real RealScalar
void tridiagonalization_inplace(MatrixType &matA, CoeffVectorType &hCoeffs)
internal::conditional< NumTraits< Scalar >::IsComplex, const CwiseUnaryOp< internal::scalar_real_op< Scalar >, const Derived >, const Derived & >::type RealReturnType
TridiagonalizationMatrixTReturnType(const MatrixType &mat)
Constructor.
Matrix< Scalar, SizeMinusOne, 1, Options &~RowMajor, MaxSizeMinusOne, 1 > CoeffVectorType
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Abs2ReturnType abs2() const
HouseholderSequence< MatrixType, typename internal::remove_all< typename CoeffVectorType::ConjugateReturnType >::type > HouseholderSequenceType
Return type of matrixQ()
_MatrixType MatrixType
Synonym for the template parameter _MatrixType.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
HouseholderSequenceType matrixQ() const
Returns the unitary matrix Q in the decomposition.
Tridiagonalization< MatrixType >::HouseholderSequenceType HouseholderSequenceType
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
MatrixTReturnType matrixT() const
Returns an expression of the tridiagonal matrix T in the decomposition.
Tridiagonalization & compute(const EigenBase< InputType > &matrix)
Computes tridiagonal decomposition of given matrix.
internal::TridiagonalizationMatrixTReturnType< MatrixTypeRealView > MatrixTReturnType
internal::plain_col_type< MatrixType, RealScalar >::type DiagonalType
MatrixType::RealScalar RealScalar
CoeffVectorType m_hCoeffs
MatrixType::Scalar Scalar
EIGEN_DEVICE_FUNC const Scalar & q
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
HouseholderSequence & setLength(Index length)
Sets the length of the Householder sequence.
void evalTo(ResultType &result) const
static void run(MatrixType &mat, DiagonalType &diag, SubDiagonalType &, bool extractQ)
MatrixType::Scalar Scalar
Tridiagonalization(const EigenBase< InputType > &matrix)
Constructor; computes tridiagonal decomposition of given matrix.
MatrixType::PlainObject ReturnType
EIGEN_DEVICE_FUNC ConjugateReturnType conjugate() const
const AutoDiffScalar< DerType > & real(const AutoDiffScalar< DerType > &x)
DiagonalReturnType diagonal() const
Returns the diagonal of the tridiagonal matrix T in the decomposition.
Tridiagonalization(Index size=Size==Dynamic ? 2 :Size)
Default constructor.
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
internal::conditional< NumTraits< Scalar >::IsComplex, typename internal::add_const_on_value_type< typename Diagonal< const MatrixType, -1 >::RealReturnType >::type, const Diagonal< const MatrixType, -1 > >::type SubDiagonalReturnType
NumTraits< Scalar >::Real RealScalar
internal::remove_all< typename MatrixType::RealReturnType >::type MatrixTypeRealView
Matrix< RealScalar, SizeMinusOne, 1, Options &~RowMajor, MaxSizeMinusOne, 1 > SubDiagonalType
CoeffVectorType householderCoefficients() const
Returns the Householder coefficients.
MatrixType::Nested m_matrix
static void run(MatrixType &mat, DiagonalType &diag, SubDiagonalType &subdiag, bool extractQ)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
static void run(MatrixType &mat, DiagonalType &diag, SubDiagonalType &subdiag, bool extractQ)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Sequence of Householder reflections acting on subspaces with decreasing size.
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:07:13