mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add a debug mechanism to compute the number of intermediate evaluations (only for dynamic size)
This commit is contained in:
@@ -360,7 +360,7 @@ class Matrix
|
||||
/** \internal */
|
||||
Matrix(ei_constructor_without_unaligned_array_assert)
|
||||
: m_storage(ei_constructor_without_unaligned_array_assert())
|
||||
{}
|
||||
{ _check_template_params(); }
|
||||
#endif
|
||||
|
||||
/** Constructs a vector or row-vector with given dimension. \only_for_vectors
|
||||
@@ -436,7 +436,10 @@ class Matrix
|
||||
/** Copy constructor with in-place evaluation */
|
||||
template<typename OtherDerived,typename OtherEvalType>
|
||||
EIGEN_STRONG_INLINE Matrix(const ReturnByValue<OtherDerived,OtherEvalType>& other)
|
||||
{ other.evalTo(*this); }
|
||||
{
|
||||
_check_template_params();
|
||||
other.evalTo(*this);
|
||||
}
|
||||
/** Destructor */
|
||||
inline ~Matrix() {}
|
||||
|
||||
@@ -454,6 +457,7 @@ class Matrix
|
||||
EIGEN_STRONG_INLINE Matrix(const AnyMatrixBase<OtherDerived> &other)
|
||||
: m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
|
||||
{
|
||||
_check_template_params();
|
||||
*this = other;
|
||||
}
|
||||
|
||||
@@ -587,17 +591,21 @@ class Matrix
|
||||
|
||||
static EIGEN_STRONG_INLINE void _check_template_params()
|
||||
{
|
||||
EIGEN_STATIC_ASSERT(((_Rows >= _MaxRows)
|
||||
&& (_Cols >= _MaxCols)
|
||||
&& (_MaxRows >= 0)
|
||||
&& (_MaxCols >= 0)
|
||||
&& (_Rows <= Dynamic)
|
||||
&& (_Cols <= Dynamic)
|
||||
&& (_MaxRows == _Rows || _Rows==Dynamic)
|
||||
&& (_MaxCols == _Cols || _Cols==Dynamic)
|
||||
&& ((_MaxRows==Dynamic?1:_MaxRows)*(_MaxCols==Dynamic?1:_MaxCols)<Dynamic)
|
||||
&& (_Options & (DontAlign|RowMajor)) == _Options),
|
||||
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
||||
#ifdef EIGEN_DEBUG_MATRIX_CTOR
|
||||
EIGEN_DEBUG_MATRIX_CTOR(Matrix);
|
||||
#endif
|
||||
|
||||
EIGEN_STATIC_ASSERT(((_Rows >= _MaxRows)
|
||||
&& (_Cols >= _MaxCols)
|
||||
&& (_MaxRows >= 0)
|
||||
&& (_MaxCols >= 0)
|
||||
&& (_Rows <= Dynamic)
|
||||
&& (_Cols <= Dynamic)
|
||||
&& (_MaxRows == _Rows || _Rows==Dynamic)
|
||||
&& (_MaxCols == _Cols || _Cols==Dynamic)
|
||||
&& ((_MaxRows==Dynamic?1:_MaxRows)*(_MaxCols==Dynamic?1:_MaxCols)<Dynamic)
|
||||
&& (_Options & (DontAlign|RowMajor)) == _Options),
|
||||
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -306,13 +306,14 @@ struct ei_selfadjoint_product_returntype<Lhs,LhsMode,false,Rhs,RhsMode,false>
|
||||
|
||||
template<typename Dest> void evalTo(Dest& dst) const
|
||||
{
|
||||
dst.resize(m_lhs.rows(), m_rhs.cols());
|
||||
dst.setZero();
|
||||
evalTo(dst,1);
|
||||
}
|
||||
|
||||
template<typename Dest> void evalTo(Dest& dst, Scalar alpha) const
|
||||
{
|
||||
ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
|
||||
|
||||
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
|
||||
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
|
||||
|
||||
|
||||
@@ -148,13 +148,14 @@ struct ei_triangular_product_returntype<Mode,true,Lhs,false,Rhs,true>
|
||||
|
||||
template<typename Dest> void evalTo(Dest& dst) const
|
||||
{
|
||||
dst.resize(m_lhs.rows(), m_rhs.cols());
|
||||
dst.setZero();
|
||||
evalTo(dst,1);
|
||||
}
|
||||
|
||||
template<typename Dest> void evalTo(Dest& dst, Scalar alpha) const
|
||||
{
|
||||
ei_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
|
||||
|
||||
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs);
|
||||
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user