mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 04:35:57 +08:00
Update SPQR interface
This commit is contained in:
parent
895d90d3e1
commit
5afaacedc6
@ -141,8 +141,8 @@ template<typename Scalar, int Flags, typename Index>
|
|||||||
MappedSparseMatrix<Scalar,Flags,Index> viewAsEigen(cholmod_sparse& cm)
|
MappedSparseMatrix<Scalar,Flags,Index> viewAsEigen(cholmod_sparse& cm)
|
||||||
{
|
{
|
||||||
return MappedSparseMatrix<Scalar,Flags,Index>
|
return MappedSparseMatrix<Scalar,Flags,Index>
|
||||||
(cm.nrow, cm.ncol, reinterpret_cast<Index*>(cm.p)[cm.ncol],
|
(cm.nrow, cm.ncol, static_cast<Index*>(cm.p)[cm.ncol],
|
||||||
reinterpret_cast<Index*>(cm.p), reinterpret_cast<Index*>(cm.i),reinterpret_cast<Scalar*>(cm.x) );
|
static_cast<Index*>(cm.p), static_cast<Index*>(cm.i),static_cast<Scalar*>(cm.x) );
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CholmodMode {
|
enum CholmodMode {
|
||||||
|
@ -82,7 +82,7 @@ class AMDOrdering
|
|||||||
template <typename SrcType, unsigned int SrcUpLo>
|
template <typename SrcType, unsigned int SrcUpLo>
|
||||||
void operator()(const SparseSelfAdjointView<SrcType, SrcUpLo>& mat, PermutationType& perm)
|
void operator()(const SparseSelfAdjointView<SrcType, SrcUpLo>& mat, PermutationType& perm)
|
||||||
{
|
{
|
||||||
SparseMatrix<typename SrcType::Scalar, ColMajor, Index> C = mat;
|
SparseMatrix<typename SrcType::Scalar, ColMajor, Index> C; C = mat;
|
||||||
|
|
||||||
// Call the AMD routine
|
// Call the AMD routine
|
||||||
// m_mat.prune(keep_diag()); //Remove the diagonal elements
|
// m_mat.prune(keep_diag()); //Remove the diagonal elements
|
||||||
@ -104,7 +104,7 @@ class NaturalOrdering
|
|||||||
|
|
||||||
/** Compute the permutation vector from a column-major sparse matrix */
|
/** Compute the permutation vector from a column-major sparse matrix */
|
||||||
template <typename MatrixType>
|
template <typename MatrixType>
|
||||||
void operator()(const MatrixType& mat, PermutationType& perm)
|
void operator()(const MatrixType& /*mat*/, PermutationType& perm)
|
||||||
{
|
{
|
||||||
perm.resize(0);
|
perm.resize(0);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ namespace Eigen {
|
|||||||
* R is the sparse triangular factor. Use matrixQR() to get it as SparseMatrix.
|
* 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
|
* NOTE : The Index type of R is always UF_long. You can get it with SPQR::Index
|
||||||
*
|
*
|
||||||
* \tparam _MatrixType The type of the sparse matrix A, must be a SparseMatrix<>, either row-major or column-major.
|
* \tparam _MatrixType The type of the sparse matrix A, must be a column-major SparseMatrix<>
|
||||||
* NOTE
|
* NOTE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -61,7 +61,7 @@ class SPQR
|
|||||||
typedef typename _MatrixType::RealScalar RealScalar;
|
typedef typename _MatrixType::RealScalar RealScalar;
|
||||||
typedef UF_long Index ;
|
typedef UF_long Index ;
|
||||||
typedef SparseMatrix<Scalar, _MatrixType::Flags, Index> MatrixType;
|
typedef SparseMatrix<Scalar, _MatrixType::Flags, Index> MatrixType;
|
||||||
typedef PermutationMatrix<Dynamic, Dynamic, Index> PermutationType;
|
typedef PermutationMatrix<Dynamic, Dynamic> PermutationType;
|
||||||
public:
|
public:
|
||||||
SPQR()
|
SPQR()
|
||||||
: m_ordering(SPQR_ORDERING_DEFAULT),
|
: m_ordering(SPQR_ORDERING_DEFAULT),
|
||||||
@ -153,7 +153,7 @@ class SPQR
|
|||||||
MatrixType matrixQR() const
|
MatrixType matrixQR() const
|
||||||
{
|
{
|
||||||
MatrixType R;
|
MatrixType R;
|
||||||
R = viewAsEigen<Scalar, MatrixType::Flags, Index>(*m_cR);
|
R = viewAsEigen<Scalar, MatrixType::Flags, typename MatrixType::Index>(*m_cR);
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
/// Get an expression of the matrix Q
|
/// Get an expression of the matrix Q
|
||||||
|
Loading…
x
Reference in New Issue
Block a user