diff options
Diffstat (limited to 'bench/btl/libs/eigen2/eigen2_interface.hh')
-rw-r--r-- | bench/btl/libs/eigen2/eigen2_interface.hh | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/bench/btl/libs/eigen2/eigen2_interface.hh b/bench/btl/libs/eigen2/eigen2_interface.hh index 7a014723f..6a1bc5d61 100644 --- a/bench/btl/libs/eigen2/eigen2_interface.hh +++ b/bench/btl/libs/eigen2/eigen2_interface.hh @@ -104,12 +104,12 @@ public : } static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){ - X = (A*B)/*.lazy()*/; + X = (A*B).lazy(); } static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){ - //X = (A.template marked<SelfAdjoint|LowerTriangular>() * B)/*.lazy()*/; - ei_product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1); + X = (A.template selfadjointView<LowerTriangular>() * B)/*.lazy()*/; +// ei_product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1); } template<typename Dest, typename Src> static void triassign(Dest& dst, const Src& src) @@ -163,8 +163,13 @@ public : A.col(j).end(N-j) += X[j] * Y.end(N-j) + Y[j] * X.end(N-j); } + static EIGEN_DONT_INLINE void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){ + for(int j=0; j<N; ++j) + A.col(j) += X * Y[j]; + } + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - X = (A.transpose()*B)/*.lazy()*/; + X = (A.transpose()*B).lazy(); } static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N){ @@ -172,9 +177,7 @@ public : } static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){ - asm("#begin axpby"); Y = a*X + b*Y; - asm("#end axpby"); } static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ @@ -191,20 +194,23 @@ public : 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); -// -// ei_triangular_solve_matrix<real,ColMajor,ColMajor,LowerTriangular> -// ::run(L.cols(), X.cols(), L.data(), L.stride(), X.data(), X.stride()); } static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ - C = X.llt().matrixL(); + C = X; + ei_llt_inplace<LowerTriangular>::blocked(C); + //C = X.llt().matrixL(); // C = X; // Cholesky<gene_matrix>::computeInPlace(C); // Cholesky<gene_matrix>::computeInPlaceBlock(C); } static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ - C = X.lu().matrixLU(); + RowVectorXi piv(N); + int nb; + C = X; + ei_partial_lu_inplace(C,piv,nb); + //C = X.lu().matrixLU(); } static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ |