diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-10-07 14:25:53 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-10-07 14:25:53 +0200 |
commit | 8f3e33581ecd69eea782d4103985a808ed41dabd (patch) | |
tree | d37b93299e4e8af59352920302b887e5d2fb44ab /bench/BenchSparseUtil.h | |
parent | af31345df3707b3b3f33ae0ee2db575683c9d514 (diff) |
extend the sparse matrix assembly benchmark
Diffstat (limited to 'bench/BenchSparseUtil.h')
-rw-r--r-- | bench/BenchSparseUtil.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bench/BenchSparseUtil.h b/bench/BenchSparseUtil.h index f4b67cb8d..f8dc8bdf4 100644 --- a/bench/BenchSparseUtil.h +++ b/bench/BenchSparseUtil.h @@ -27,23 +27,23 @@ typedef SparseMatrix<Scalar> EigenSparseMatrix; void fillMatrix(float density, int rows, int cols, EigenSparseMatrix& dst) { - dst.startFill(rows*cols*density); + dst.reserve(rows*cols*density); for(int j = 0; j < cols; j++) { for(int i = 0; i < rows; i++) { Scalar v = (ei_random<float>(0,1) < density) ? ei_random<Scalar>() : 0; if (v!=0) - dst.fillrand(i,j) = v; + dst.insert(i,j) = v; } } - dst.endFill(); + dst.finalize(); } void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix& dst) { std::cout << "alloc " << nnzPerCol*cols << "\n"; - dst.startFill(nnzPerCol*cols); + dst.reserve(nnzPerCol*cols); for(int j = 0; j < cols; j++) { std::set<int> aux; @@ -54,10 +54,10 @@ void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix& dst) k = ei_random<int>(0,rows-1); aux.insert(k); - dst.fillrand(k,j) = ei_random<Scalar>(); + dst.insert(k,j) = ei_random<Scalar>(); } } - dst.endFill(); + dst.finalize(); } void eiToDense(const EigenSparseMatrix& src, DenseMatrix& dst) |