split sum away from redux and vectorize it.

(could come back to redux after it has been vectorized,
and could serve as a starting point for that)
also make the abs2 functor vectorizable (for real types).
This commit is contained in:
Benoit Jacob
2008-06-23 10:32:48 +00:00
parent 8a967fb17c
commit dc9206cec5
6 changed files with 301 additions and 39 deletions

View File

@@ -96,30 +96,6 @@ MatrixBase<Derived>::redux(const BinaryOp& func) const
::run(derived(), func);
}
/** \returns the sum of all coefficients of *this
*
* \sa trace()
*/
template<typename Derived>
inline typename ei_traits<Derived>::Scalar
MatrixBase<Derived>::sum() const
{
return this->redux(Eigen::ei_scalar_sum_op<Scalar>());
}
/** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal.
*
* \c *this can be any matrix, not necessarily square.
*
* \sa diagonal(), sum()
*/
template<typename Derived>
inline typename ei_traits<Derived>::Scalar
MatrixBase<Derived>::trace() const
{
return diagonal().sum();
}
/** \returns the minimum of all coefficients of *this
*/
template<typename Derived>