mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +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:
|
protected:
|
||||||
enum {
|
enum {
|
||||||
PacketSize = ei_packet_traits<Scalar>::size,
|
PacketSize = ei_packet_traits<Scalar>::size,
|
||||||
IsRowMajor = Flags & RowMajorBit,
|
IsRowMajor = MatrixType::IsRowMajor,
|
||||||
IsColMajor = !IsRowMajor,
|
IsColMajor = !IsRowMajor,
|
||||||
ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
|
ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
|
||||||
ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),
|
ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),
|
||||||
|
@ -55,9 +55,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
LhsIsEffectivelyRowMajor = (Derived::RowsAtCompileTime==1) || (int(Derived::Flags)&RowMajorBit),
|
StorageOrdersAgree = (int(Derived::IsRowMajor) == int(OtherDerived::IsRowMajor)),
|
||||||
RhsIsEffectivelyRowMajor = (OtherDerived::RowsAtCompileTime==1) || (int(OtherDerived::Flags)&RowMajorBit),
|
|
||||||
StorageOrdersAgree = (LhsIsEffectivelyRowMajor == RhsIsEffectivelyRowMajor),
|
|
||||||
MightVectorize = StorageOrdersAgree
|
MightVectorize = StorageOrdersAgree
|
||||||
&& (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit),
|
&& (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit),
|
||||||
MayInnerVectorize = MightVectorize && int(InnerSize)!=Dynamic && int(InnerSize)%int(PacketSize)==0
|
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".
|
* 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
|
InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? SizeAtCompileTime
|
||||||
: int(Flags)&RowMajorBit ? ColsAtCompileTime : RowsAtCompileTime,
|
: int(Flags)&RowMajorBit ? ColsAtCompileTime : RowsAtCompileTime,
|
||||||
@ -245,10 +249,7 @@ template<typename Derived> class DenseBase
|
|||||||
*/
|
*/
|
||||||
inline int rowStride() const
|
inline int rowStride() const
|
||||||
{
|
{
|
||||||
return ColsAtCompileTime==1 ? innerStride()
|
return IsRowMajor ? outerStride() : innerStride();
|
||||||
: RowsAtCompileTime==1 ? outerStride()
|
|
||||||
: IsRowMajor ? outerStride()
|
|
||||||
: innerStride();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns the pointer increment between two consecutive columns.
|
/** \returns the pointer increment between two consecutive columns.
|
||||||
@ -257,10 +258,7 @@ template<typename Derived> class DenseBase
|
|||||||
*/
|
*/
|
||||||
inline int colStride() const
|
inline int colStride() const
|
||||||
{
|
{
|
||||||
return ColsAtCompileTime==1 ? outerStride()
|
return IsRowMajor ? innerStride() : outerStride();
|
||||||
: RowsAtCompileTime==1 ? innerStride()
|
|
||||||
: IsRowMajor ? innerStride()
|
|
||||||
: outerStride();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user