mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-19 16:19:37 +08:00
DenseBase::IsRowMajor now takes the special case of vectors into account.
This commit is contained in:
parent
b1c6c215a4
commit
f56ac04c34
@ -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),
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user