aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-11-30 19:24:43 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-11-30 19:24:43 +0100
commitd1b54ecfa3cd9c57569ab245566a4f66cc4f363a (patch)
treef9ae278b47464206c5f87cf0fb1de10cca75c27f /test/sparse.h
parentcda397b11775000a7b6da375728ebb851ebec232 (diff)
add more support for uncompressed mode
Diffstat (limited to 'test/sparse.h')
-rw-r--r--test/sparse.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/sparse.h b/test/sparse.h
index 4ca6b5aed..1ce1d2ac4 100644
--- a/test/sparse.h
+++ b/test/sparse.h
@@ -78,11 +78,12 @@ initSparse(double density,
{
enum { IsRowMajor = SparseMatrix<Scalar,Opt2,Index>::IsRowMajor };
sparseMat.setZero();
- sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));
+ //sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));
+ sparseMat.reserve(VectorXi::Constant(IsRowMajor ? refMat.rows() : refMat.cols(), (1.5*density)*(IsRowMajor?refMat.cols():refMat.rows())));
for(int j=0; j<sparseMat.outerSize(); j++)
{
- sparseMat.startVec(j);
+ //sparseMat.startVec(j);
for(int i=0; i<sparseMat.innerSize(); i++)
{
int ai(i), aj(j);
@@ -104,7 +105,8 @@ initSparse(double density,
if (v!=Scalar(0))
{
- sparseMat.insertBackByOuterInner(j,i) = v;
+ //sparseMat.insertBackByOuterInner(j,i) = v;
+ sparseMat.insertByOuterInner(j,i) = v;
if (nonzeroCoords)
nonzeroCoords->push_back(Vector2i(ai,aj));
}
@@ -115,7 +117,7 @@ initSparse(double density,
refMat(ai,aj) = v;
}
}
- sparseMat.finalize();
+ //sparseMat.finalize();
}
template<typename Scalar,int Opt1,int Opt2,typename Index> void