From 44861dcbfeee041223c4aac1ee075e92fa4daa01 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Sep 2016 12:42:15 +0200 Subject: update --- eigen/bench/BenchUtil.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 eigen/bench/BenchUtil.h (limited to 'eigen/bench/BenchUtil.h') diff --git a/eigen/bench/BenchUtil.h b/eigen/bench/BenchUtil.h new file mode 100644 index 0000000..8883a13 --- /dev/null +++ b/eigen/bench/BenchUtil.h @@ -0,0 +1,92 @@ + +#ifndef EIGEN_BENCH_UTIL_H +#define EIGEN_BENCH_UTIL_H + +#include +#include "BenchTimer.h" + +using namespace std; +using namespace Eigen; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template void initMatrix_random(MatrixType& mat) __attribute__((noinline)); +template void initMatrix_random(MatrixType& mat) +{ + mat.setRandom();// = MatrixType::random(mat.rows(), mat.cols()); +} + +template void initMatrix_identity(MatrixType& mat) __attribute__((noinline)); +template void initMatrix_identity(MatrixType& mat) +{ + mat.setIdentity(); +} + +#ifndef __INTEL_COMPILER +#define DISABLE_SSE_EXCEPTIONS() { \ + int aux; \ + asm( \ + "stmxcsr %[aux] \n\t" \ + "orl $32832, %[aux] \n\t" \ + "ldmxcsr %[aux] \n\t" \ + : : [aux] "m" (aux)); \ +} +#else +#define DISABLE_SSE_EXCEPTIONS() +#endif + +#ifdef BENCH_GMM +#include +template +void eiToGmm(const EigenMatrixType& src, GmmMatrixType& dst) +{ + dst.resize(src.rows(),src.cols()); + for (int j=0; j +#include +#include +template +void eiToGsl(const EigenMatrixType& src, gsl_matrix** dst) +{ + for (int j=0; j +#include +template +void eiToUblas(const EigenMatrixType& src, UblasMatrixType& dst) +{ + dst.resize(src.rows(),src.cols()); + for (int j=0; j +void eiToUblasVec(const EigenType& src, UblasType& dst) +{ + dst.resize(src.size()); + for (int j=0; j