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/Random.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/Random.h')
-rw-r--r-- | Eigen/src/Core/Random.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h index 486e9ed52..dab2ac8e9 100644 --- a/Eigen/src/Core/Random.h +++ b/Eigen/src/Core/Random.h @@ -177,6 +177,42 @@ PlainObjectBase<Derived>::setRandom(Index rows, Index cols) return setRandom(); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Random() + */ +template<typename Derived> +EIGEN_STRONG_INLINE Derived& +PlainObjectBase<Derived>::setRandom(NoChange_t, Index cols) +{ + return setRandom(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Random() + */ +template<typename Derived> +EIGEN_STRONG_INLINE Derived& +PlainObjectBase<Derived>::setRandom(Index rows, NoChange_t) +{ + return setRandom(rows, cols()); +} + } // end namespace Eigen #endif // EIGEN_RANDOM_H |