diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-07-08 17:20:17 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-07-08 17:20:17 +0000 |
commit | 77a622f2bb3356ee005a9413f6436373ec06efc2 (patch) | |
tree | 14b044c01f19c01102cc275e93e3e6abb6923a39 /bench/BenchUtil.h | |
parent | 6f09d3a67d333d68e7c971147ec77600e86e93f3 (diff) |
add Cholesky and eigensolver benchmark
Diffstat (limited to 'bench/BenchUtil.h')
-rw-r--r-- | bench/BenchUtil.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bench/BenchUtil.h b/bench/BenchUtil.h index bb3c4611c..4afe61980 100644 --- a/bench/BenchUtil.h +++ b/bench/BenchUtil.h @@ -26,3 +26,43 @@ template<typename MatrixType> 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 <gmm/gmm.h> +template <typename EigenMatrixType, typename GmmMatrixType> +void eiToGmm(const EigenMatrixType& src, GmmMatrixType& 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); +} +#endif + + +#ifdef BENCH_GSL +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_linalg.h> +#include <gsl/gsl_eigen.h> +template <typename EigenMatrixType> +void eiToGsl(const EigenMatrixType& src, gsl_matrix** dst) +{ + for (int j=0; j<src.cols(); ++j) + for (int i=0; i<src.rows(); ++i) + gsl_matrix_set(*dst, i, j, src.coeff(i,j)); +} +#endif + |