11 #ifndef EIGEN_SUITESPARSEQRSUPPORT_H
12 #define EIGEN_SUITESPARSEQRSUPPORT_H
18 template<
typename MatrixType>
class SPQR;
19 template<
typename SPQRType>
struct SPQRMatrixQReturnType;
20 template<
typename SPQRType>
struct SPQRMatrixQTransposeReturnType;
21 template <
typename SPQRType,
typename Derived>
struct SPQR_QProduct;
23 template <
typename SPQRType>
struct traits<SPQRMatrixQReturnType<SPQRType> >
27 template <
typename SPQRType>
struct traits<SPQRMatrixQTransposeReturnType<SPQRType> >
31 template <
typename SPQRType,
typename Derived>
struct traits<SPQR_QProduct<SPQRType, Derived> >
33 typedef typename Derived::PlainObject ReturnType;
61 template<
typename MatrixType_>
68 typedef typename MatrixType_::Scalar
Scalar;
92 cholmod_l_start(&
m_cc);
95 explicit SPQR(
const MatrixType_& matrix)
109 cholmod_l_start(&
m_cc);
116 cholmod_l_finish(&
m_cc);
120 cholmod_l_free_sparse(&
m_H, &
m_cc);
121 cholmod_l_free_sparse(&
m_cR, &
m_cc);
173 template<
typename Rhs,
typename Dest>
177 eigen_assert(
b.cols()==1 &&
"This method is for vectors only");
180 typename Dest::PlainObject
y, y2;
187 y.topRows(rk) = this->
matrixR().topLeftCorner(rk, rk).template triangularView<Upper>().solve(y2.topRows(rk));
207 m_R = viewAsEigen<Scalar,ColMajor, typename MatrixType::StorageIndex>(*
m_cR);
230 return m_cc.SPQR_istat[4];
263 mutable cholmod_sparse *
m_cR =
nullptr;
266 mutable cholmod_sparse *
m_H =
nullptr;
276 template <
typename SPQRType,
typename Derived>
279 typedef typename SPQRType::Scalar
Scalar;
287 template<
typename ResType>
293 cholmod_common *cc =
m_spqr.cholmodCommon();
295 x_cd = SuiteSparseQR_qmult<Scalar>(method,
m_spqr.m_H,
m_spqr.m_HTau,
m_spqr.m_HPinv, &y_cd, cc);
297 cholmod_l_free_dense(&x_cd, cc);
304 template<
typename SPQRType>
308 template<
typename Derived>
325 template<
typename SPQRType>
328 template<
typename Derived>
ColXpr col(Index i)
This is the const version of col().
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Matrix< float, 1, Dynamic > MatrixType
A matrix or vector expression mapping an existing array of data.
Base class for all dense matrices, vectors, and expressions.
static ConstMapType Map(const Scalar *data)
Sparse QR factorization based on SuiteSparseQR library.
void compute(const MatrixType_ &matrix)
void setPivotThreshold(const RealScalar &tol)
Set the tolerance tol to treat columns with 2-norm < =tol as zero.
void _solve_impl(const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
SparseMatrix< Scalar, ColMajor, StorageIndex > MatrixType
SuiteSparse_long StorageIndex
SPQR(const MatrixType_ &matrix)
cholmod_common * cholmodCommon() const
ComputationInfo info() const
Reports whether previous computation was successful.
MatrixType_::RealScalar RealScalar
const MatrixType matrixR() const
MatrixType_::Scalar Scalar
bool m_useDefaultThreshold
Map< PermutationMatrix< Dynamic, Dynamic, StorageIndex > > PermutationType
SparseSolverBase< SPQR< MatrixType_ > > Base
SPQRMatrixQReturnType< SPQR > matrixQ() const
Get an expression of the matrix Q.
PermutationType colsPermutation() const
Get the permutation that was applied to columns of A.
void setSPQROrdering(int ord)
Set the fill-reducing ordering method to be used.
A base class for sparse solvers.
bfloat16() max(const bfloat16 &a, const bfloat16 &b)
EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
bool is_exactly_zero(const X &x)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
cholmod_sparse viewAsCholmod(Ref< SparseMatrix< Scalar_, Options_, StorageIndex_ > > mat)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
SPQRMatrixQTransposeReturnType< SPQRType > adjoint() const
SPQRMatrixQReturnType(const SPQRType &spqr)
SPQRMatrixQTransposeReturnType< SPQRType > transpose() const
SPQR_QProduct< SPQRType, Derived > operator*(const MatrixBase< Derived > &other)
SPQRMatrixQTransposeReturnType(const SPQRType &spqr)
SPQR_QProduct< SPQRType, Derived > operator*(const MatrixBase< Derived > &other)
SPQR_QProduct(const SPQRType &spqr, const Derived &other, bool transpose)
void evalTo(ResType &res) const
SPQRType::StorageIndex StorageIndex