aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-02-25 21:24:42 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-02-25 21:24:42 -0500
commitf56ac04c34e3ccefa2313d41b7a93f3f94f9d07e (patch)
tree525a4a5bbf33033da66487be2ed9707c9b224cc4 /Eigen/src
parentb1c6c215a43850b2bc5bdc393ab5a1179e858024 (diff)
DenseBase::IsRowMajor now takes the special case of vectors into account.
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Array/Reverse.h2
-rw-r--r--Eigen/src/Core/Assign.h4
-rw-r--r--Eigen/src/Core/DenseBase.h16
3 files changed, 9 insertions, 13 deletions
diff --git a/Eigen/src/Array/Reverse.h b/Eigen/src/Array/Reverse.h
index a405fbb4b..fe7de53b6 100644
--- a/Eigen/src/Array/Reverse.h
+++ b/Eigen/src/Array/Reverse.h
@@ -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),
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h
index 3133aa03a..99d497449 100644
--- a/Eigen/src/Core/Assign.h
+++ b/Eigen/src/Core/Assign.h
@@ -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
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
index 5682d7278..67540bd8c 100644
--- a/Eigen/src/Core/DenseBase.h
+++ b/Eigen/src/Core/DenseBase.h
@@ -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