diff options
author | Gael Guennebaud <g.gael@free.fr> | 2010-02-22 09:32:16 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2010-02-22 09:32:16 +0100 |
commit | 801440c5192d36967906a3a9639cf2f3f3a61784 (patch) | |
tree | cb0e7fe5c84ddf5d14acb12a658cca8769c0ebfa /bench/btl | |
parent | eb905500b6c654860aa9f9d9c77c7c2614e0ad10 (diff) |
fix BTL's eigen interface
(transplanted from 437f40acc1cbd9ce2f2a2a3f413cae3a5b35f8fb
)
Diffstat (limited to 'bench/btl')
-rw-r--r-- | bench/btl/libs/eigen2/eigen2_interface.hh | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/bench/btl/libs/eigen2/eigen2_interface.hh b/bench/btl/libs/eigen2/eigen2_interface.hh index 1166a37a1..a8b5b884f 100644 --- a/bench/btl/libs/eigen2/eigen2_interface.hh +++ b/bench/btl/libs/eigen2/eigen2_interface.hh @@ -17,11 +17,8 @@ // #ifndef EIGEN2_INTERFACE_HH #define EIGEN2_INTERFACE_HH -// #include <cblas.h> -#include <Eigen/Array> -#include <Eigen/Cholesky> -#include <Eigen/LU> -#include <Eigen/QR> + +#include <Eigen/Eigen> #include <vector> #include "btl.hh" @@ -88,27 +85,27 @@ public : } static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ - X = (A*B).lazy(); + X.noalias() = A*B; } static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ - X = (A.transpose()*B.transpose()).lazy(); + X.noalias() = A.transpose()*B.transpose(); } static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){ - X = (A.transpose()*A).lazy(); + X.noalias() = A.transpose()*A; } static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){ - X = (A*A.transpose()).lazy(); + X.noalias() = A*A.transpose(); } static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){ - X = (A*B).lazy(); + X.noalias() = A*B; } static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){ - X = (A.template selfadjointView<LowerTriangular>() * B)/*.lazy()*/; + X.noalias() = (A.template selfadjointView<Lower>() * B); // ei_product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1); } @@ -173,7 +170,7 @@ public : } static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - X = (A.transpose()*B).lazy(); + X.noalias() = (A.transpose()*B); } static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N){ @@ -193,16 +190,16 @@ public : } static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int N){ - X = L.template triangularView<LowerTriangular>().solve(B); + X = L.template triangularView<Lower>().solve(B); } static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){ - X = L.template triangularView<LowerTriangular>().solve(B); + X = L.template triangularView<Lower>().solve(B); } static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ C = X; - ei_llt_inplace<LowerTriangular>::blocked(C); + ei_llt_inplace<Lower>::blocked(C); //C = X.llt().matrixL(); // C = X; // Cholesky<gene_matrix>::computeInPlace(C); |