From d9ee28851ec17225893161ab21a3f3172043532a Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 16 Apr 2010 14:12:53 -0400 Subject: [PATCH] fix ei_blas_traits directaccess check: in the case of vectors, having a nontrivial inner stride is OK. --- Eigen/src/Core/util/BlasUtil.h | 4 ++-- test/product_notemporary.cpp | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index e83d9d8fb..762de0290 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -158,8 +158,8 @@ template struct ei_blas_traits IsComplex = NumTraits::IsComplex, IsTransposed = false, NeedToConjugate = false, - ActualAccess = ( (int(ei_traits::Flags)&DirectAccessBit) - && (int(ei_inner_stride_at_compile_time::ret) == 1) + ActualAccess = ( (int(XprType::Flags)&DirectAccessBit) + && (bool(XprType::IsVectorAtCompileTime) || int(ei_inner_stride_at_compile_time::ret) == 1) ) ? HasDirectAccess : NoDirectAccess }; typedef typename ei_meta_if void product_notemporary(const MatrixType& m) VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template triangularView() * (m2+m2), 1); VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template triangularView() * m2.adjoint(), 0); -// FIXME this used to work but was broken by the eigen-storageorders fork. Why? -// VERIFY_EVALUATION_COUNT( rm3.col(c0).noalias() = (s1 * m1.adjoint()).template triangularView() * (s2*m2.row(c0)).adjoint(), 0); + VERIFY_EVALUATION_COUNT( rm3.col(c0).noalias() = (s1 * m1.adjoint()).template triangularView() * (s2*m2.row(c0)).adjoint(), 0); VERIFY_EVALUATION_COUNT( m1.template triangularView().solveInPlace(m3), 0); VERIFY_EVALUATION_COUNT( m1.adjoint().template triangularView().solveInPlace(m3.transpose()), 0); @@ -96,10 +95,8 @@ template void product_notemporary(const MatrixType& m) VERIFY_EVALUATION_COUNT( m3.noalias() = s2 * m2.adjoint() * (s1 * m1.adjoint()).template selfadjointView(), 0); VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template selfadjointView() * m2.adjoint(), 0); -// FIXME this used to work but was broken by the eigen-storageorders fork. Why? -// VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() = (s1 * m1).adjoint().template selfadjointView() * (-m2.row(c0)*s3).adjoint(), 0); -// FIXME this used to work but was broken by the eigen-storageorders fork. Why? -// VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() -= (s1 * m1).adjoint().template selfadjointView() * (-m2.row(c0)*s3).adjoint(), 0); + VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() = (s1 * m1).adjoint().template selfadjointView() * (-m2.row(c0)*s3).adjoint(), 0); + VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() -= (s1 * m1).adjoint().template selfadjointView() * (-m2.row(c0)*s3).adjoint(), 0); VERIFY_EVALUATION_COUNT( m3.block(r0,c0,r1,c1).noalias() += m1.block(r0,r0,r1,r1).template selfadjointView() * (s1*m2.block(r0,c0,r1,c1)), 0); VERIFY_EVALUATION_COUNT( m3.block(r0,c0,r1,c1).noalias() = m1.block(r0,r0,r1,r1).template selfadjointView() * m2.block(r0,c0,r1,c1), 0);