diff options
Diffstat (limited to 'bench/BenchUtil.h')
-rw-r--r-- | bench/BenchUtil.h | 20 |
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 |