diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-25 10:15:22 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-25 10:15:22 -0400 |
commit | 4716040703be1ee906439385d20475dcddad5ce3 (patch) | |
tree | 8efd3cf3007d8360e66f38e2d280127cbb70daa6 /Eigen/src/Core/Block.h | |
parent | ca85a1f6c5fc33ac382aa2d7ba2da63d55d3223e (diff) |
bug #86 : use internal:: namespace instead of ei_ prefix
Diffstat (limited to 'Eigen/src/Core/Block.h')
-rw-r--r-- | Eigen/src/Core/Block.h | 71 |
1 files changed, 37 insertions, 34 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index a770b9721..76fb46e25 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -58,54 +58,57 @@ * * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock */ + +namespace internal { template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool HasDirectAccess> -struct ei_traits<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> > : ei_traits<XprType> +struct traits<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> > : traits<XprType> { - typedef typename ei_traits<XprType>::Scalar Scalar; - typedef typename ei_traits<XprType>::StorageKind StorageKind; - typedef typename ei_traits<XprType>::XprKind XprKind; - typedef typename ei_nested<XprType>::type XprTypeNested; - typedef typename ei_unref<XprTypeNested>::type _XprTypeNested; + typedef typename traits<XprType>::Scalar Scalar; + typedef typename traits<XprType>::StorageKind StorageKind; + typedef typename traits<XprType>::XprKind XprKind; + typedef typename nested<XprType>::type XprTypeNested; + typedef typename unref<XprTypeNested>::type _XprTypeNested; enum{ - MatrixRows = ei_traits<XprType>::RowsAtCompileTime, - MatrixCols = ei_traits<XprType>::ColsAtCompileTime, + MatrixRows = traits<XprType>::RowsAtCompileTime, + MatrixCols = traits<XprType>::ColsAtCompileTime, RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows, ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols, MaxRowsAtCompileTime = BlockRows==0 ? 0 : RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) - : int(ei_traits<XprType>::MaxRowsAtCompileTime), + : int(traits<XprType>::MaxRowsAtCompileTime), MaxColsAtCompileTime = BlockCols==0 ? 0 : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) - : int(ei_traits<XprType>::MaxColsAtCompileTime), - XprTypeIsRowMajor = (int(ei_traits<XprType>::Flags)&RowMajorBit) != 0, + : int(traits<XprType>::MaxColsAtCompileTime), + XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0, IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 : XprTypeIsRowMajor, HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), InnerStrideAtCompileTime = HasSameStorageOrderAsXprType - ? int(ei_inner_stride_at_compile_time<XprType>::ret) - : int(ei_outer_stride_at_compile_time<XprType>::ret), + ? int(inner_stride_at_compile_time<XprType>::ret) + : int(outer_stride_at_compile_time<XprType>::ret), OuterStrideAtCompileTime = HasSameStorageOrderAsXprType - ? int(ei_outer_stride_at_compile_time<XprType>::ret) - : int(ei_inner_stride_at_compile_time<XprType>::ret), - MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % ei_packet_traits<Scalar>::size) == 0) + ? int(outer_stride_at_compile_time<XprType>::ret) + : int(inner_stride_at_compile_time<XprType>::ret), + MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits<Scalar>::size) == 0) && (InnerStrideAtCompileTime == 1) ? PacketAccessBit : 0, - MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && ((OuterStrideAtCompileTime % ei_packet_traits<Scalar>::size) == 0)) ? AlignedBit : 0, + MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && ((OuterStrideAtCompileTime % packet_traits<Scalar>::size) == 0)) ? AlignedBit : 0, FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, - Flags0 = ei_traits<XprType>::Flags & (HereditaryBits | MaskPacketAccessBit | LvalueBit | DirectAccessBit | MaskAlignedBit), + Flags0 = traits<XprType>::Flags & (HereditaryBits | MaskPacketAccessBit | LvalueBit | DirectAccessBit | MaskAlignedBit), Flags1 = Flags0 | FlagsLinearAccessBit, Flags = (Flags1 & ~RowMajorBit) | (IsRowMajor ? RowMajorBit : 0) }; }; +} template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool HasDirectAccess> class Block - : public ei_dense_xpr_base<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> >::type + : public internal::dense_xpr_base<Block<XprType, BlockRows, BlockCols, InnerPanel, HasDirectAccess> >::type { public: - typedef typename ei_dense_xpr_base<Block>::type Base; + typedef typename internal::dense_xpr_base<Block>::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Block) class InnerIterator; @@ -123,7 +126,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H m_blockRows(BlockRows==1 ? 1 : xpr.rows()), m_blockCols(BlockCols==1 ? 1 : xpr.cols()) { - ei_assert( (i>=0) && ( + eigen_assert( (i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i<xpr.rows()) ||((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && i<xpr.cols()))); } @@ -135,7 +138,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H m_blockRows(BlockRows), m_blockCols(BlockCols) { EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE) - ei_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() + eigen_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); } @@ -147,9 +150,9 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), m_blockRows(blockRows), m_blockCols(blockCols) { - ei_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - ei_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); } @@ -223,10 +226,10 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H protected: const typename XprType::Nested m_xpr; - const ei_variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow; - const ei_variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol; - const ei_variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows; - const ei_variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols; + const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow; + const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol; + const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows; + const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols; }; /** \internal */ @@ -251,7 +254,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true> BlockCols==1 ? 1 : xpr.cols()), m_xpr(xpr) { - ei_assert( (i>=0) && ( + eigen_assert( (i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i<xpr.rows()) ||((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && i<xpr.cols()))); init(); @@ -262,7 +265,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true> inline Block(const XprType& xpr, Index startRow, Index startCol) : Base(&xpr.const_cast_derived().coeffRef(startRow,startCol)), m_xpr(xpr) { - ei_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() + eigen_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows() && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols()); init(); } @@ -275,9 +278,9 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true> : Base(&xpr.const_cast_derived().coeffRef(startRow,startCol), blockRows, blockCols), m_xpr(xpr) { - ei_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - ei_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow + blockRows <= xpr.rows() && startCol >= 0 && blockCols >= 0 && startCol + blockCols <= xpr.cols()); init(); } @@ -285,7 +288,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true> /** \sa MapBase::innerStride() */ inline Index innerStride() const { - return ei_traits<Block>::HasSameStorageOrderAsXprType + return internal::traits<Block>::HasSameStorageOrderAsXprType ? m_xpr.innerStride() : m_xpr.outerStride(); } @@ -314,7 +317,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true> protected: void init() { - m_outerStride = ei_traits<Block>::HasSameStorageOrderAsXprType + m_outerStride = internal::traits<Block>::HasSameStorageOrderAsXprType ? m_xpr.outerStride() : m_xpr.innerStride(); } |