diff --git a/Eigen/src/Core/Reshape.h b/Eigen/src/Core/Reshape.h index 3d741010b..3e0b91c39 100644 --- a/Eigen/src/Core/Reshape.h +++ b/Eigen/src/Core/Reshape.h @@ -22,9 +22,6 @@ namespace Eigen { * \param XprType the type of the expression in which we are taking a reshape * \param ReshapeRows the number of rows of the reshape we are taking at compile time (optional) * \param ReshapeCols the number of columns of the reshape we are taking at compile time (optional) - * \param InnerPanel is true, if the reshape maps to a set of rows of a row major matrix or - * to set of columns of a column major matrix (optional). The parameter allows to determine - * at compile time whether aligned access is possible on the reshape expression. * * This class represents an expression of either a fixed-size or dynamic-size reshape. It is the return * type of DenseBase::reshape(Index,Index) and DenseBase::reshape() and @@ -50,8 +47,8 @@ namespace Eigen { */ namespace internal { -template -struct traits > : traits +template +struct traits > : traits { typedef typename traits::Scalar Scalar; typedef typename traits::StorageKind StorageKind; @@ -84,7 +81,7 @@ struct traits > : traits< MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) && (InnerStrideAtCompileTime == 1) ? PacketAccessBit : 0, - MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, + MaskAlignedBit = ((OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, @@ -92,7 +89,8 @@ struct traits > : traits< && ColsAtCompileTime == ReshapeCols && RowsAtCompileTime != Dynamic && ColsAtCompileTime != Dynamic, - MaskDirectAccessBit = IsSameShapeAtCompileTime ? DirectAccessBit : 0, + MaskDirectAccessBit = (IsSameShapeAtCompileTime ? DirectAccessBit : 0) + && DirectAccessBit, Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | MaskDirectAccessBit | MaskPacketAccessBit | @@ -101,17 +99,17 @@ struct traits > : traits< }; }; -template::ret> class ReshapeImpl_dense; } // end namespace internal -template class ReshapeImpl; +template class ReshapeImpl; -template class Reshape - : public ReshapeImpl::StorageKind> +template class Reshape + : public ReshapeImpl::StorageKind> { - typedef ReshapeImpl::StorageKind> Impl; + typedef ReshapeImpl::StorageKind> Impl; public: //typedef typename Impl::Base Base; typedef Impl Base; @@ -143,11 +141,11 @@ template cl // The generic default implementation for dense reshape simplu forward to the internal::ReshapeImpl_dense // that must be specialized for direct and non-direct access... -template -class ReshapeImpl - : public internal::ReshapeImpl_dense +template +class ReshapeImpl + : public internal::ReshapeImpl_dense { - typedef internal::ReshapeImpl_dense Impl; + typedef internal::ReshapeImpl_dense Impl; typedef typename XprType::Index Index; public: typedef Impl Base; @@ -160,10 +158,10 @@ class ReshapeImpl namespace internal { /** \internal Internal implementation of dense Reshapes in the general case. */ -template class ReshapeImpl_dense - : public internal::dense_xpr_base >::type +template class ReshapeImpl_dense + : public internal::dense_xpr_base >::type { - typedef Reshape ReshapeType; + typedef Reshape ReshapeType; public: typedef typename internal::dense_xpr_base::type Base; @@ -301,11 +299,11 @@ template -//class ReshapeImpl_dense -// : public MapBase > +//template +//class ReshapeImpl_dense +// : public MapBase > //{ -// typedef Reshape ReshapeType; +// typedef Reshape ReshapeType; // public: // // typedef MapBase Base; diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index a4f3435bb..f85b3b32b 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -79,7 +79,7 @@ template class ForceAlignedAccess; template class SwapWrapper; template class Block; -template class Reshape; +template class Reshape; template class VectorBlock; template class Transpose; diff --git a/test/reshape.cpp b/test/reshape.cpp index 2aef066aa..053ece14d 100644 --- a/test/reshape.cpp +++ b/test/reshape.cpp @@ -53,6 +53,8 @@ void test_reshape() } } + mx.reshape(8, 2).leftCols(2); + // test dynamic-size matrix CALL_SUBTEST(dynamic_reshape_all_size(mx, 4, 4)); CALL_SUBTEST(static_reshape_all_size(mx));