aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/BenchUtil.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-03-23 11:39:35 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-03-23 11:39:35 +0100
commit611fc1789434f6b335f42739ed0d99b39c686da1 (patch)
tree3270e6230468dfad9e4fe3dbee6a49cf1648755a /bench/BenchUtil.h
parentec32d2c8079f2e52dc3f4503b32e76f4d0c9e88a (diff)
add support for ublas
Diffstat (limited to 'bench/BenchUtil.h')
-rw-r--r--bench/BenchUtil.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/bench/BenchUtil.h b/bench/BenchUtil.h
index 9798fa385..8883a1380 100644
--- a/bench/BenchUtil.h
+++ b/bench/BenchUtil.h
@@ -69,4 +69,24 @@ void eiToGsl(const EigenMatrixType& src, gsl_matrix** dst)
}
#endif
+#ifdef BENCH_UBLAS
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/vector.hpp>
+template <typename EigenMatrixType, typename UblasMatrixType>
+void eiToUblas(const EigenMatrixType& src, UblasMatrixType& dst)
+{
+ dst.resize(src.rows(),src.cols());
+ for (int j=0; j<src.cols(); ++j)
+ for (int i=0; i<src.rows(); ++i)
+ dst(i,j) = src.coeff(i,j);
+}
+template <typename EigenType, typename UblasType>
+void eiToUblasVec(const EigenType& src, UblasType& dst)
+{
+ dst.resize(src.size());
+ for (int j=0; j<src.size(); ++j)
+ dst[j] = src.coeff(j);
+}
+#endif
+
#endif // EIGEN_BENCH_UTIL_H