diff options
author | David Tellenbach <david.tellenbach@me.com> | 2021-01-28 01:10:36 +0100 |
---|---|---|
committer | David Tellenbach <david.tellenbach@me.com> | 2021-01-28 01:10:36 +0100 |
commit | 598e1b6e54ec51c2448b1a10d4354f165f0b083e (patch) | |
tree | ab5fbdd53d3a8a60287a8ebf0858eb5d31bc930a /Eigen/src/Core/CwiseNullaryOp.h | |
parent | 0668c68b031351488712f21290c77412b02c5de8 (diff) |
Add the following functions:
DenseBase::setZero(NoChange_t, Index)
DenseBase::setZero(Index, NoChange_t)
DenseBase::setOnes(NoChange_t, Index)
DenseBase::setOnes(Index, NoChange_t)
DenseBase::setRandom(NoChange_t, Index)
DenseBase::setRandom(Index, NoChange_t)
This closes #663.
Diffstat (limited to 'Eigen/src/Core/CwiseNullaryOp.h')
-rw-r--r-- | Eigen/src/Core/CwiseNullaryOp.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index ddac9df78..638aa2f31 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -556,6 +556,32 @@ PlainObjectBase<Derived>::setZero(Index rows, Index cols) return setConstant(Scalar(0)); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Zero() + */ +template<typename Derived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase<Derived>::setZero(NoChange_t, Index cols) +{ + return setZero(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template<typename Derived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase<Derived>::setZero(Index rows, NoChange_t) +{ + return setZero(rows, cols()); +} + // ones: /** \returns an expression of a matrix where all coefficients equal one. @@ -682,6 +708,32 @@ PlainObjectBase<Derived>::setOnes(Index rows, Index cols) return setConstant(Scalar(1)); } +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(NoChange_t, Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template<typename Derived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase<Derived>::setOnes(Index rows, NoChange_t) +{ + return setOnes(rows, cols()); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(Index, NoChange_t) class CwiseNullaryOp, MatrixBase::Ones() + */ +template<typename Derived> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase<Derived>::setOnes(NoChange_t, Index cols) +{ + return setOnes(rows(), cols); +} + // Identity: /** \returns an expression of the identity matrix (not necessarily square). |