diff options
author | Gael Guennebaud <g.gael@free.fr> | 2017-01-29 15:20:35 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2017-01-29 15:20:35 +0100 |
commit | 24409f3acdd987f2734cb3b67d5a78e1d70fd362 (patch) | |
tree | b88a1a068a4e3a573f67d1e315dc265326c200bc /Eigen/src/Core | |
parent | 9036cda36484c4d7268b928b5976534c8ef3ce42 (diff) |
Use fix<> API to specify compile-time reshaped sizes.
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/Reshaped.h (renamed from Eigen/src/Core/Reshape.h) | 63 |
2 files changed, 3 insertions, 75 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 09e958727..9cad1aa1e 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -557,20 +557,6 @@ template<typename Derived> class DenseBase } EIGEN_DEVICE_FUNC void reverseInPlace(); - EIGEN_DEVICE_FUNC inline - Reshaped<Derived> reshaped(Index nRows, Index nCols); - - EIGEN_DEVICE_FUNC inline - const Reshaped<const Derived> reshaped(Index nRows, Index nCols) const; - - template<int ReshapeRows, int ReshapeCols> - EIGEN_DEVICE_FUNC - inline Reshaped<Derived, ReshapeRows, ReshapeCols> reshaped(); - - template<int ReshapeRows, int ReshapeCols> - EIGEN_DEVICE_FUNC - inline const Reshaped<const Derived, ReshapeRows, ReshapeCols> reshaped() const; - #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) @@ -578,6 +564,7 @@ template<typename Derived> class DenseBase # include "../plugins/CommonCwiseUnaryOps.h" # include "../plugins/BlockMethods.h" # include "../plugins/IndexedViewMethods.h" +# include "../plugins/ReshapedMethods.h" # ifdef EIGEN_DENSEBASE_PLUGIN # include EIGEN_DENSEBASE_PLUGIN # endif diff --git a/Eigen/src/Core/Reshape.h b/Eigen/src/Core/Reshaped.h index 0f7d44c49..655baa2a2 100644 --- a/Eigen/src/Core/Reshape.h +++ b/Eigen/src/Core/Reshaped.h @@ -197,8 +197,8 @@ template<typename XprType, int Rows, int Cols, int Order, bool HasDirectAccess> protected: MatrixTypeNested m_xpr; - const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows; - const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols; + const internal::variable_if_dynamic<Index, Rows> m_rows; + const internal::variable_if_dynamic<Index, Cols> m_cols; }; @@ -424,65 +424,6 @@ protected: } // end namespace internal -/** \returns a dynamic-size expression of a reshape in *this. - * - * \param reshapeRows the number of rows in the reshape - * \param reshapeCols the number of columns in the reshape - * - * Example: \include MatrixBase_reshape_int_int.cpp - * Output: \verbinclude MatrixBase_reshape_int_int.out - * - * \note Even though the returned expression has dynamic size, in the case - * when it is applied to a fixed-size matrix, it inherits a fixed maximal size, - * which means that evaluating it does not cause a dynamic memory allocation. - * - * \sa class Reshape, reshaped() - */ -template<typename Derived> -EIGEN_DEVICE_FUNC -inline Reshaped<Derived> DenseBase<Derived>::reshaped(Index reshapeRows, Index reshapeCols) -{ - return Reshaped<Derived>(derived(), reshapeRows, reshapeCols); -} - -/** This is the const version of reshaped(Index,Index). */ -template<typename Derived> -EIGEN_DEVICE_FUNC -inline const Reshaped<const Derived> DenseBase<Derived>::reshaped(Index reshapeRows, Index reshapeCols) const -{ - return Reshaped<const Derived>(derived(), reshapeRows, reshapeCols); -} - -/** \returns a fixed-size expression of a reshape in *this. - * - * The template parameters \a ReshapeRows and \a ReshapeCols are the number of - * rows and columns in the reshape. - * - * Example: \include MatrixBase_reshape.cpp - * Output: \verbinclude MatrixBase_reshape.out - * - * \note since reshape is a templated member, the keyword template has to be used - * if the matrix type is also a template parameter: \code m.template reshape<3,3>(); \endcode - * - * \sa class Reshape, reshaped(Index,Index) - */ -template<typename Derived> -template<int ReshapeRows, int ReshapeCols> -EIGEN_DEVICE_FUNC -inline Reshaped<Derived, ReshapeRows, ReshapeCols> DenseBase<Derived>::reshaped() -{ - return Reshaped<Derived, ReshapeRows, ReshapeCols>(derived()); -} - -/** This is the const version of reshape<>(Index, Index). */ -template<typename Derived> -template<int ReshapeRows, int ReshapeCols> -EIGEN_DEVICE_FUNC -inline const Reshaped<const Derived, ReshapeRows, ReshapeCols> DenseBase<Derived>::reshaped() const -{ - return Reshaped<const Derived, ReshapeRows, ReshapeCols>(derived()); -} - } // end namespace Eigen #endif // EIGEN_RESHAPED_H |