From 611fc1789434f6b335f42739ed0d99b39c686da1 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 23 Mar 2011 11:39:35 +0100 Subject: add support for ublas --- bench/BenchSparseUtil.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'bench/BenchSparseUtil.h') diff --git a/bench/BenchSparseUtil.h b/bench/BenchSparseUtil.h index ff836bffe..13981f6b7 100644 --- a/bench/BenchSparseUtil.h +++ b/bench/BenchSparseUtil.h @@ -26,7 +26,7 @@ typedef SparseMatrix EigenSparseMatrix; void fillMatrix(float density, int rows, int cols, EigenSparseMatrix& dst) { - dst.reserve(rows*cols*density); + dst.reserve(double(rows)*cols*density); for(int j = 0; j < cols; j++) { for(int i = 0; i < rows; i++) @@ -122,22 +122,24 @@ void eiToCSparse(const EigenSparseMatrix& src, cs* &dst) #include #include #include -// #include -// using namespace boost; -// using namespace boost::numeric; -// using namespace boost::numeric::ublas; +typedef boost::numeric::ublas::compressed_matrix UBlasSparse; -typedef boost::numeric::ublas::compressed_matrix UblasMatrix; - -void eiToUblas(const EigenSparseMatrix& src, UblasMatrix& dst) +void eiToUblas(const EigenSparseMatrix& src, UBlasSparse& dst) { + dst.resize(src.rows(), src.cols(), false); for (int j=0; j +void eiToUblasVec(const EigenType& src, UblasType& dst) +{ + dst.resize(src.size()); + for (int j=0; j