DenseBase::IsRowMajor now takes the special case of vectors into account.

This commit is contained in:
Benoit Jacob 2010-02-25 21:24:42 -05:00
parent b1c6c215a4
commit f56ac04c34
3 changed files with 9 additions and 13 deletions

View File

@ -85,7 +85,7 @@ template<typename MatrixType, int Direction> class Reverse
protected:
enum {
PacketSize = ei_packet_traits<Scalar>::size,
IsRowMajor = Flags & RowMajorBit,
IsRowMajor = MatrixType::IsRowMajor,
IsColMajor = !IsRowMajor,
ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),

View File

@ -55,9 +55,7 @@ private:
};
enum {
LhsIsEffectivelyRowMajor = (Derived::RowsAtCompileTime==1) || (int(Derived::Flags)&RowMajorBit),
RhsIsEffectivelyRowMajor = (OtherDerived::RowsAtCompileTime==1) || (int(OtherDerived::Flags)&RowMajorBit),
StorageOrdersAgree = (LhsIsEffectivelyRowMajor == RhsIsEffectivelyRowMajor),
StorageOrdersAgree = (int(Derived::IsRowMajor) == int(OtherDerived::IsRowMajor)),
MightVectorize = StorageOrdersAgree
&& (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit),
MayInnerVectorize = MightVectorize && int(InnerSize)!=Dynamic && int(InnerSize)%int(PacketSize)==0

View File

@ -124,7 +124,11 @@ template<typename Derived> class DenseBase
* constructed from this one. See the \ref flags "list of flags".
*/
IsRowMajor = int(Flags) & RowMajorBit, /**< True if this expression is row major. */
IsRowMajor = RowsAtCompileTime==1 ? 1
: ColsAtCompileTime==1 ? 0
: int(Flags) & RowMajorBit, /**< True if this expression has row-major effective addressing.
For non-vectors, it is like reading the RowMajorBit on the Flags. For vectors, this is
overriden by the convention that row-vectors are row-major and column-vectors are column-major. */
InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? SizeAtCompileTime
: int(Flags)&RowMajorBit ? ColsAtCompileTime : RowsAtCompileTime,
@ -245,10 +249,7 @@ template<typename Derived> class DenseBase
*/
inline int rowStride() const
{
return ColsAtCompileTime==1 ? innerStride()
: RowsAtCompileTime==1 ? outerStride()
: IsRowMajor ? outerStride()
: innerStride();
return IsRowMajor ? outerStride() : innerStride();
}
/** \returns the pointer increment between two consecutive columns.
@ -257,10 +258,7 @@ template<typename Derived> class DenseBase
*/
inline int colStride() const
{
return ColsAtCompileTime==1 ? outerStride()
: RowsAtCompileTime==1 ? innerStride()
: IsRowMajor ? innerStride()
: outerStride();
return IsRowMajor ? innerStride() : outerStride();
}
#ifndef EIGEN_PARSED_BY_DOXYGEN