diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-02-18 20:42:38 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-02-18 20:42:38 -0500 |
commit | b73e22905dd1544830b41463576d112c53fc66d9 (patch) | |
tree | d5832987f01195981df53d634e379721fed6b29c /Eigen/src/Core/Block.h | |
parent | 39d9f0275b8c9ef515b04f7b0e51f701edabbcad (diff) |
miserable half-working state, commiting to a fork just in case, just to perfect
my day, my hard disk would die.
Will write a more detailed commit message once it's working.
Diffstat (limited to 'Eigen/src/Core/Block.h')
-rw-r--r-- | Eigen/src/Core/Block.h | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 3b4234c22..8a7aea91f 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -80,6 +80,20 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> > }; }; +template<typename MatrixType, int BlockRows, int BlockCols> +struct ei_traits<Block<MatrixType, BlockRows, BlockCols, true> > : ei_traits<Block<MatrixType, BlockRows, BlockCols, false> > +{ + enum { + InnerStrideAtCompileTime = + (BlockRows==1 && !(int(MatrixType::Flags)&RowMajorBit)) + || (BlockCols==1 && (int(MatrixType::Flags)&RowMajorBit)) + ? MatrixType::OuterStrideAtCompileTime + : MatrixType::InnerStrideAtCompileTime, + OuterStrideAtCompileTime = + (BlockRows==1||BlockCols==1) ? 0 : MatrixType::OuterStrideAtCompileTime + }; +}; + template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessStatus> class Block : public MatrixType::template MakeBase< Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >::Type { @@ -196,8 +210,8 @@ template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessSta #ifdef EIGEN_PARSED_BY_DOXYGEN /** \sa MapBase::data() */ inline const Scalar* data() const; - /** \sa MapBase::stride() */ - inline int stride() const; + inline int innerStride() const; + inline int outerStride() const; #endif protected: @@ -260,17 +274,24 @@ class Block<MatrixType,BlockRows,BlockCols,HasDirectAccess> && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= matrix.cols()); } - /** \sa MapBase::stride() */ - inline int stride() const + /** \sa MapBase::innerStride() */ + inline int innerStride() const + { + return (RowsAtCompileTime==1 && !(int(MatrixType::Flags)&RowMajorBit)) + || (ColsAtCompileTime==1 && (int(MatrixType::Flags)&RowMajorBit)) + ? m_matrix.outerStride() + : m_matrix.innerStride(); + } + + /** \sa MapBase::outerStride() */ + inline int outerStride() const { - return ((!Base::IsVectorAtCompileTime) - || (BlockRows==1 && ((Flags&RowMajorBit)==0)) - || (BlockCols==1 && ((Flags&RowMajorBit)==RowMajorBit))) - ? m_matrix.stride() : 1; + return IsVectorAtCompileTime ? 0 : m_matrix.outerStride(); } #ifndef __SUNPRO_CC // FIXME sunstudio is not friendly with the above friend... + // META-FIXME there is no 'friend' keyword around here. Is this obsolete? protected: #endif |