MOAB
4.9.3pre
|
#include <PlainObjectBase.h>
Static Public Member Functions | |
static void | run (DenseBase< Derived > &_this, Index rows, Index cols) |
static void | run (DenseBase< Derived > &_this, const DenseBase< OtherDerived > &other) |
Definition at line 881 of file PlainObjectBase.h.
static void Eigen::internal::conservative_resize_like_impl< Derived, OtherDerived, IsVector >::run | ( | DenseBase< Derived > & | _this, |
Index | rows, | ||
Index | cols | ||
) | [inline, static] |
Definition at line 883 of file PlainObjectBase.h.
{ if (_this.rows() == rows && _this.cols() == cols) return; EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns { internal::check_rows_cols_for_overflow<Derived::MaxSizeAtCompileTime>::run(rows, cols); _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); } else { // The storage order does not allow us to use reallocation. typename Derived::PlainObject tmp(rows,cols); const Index common_rows = (std::min)(rows, _this.rows()); const Index common_cols = (std::min)(cols, _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } }
static void Eigen::internal::conservative_resize_like_impl< Derived, OtherDerived, IsVector >::run | ( | DenseBase< Derived > & | _this, |
const DenseBase< OtherDerived > & | other | ||
) | [inline, static] |
Reimplemented in Eigen::internal::conservative_resize_like_impl< Derived, OtherDerived, true >.
Definition at line 905 of file PlainObjectBase.h.
{ if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; // Note: Here is space for improvement. Basically, for conservativeResize(Index,Index), // neither RowsAtCompileTime or ColsAtCompileTime must be Dynamic. If only one of the // dimensions is dynamic, one could use either conservativeResize(Index rows, NoChange_t) or // conservativeResize(NoChange_t, Index cols). For these methods new static asserts like // EIGEN_STATIC_ASSERT_DYNAMIC_ROWS and EIGEN_STATIC_ASSERT_DYNAMIC_COLS would be good. EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived) if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows (!Derived::IsRowMajor && _this.rows() == other.rows()) ) // column-major and we change only the number of columns { const Index new_rows = other.rows() - _this.rows(); const Index new_cols = other.cols() - _this.cols(); _this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols()); if (new_rows>0) _this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows); else if (new_cols>0) _this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols); } else { // The storage order does not allow us to use reallocation. typename Derived::PlainObject tmp(other); const Index common_rows = (std::min)(tmp.rows(), _this.rows()); const Index common_cols = (std::min)(tmp.cols(), _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } }