mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 20:56:00 +08:00
Fix SPQR for rectangular matrices
(grafted from f939c351cbfcb1007943fe6062503bc455b692e1 )
This commit is contained in:
parent
91207cbae3
commit
03fd417f66
@ -110,16 +110,16 @@ class SPQR
|
||||
max2Norm = RealScalar(1);
|
||||
pivotThreshold = 20 * (mat.rows() + mat.cols()) * max2Norm * NumTraits<RealScalar>::epsilon();
|
||||
}
|
||||
|
||||
cholmod_sparse A;
|
||||
A = viewAsCholmod(mat);
|
||||
m_rows = matrix.rows();
|
||||
Index col = matrix.cols();
|
||||
m_rank = SuiteSparseQR<Scalar>(m_ordering, pivotThreshold, col, &A,
|
||||
&m_cR, &m_E, &m_H, &m_HPinv, &m_HTau, &m_cc);
|
||||
|
||||
if (!m_cR)
|
||||
{
|
||||
m_info = NumericalIssue;
|
||||
m_info = NumericalIssue;
|
||||
m_isInitialized = false;
|
||||
return;
|
||||
}
|
||||
@ -130,7 +130,7 @@ class SPQR
|
||||
/**
|
||||
* Get the number of rows of the input matrix and the Q matrix
|
||||
*/
|
||||
inline Index rows() const {return m_cR->nrow; }
|
||||
inline Index rows() const {return m_rows; }
|
||||
|
||||
/**
|
||||
* Get the number of columns of the input matrix.
|
||||
@ -254,6 +254,7 @@ class SPQR
|
||||
mutable Index m_rank; // The rank of the matrix
|
||||
mutable cholmod_common m_cc; // Workspace and parameters
|
||||
bool m_useDefaultThreshold; // Use default threshold
|
||||
Index m_rows;
|
||||
template<typename ,typename > friend struct SPQR_QProduct;
|
||||
};
|
||||
|
||||
|
@ -18,8 +18,8 @@ int generate_sparse_rectangular_problem(MatrixType& A, DenseMat& dA, int maxRows
|
||||
int cols = internal::random<int>(1,rows);
|
||||
double density = (std::max)(8./(rows*cols), 0.01);
|
||||
|
||||
A.resize(rows,rows);
|
||||
dA.resize(rows,rows);
|
||||
A.resize(rows,cols);
|
||||
dA.resize(rows,cols);
|
||||
initSparse<Scalar>(density, dA, A,ForceNonZeroDiag);
|
||||
A.makeCompressed();
|
||||
return rows;
|
||||
|
Loading…
x
Reference in New Issue
Block a user