Spectra::TridiagQR< Scalar > Class Template Reference

Description

template<typename Scalar = double>
class Spectra::TridiagQR< Scalar >

Perform the QR decomposition of a tridiagonal matrix, a special case of upper Hessenberg matrices.

Template Parameters
ScalarThe element type of the matrix. Currently supported types are float, double and long double.

#include <UpperHessenbergQR.h>

Inheritance diagram for Spectra::TridiagQR< Scalar >:
Collaboration diagram for Spectra::TridiagQR< Scalar >:

Public Member Functions

 TridiagQR (Index size)
 Constructor to preallocate memory. More...
 
 TridiagQR (ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
 Constructor to create an object that performs and stores the QR decomposition of a tridiagonal matrix mat, with an optional shift: \(T-sI=QR\). More...
 
void compute (ConstGenericMatrix &mat, const Scalar &shift=Scalar(0)) override
 Compute the QR decomposition of a tridiagonal matrix with an optional shift. More...
 
Matrix matrix_R () const override
 Return the \(R\) matrix in the QR decomposition, which is an upper triangular matrix. More...
 
void matrix_QtHQ (Matrix &dest) const override
 Overwrite dest with \(Q'TQ = RQ + sI\), where \(T\) is the input matrix mat, and \(s\) is the shift. More...
 
void matrix_QtHQ (ComplexMatrix &dest) const
 The version of matrix_QtHQ() when dest has a complex value type. More...
 
- Public Member Functions inherited from Spectra::UpperHessenbergQR< double >
 UpperHessenbergQR (Index size)
 Constructor to preallocate memory. More...
 
 UpperHessenbergQR (ConstGenericMatrix &mat, const double &shift=double(0))
 Constructor to create an object that performs and stores the QR decomposition of an upper Hessenberg matrix mat, with an optional shift: \(H-sI=QR\). More...
 
virtual ~UpperHessenbergQR ()
 Virtual destructor.
 
virtual void compute (ConstGenericMatrix &mat, const double &shift=double(0))
 Compute the QR decomposition of an upper Hessenberg matrix with an optional shift. More...
 
virtual Matrix matrix_R () const
 Return the \(R\) matrix in the QR decomposition, which is an upper triangular matrix. More...
 
virtual void matrix_QtHQ (Matrix &dest) const
 Overwrite dest with \(Q^H H Q = RQ + sI\), where \(H\) is the input matrix mat, and \(s\) is the shift. More...
 
void apply_QY (Vector &Y) const
 Apply the \(Q\) matrix to a vector \(y\). More...
 
void apply_QY (GenericMatrix Y) const
 Apply the \(Q\) matrix to another matrix \(Y\). More...
 
void apply_QtY (Vector &Y) const
 Apply the \(Q\) matrix to a vector \(y\). More...
 
void apply_QtY (GenericMatrix Y) const
 Apply the \(Q\) matrix to another matrix \(Y\). More...
 
void apply_YQ (GenericMatrix Y) const
 Apply the \(Q\) matrix to another matrix \(Y\). More...
 
void apply_YQt (GenericMatrix Y) const
 Apply the \(Q\) matrix to another matrix \(Y\). More...
 

Additional Inherited Members

- Protected Attributes inherited from Spectra::UpperHessenbergQR< double >
Index m_n
 
double m_shift
 
RealArray m_rot_cos
 
Array m_rot_sin
 
bool m_computed
 

Constructor & Destructor Documentation

◆ TridiagQR() [1/2]

template<typename Scalar = double>
Spectra::TridiagQR< Scalar >::TridiagQR ( Index  size)
inline

Constructor to preallocate memory.

Computation can be performed later by calling the compute() method.

◆ TridiagQR() [2/2]

template<typename Scalar = double>
Spectra::TridiagQR< Scalar >::TridiagQR ( ConstGenericMatrix &  mat,
const Scalar &  shift = Scalar(0) 
)
inline

Constructor to create an object that performs and stores the QR decomposition of a tridiagonal matrix mat, with an optional shift: \(T-sI=QR\).

Here \(T\) stands for the matrix mat, and \(s\) is the shift.

Parameters
matMatrix type can be Eigen::Matrix<Scalar, ...> (e.g. Eigen::MatrixXd and Eigen::MatrixXf), or its mapped version (e.g. Eigen::Map<Eigen::MatrixXd>). Only the diagonal and subdiagonal elements of the matrix are used.

Member Function Documentation

◆ compute()

template<typename Scalar = double>
void Spectra::TridiagQR< Scalar >::compute ( ConstGenericMatrix &  mat,
const Scalar &  shift = Scalar(0) 
)
inlineoverride

Compute the QR decomposition of a tridiagonal matrix with an optional shift.

Parameters
matMatrix type can be Eigen::Matrix<Scalar, ...> (e.g. Eigen::MatrixXd and Eigen::MatrixXf), or its mapped version (e.g. Eigen::Map<Eigen::MatrixXd>). Only the diagonal and subdiagonal elements of the matrix are used.

◆ matrix_QtHQ() [1/2]

template<typename Scalar = double>
void Spectra::TridiagQR< Scalar >::matrix_QtHQ ( ComplexMatrix &  dest) const
inline

The version of matrix_QtHQ() when dest has a complex value type.

This is used in Hermitian eigen solvers where the result is stored as a complex matrix.

◆ matrix_QtHQ() [2/2]

template<typename Scalar = double>
void Spectra::TridiagQR< Scalar >::matrix_QtHQ ( Matrix &  dest) const
inlineoverride

Overwrite dest with \(Q'TQ = RQ + sI\), where \(T\) is the input matrix mat, and \(s\) is the shift.

The result is a tridiagonal matrix.

Parameters
matThe matrix to be overwritten, whose type should be Eigen::Matrix<Scalar, ...>, depending on the template parameter Scalar defined.

◆ matrix_R()

template<typename Scalar = double>
Matrix Spectra::TridiagQR< Scalar >::matrix_R ( ) const
inlineoverride

Return the \(R\) matrix in the QR decomposition, which is an upper triangular matrix.

Returns
Returned matrix type will be Eigen::Matrix<Scalar, ...>, depending on the template parameter Scalar defined.

The documentation for this class was generated from the following file:
  • /builds/uwsbel/chrono/src/chrono_thirdparty/spectra/Spectra/LinAlg/UpperHessenbergQR.h