From f0238cfb6997c4acfc2bd200de7295f3fa36968f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Mar 2019 21:09:10 +0100 Subject: don't index Eigen --- eigen/bench/geometry.cpp | 126 ----------------------------------------------- 1 file changed, 126 deletions(-) delete mode 100644 eigen/bench/geometry.cpp (limited to 'eigen/bench/geometry.cpp') diff --git a/eigen/bench/geometry.cpp b/eigen/bench/geometry.cpp deleted file mode 100644 index b187a51..0000000 --- a/eigen/bench/geometry.cpp +++ /dev/null @@ -1,126 +0,0 @@ - -#include -#include -#include - -using namespace std; -using namespace Eigen; - -#ifndef SCALAR -#define SCALAR float -#endif - -#ifndef SIZE -#define SIZE 8 -#endif - -typedef SCALAR Scalar; -typedef NumTraits::Real RealScalar; -typedef Matrix A; -typedef Matrix B; -typedef Matrix C; -typedef Matrix M; - -template -EIGEN_DONT_INLINE void transform(const Transformation& t, Data& data) -{ - EIGEN_ASM_COMMENT("begin"); - data = t * data; - EIGEN_ASM_COMMENT("end"); -} - -template -EIGEN_DONT_INLINE void transform(const Quaternion& t, Data& data) -{ - EIGEN_ASM_COMMENT("begin quat"); - for(int i=0;i struct ToRotationMatrixWrapper -{ - enum {Dim = T::Dim}; - typedef typename T::Scalar Scalar; - ToRotationMatrixWrapper(const T& o) : object(o) {} - T object; -}; - -template -EIGEN_DONT_INLINE void transform(const ToRotationMatrixWrapper& t, Data& data) -{ - EIGEN_ASM_COMMENT("begin quat via mat"); - data = t.object.toRotationMatrix() * data; - EIGEN_ASM_COMMENT("end quat via mat"); -} - -template -EIGEN_DONT_INLINE void transform(const Transform& t, Data& data) -{ - data = (t * data.colwise().homogeneous()).template block(0,0); -} - -template struct get_dim { enum { Dim = T::Dim }; }; -template -struct get_dim > { enum { Dim = R }; }; - -template -struct bench_impl -{ - static EIGEN_DONT_INLINE void run(const Transformation& t) - { - Matrix::Dim,N> data; - data.setRandom(); - bench_impl::run(t); - BenchTimer timer; - BENCH(timer,10,100000,transform(t,data)); - cout.width(9); - cout << timer.best() << " "; - } -}; - - -template -struct bench_impl -{ - static EIGEN_DONT_INLINE void run(const Transformation&) {} -}; - -template -EIGEN_DONT_INLINE void bench(const std::string& msg, const Transformation& t) -{ - cout << msg << " "; - bench_impl::run(t); - std::cout << "\n"; -} - -int main(int argc, char ** argv) -{ - Matrix mat34; mat34.setRandom(); - Transform iso3(mat34); - Transform aff3(mat34); - Transform caff3(mat34); - Transform proj3(mat34); - Quaternion quat;quat.setIdentity(); - ToRotationMatrixWrapper > quatmat(quat); - Matrix mat33; mat33.setRandom(); - - cout.precision(4); - std::cout - << "N "; - for(int i=0;i