Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Protected Attributes | Friends
Eigen::SPQR< _MatrixType > Class Template Reference

Sparse QR factorization based on SuiteSparseQR library. More...

#include <SuiteSparseQRSupport.h>

+ Collaboration diagram for Eigen::SPQR< _MatrixType >:

Public Types

typedef _MatrixType::Scalar Scalar
 
typedef _MatrixType::RealScalar RealScalar
 
typedef UF_long Index
 
typedef SparseMatrix< Scalar, ColMajor, Index > MatrixType
 
typedef PermutationMatrix< Dynamic, Dynamic > PermutationType
 

Public Member Functions

 SPQR (const _MatrixType &matrix)
 
void compute (const _MatrixType &matrix)
 
Index rows () const
 
Index cols () const
 
template<typename Rhs >
const internal::solve_retval< SPQR, Rhs > solve (const MatrixBase< Rhs > &B) const
 
template<typename Rhs , typename Dest >
void _solve (const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
 
const MatrixType matrixR () const
 
SPQRMatrixQReturnType< SPQRmatrixQ () const
 Get an expression of the matrix Q.
 
PermutationType colsPermutation () const
 Get the permutation that was applied to columns of A.
 
Index rank () const
 
void setSPQROrdering (int ord)
 Set the fill-reducing ordering method to be used.
 
void setPivotThreshold (const RealScalar &tol)
 Set the tolerance tol to treat columns with 2-norm < =tol as zero.
 
cholmod_common * cholmodCommon () const
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 

Protected Attributes

bool m_isInitialized
 
bool m_analysisIsOk
 
bool m_factorizationIsOk
 
bool m_isRUpToDate
 
ComputationInfo m_info
 
int m_ordering
 
int m_allow_tol
 
RealScalar m_tolerance
 
cholmod_sparse * m_cR
 
MatrixType m_R
 
Index * m_E
 
cholmod_sparse * m_H
 
Index * m_HPinv
 
cholmod_dense * m_HTau
 
Index m_rank
 
cholmod_common m_cc
 

Friends

template<typename , typename >
struct SPQR_QProduct
 

Detailed Description

template<typename _MatrixType>
class Eigen::SPQR< _MatrixType >

Sparse QR factorization based on SuiteSparseQR library.

This class is used to perform a multithreaded and multifrontal rank-revealing QR decomposition of sparse matrices. The result is then used to solve linear leasts_square systems. Clearly, a QR factorization is returned such that A*P = Q*R where :

P is the column permutation. Use colsPermutation() to get it.

Q is the orthogonal matrix represented as Householder reflectors. Use matrixQ() to get an expression and matrixQ().transpose() to get the transpose. You can then apply it to a vector.

R is the sparse triangular factor. Use matrixQR() to get it as SparseMatrix. NOTE : The Index type of R is always UF_long. You can get it with SPQR::Index

Template Parameters
_MatrixTypeThe type of the sparse matrix A, must be a column-major SparseMatrix<> NOTE

Definition at line 15 of file SuiteSparseQRSupport.h.

Member Function Documentation

template<typename _MatrixType >
cholmod_common* Eigen::SPQR< _MatrixType >::cholmodCommon ( ) const
inline
Returns
a pointer to the SPQR workspace

Definition at line 195 of file SuiteSparseQRSupport.h.

195 { return &m_cc; }
template<typename _MatrixType >
Index Eigen::SPQR< _MatrixType >::cols ( void  ) const
inline

Get the number of columns of the input matrix.

Definition at line 120 of file SuiteSparseQRSupport.h.

120 { return m_cR->ncol; }
template<typename _MatrixType >
ComputationInfo Eigen::SPQR< _MatrixType >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was succesful, NumericalIssue if the sparse QR can not be computed

Definition at line 203 of file SuiteSparseQRSupport.h.

204  {
205  eigen_assert(m_isInitialized && "Decomposition is not initialized.");
206  return m_info;
207  }
template<typename _MatrixType >
const MatrixType Eigen::SPQR< _MatrixType >::matrixR ( void  ) const
inline
Returns
the sparse triangular factor R. It is a sparse matrix

Definition at line 156 of file SuiteSparseQRSupport.h.

157  {
158  eigen_assert(m_isInitialized && " The QR factorization should be computed first, call compute()");
159  if(!m_isRUpToDate) {
160  m_R = viewAsEigen<Scalar,ColMajor, typename MatrixType::Index>(*m_cR);
161  m_isRUpToDate = true;
162  }
163  return m_R;
164  }
template<typename _MatrixType >
Index Eigen::SPQR< _MatrixType >::rank ( ) const
inline

Gets the rank of the matrix. It should be equal to matrixQR().cols if the matrix is full-rank

Definition at line 184 of file SuiteSparseQRSupport.h.

185  {
186  eigen_assert(m_isInitialized && "Decomposition is not initialized.");
187  return m_cc.SPQR_istat[4];
188  }
template<typename _MatrixType >
Index Eigen::SPQR< _MatrixType >::rows ( void  ) const
inline

Get the number of rows of the input matrix and the Q matrix

Definition at line 115 of file SuiteSparseQRSupport.h.

115 {return m_H->nrow; }
template<typename _MatrixType >
template<typename Rhs >
const internal::solve_retval<SPQR, Rhs> Eigen::SPQR< _MatrixType >::solve ( const MatrixBase< Rhs > &  B) const
inline
Returns
the solution X of $ A X = B $ using the current decomposition of A.
See also
compute()

Definition at line 127 of file SuiteSparseQRSupport.h.

128  {
129  eigen_assert(m_isInitialized && " The QR factorization should be computed first, call compute()");
130  eigen_assert(this->rows()==B.rows()
131  && "SPQR::solve(): invalid number of rows of the right hand side matrix B");
132  return internal::solve_retval<SPQR, Rhs>(*this, B.derived());
133  }
Index rows() const

The documentation for this class was generated from the following file: