2#ifndef EIGEN_BENCH_UTIL_H
3#define EIGEN_BENCH_UTIL_H
11#include <boost/preprocessor/repetition/enum_params.hpp>
12#include <boost/preprocessor/repetition.hpp>
13#include <boost/preprocessor/seq.hpp>
14#include <boost/preprocessor/array.hpp>
15#include <boost/preprocessor/arithmetic.hpp>
16#include <boost/preprocessor/comparison.hpp>
17#include <boost/preprocessor/punctuation.hpp>
18#include <boost/preprocessor/punctuation/comma.hpp>
19#include <boost/preprocessor/stringize.hpp>
33#ifndef __INTEL_COMPILER
34#define DISABLE_SSE_EXCEPTIONS() { \
37 "stmxcsr %[aux] \n\t" \
38 "orl $32832, %[aux] \n\t" \
39 "ldmxcsr %[aux] \n\t" \
40 : : [aux] "m" (aux)); \
43#define DISABLE_SSE_EXCEPTIONS()
48template <
typename EigenMatrixType,
typename GmmMatrixType>
49void eiToGmm(
const EigenMatrixType& src, GmmMatrixType& dst)
51 dst.resize(src.rows(),src.cols());
52 for (
int j=0;
j<src.cols(); ++
j)
53 for (
int i=0;
i<src.rows(); ++
i)
54 dst(
i,
j) = src.coeff(
i,
j);
60#include <gsl/gsl_matrix.h>
61#include <gsl/gsl_linalg.h>
62#include <gsl/gsl_eigen.h>
63template <
typename EigenMatrixType>
64void eiToGsl(
const EigenMatrixType& src, gsl_matrix** dst)
66 for (
int j=0;
j<src.cols(); ++
j)
67 for (
int i=0;
i<src.rows(); ++
i)
68 gsl_matrix_set(*dst,
i,
j, src.coeff(
i,
j));
73#include <boost/numeric/ublas/matrix.hpp>
74#include <boost/numeric/ublas/vector.hpp>
75template <
typename EigenMatrixType,
typename UblasMatrixType>
76void eiToUblas(
const EigenMatrixType& src, UblasMatrixType& dst)
78 dst.resize(src.rows(),src.cols());
79 for (
int j=0;
j<src.cols(); ++
j)
80 for (
int i=0;
i<src.rows(); ++
i)
81 dst(
i,
j) = src.coeff(
i,
j);
83template <
typename EigenType,
typename UblasType>
86 dst.resize(src.size());
87 for (
int j=0;
j<src.size(); ++
j)
88 dst[
j] = src.coeff(
j);
void eiToGmm(const EigenSparseMatrix &src, GmmSparse &dst)
Definition BenchSparseUtil.h:74
void eiToUblasVec(const EigenType &src, UblasType &dst)
Definition BenchSparseUtil.h:137
void eiToUblas(const EigenSparseMatrix &src, UBlasSparse &dst)
Definition BenchSparseUtil.h:128
void initMatrix_identity(MatrixType &mat) __attribute__((noinline))
Definition BenchUtil.h:28
void initMatrix_random(MatrixType &mat) __attribute__((noinline))
Definition BenchUtil.h:22
int i
Definition BiCGSTAB_step_by_step.cpp:9
MatrixXf mat
Definition Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
__attribute__((noinline)) void bench_reverse(const MatrixType &m)
Definition bench_reverse.cpp:18
MatrixXf MatrixType
Definition benchmark-blocking-sizes.cpp:52
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2