mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
new simplified API to fill sparse matrices (the old functions are
deprecated). Basically there are now only 2 functions to set a coefficient: 1) mat.coeffRef(row,col) = value; 2) mat.insert(row,col) = value; coeffRef has no limitation, insert assumes the coeff has not already been set, and raises an assert otherwise. In addition I added a much lower level, but more efficient filling mechanism for internal use only.
This commit is contained in:
@@ -37,12 +37,12 @@ initSPD(double density,
|
||||
initSparse(density,aux,sparseMat,ForceNonZeroDiag);
|
||||
refMat += aux * aux.adjoint();
|
||||
}
|
||||
sparseMat.startFill();
|
||||
sparseMat.setZero();
|
||||
for (int j=0 ; j<sparseMat.cols(); ++j)
|
||||
for (int i=j ; i<sparseMat.rows(); ++i)
|
||||
if (refMat(i,j)!=Scalar(0))
|
||||
sparseMat.fill(i,j) = refMat(i,j);
|
||||
sparseMat.endFill();
|
||||
sparseMat.insert(i,j) = refMat(i,j);
|
||||
sparseMat.finalize();
|
||||
}
|
||||
|
||||
template<typename Scalar> void sparse_solvers(int rows, int cols)
|
||||
|
||||
Reference in New Issue
Block a user