From 501063d9e93646d68706bb6a15360210bb2a67e9 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 9 Jun 2010 19:39:05 -0400 Subject: [PATCH] Fix bug #132 In the matrix-vector products, we were calling coeffRef on the vector xpr without checking it has DirectAccess. Will add unit test (since it's in 2.0, just import the test case provided in the bug report). Confirming that this can't happen in the devel branch, and that if we tried to call coeffRef on an xpr without DirectAccess, that would not compile (since the DenseCoeffsBase class was introduced). --- Eigen/src/Core/Product.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 54f8b62a2..1e516d005 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -636,6 +636,7 @@ struct ei_cache_friendly_product_selector::_RhsNested Rhs; enum { UseRhsDirectly = ((ei_packet_traits::size==1) || (Rhs::Flags&ActualPacketAccessBit)) + && (Rhs::Flags&DirectAccessBit) && (!(Rhs::Flags & RowMajorBit)) }; template @@ -664,6 +665,7 @@ struct ei_cache_friendly_product_selector::_LhsNested Lhs; enum { UseLhsDirectly = ((ei_packet_traits::size==1) || (Lhs::Flags&ActualPacketAccessBit)) + && (Lhs::Flags&DirectAccessBit) && (Lhs::Flags & RowMajorBit) }; template