add fill() function as an alias for setConstant

This commit is contained in:
Gael Guennebaud
2009-01-24 10:52:18 +00:00
parent 9849931500
commit 81b0ab53cf
3 changed files with 37 additions and 3 deletions

View File

@@ -238,9 +238,19 @@ bool MatrixBase<Derived>::isApproxToConstant
return true;
}
/** Alias for setConstant(): sets all coefficients in this expression to \a value.
*
* \sa setConstant(), Constant(), class CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE void MatrixBase<Derived>::fill(const Scalar& value)
{
setConstant(value);
}
/** Sets all coefficients in this expression to \a value.
*
* \sa class CwiseNullaryOp, Zero(), Ones()
* \sa fill(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setConstant(const Scalar& value)

View File

@@ -446,6 +446,7 @@ template<typename Derived> class MatrixBase
const DiagonalMatrix<Derived> asDiagonal() const;
void fill(const Scalar& value);
Derived& setConstant(const Scalar& value);
Derived& setZero();
Derived& setOnes();