From ac409f51f185a4654f9a5c38ab5d1652824836f6 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 7 Jan 2014 20:17:59 +0100 Subject: Document the fact that Random and setRandom are not reentrant (so not thread-safe) --- Eigen/src/Core/Random.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Eigen/src/Core/Random.h') diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h index a0bd3039e..a4492ddb6 100644 --- a/Eigen/src/Core/Random.h +++ b/Eigen/src/Core/Random.h @@ -34,6 +34,8 @@ struct functor_traits > * The parameters \a rows and \a cols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * + * \not_reentrant + * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used * instead. @@ -45,8 +47,8 @@ struct functor_traits > * This expression has the "evaluate before nesting" flag so that it will be evaluated into * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. - * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index), MatrixBase::Random() + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index), DenseBase::Random() */ template inline const CwiseNullaryOp::Scalar>, Derived> @@ -64,6 +66,7 @@ DenseBase::Random(Index rows, Index cols) * Must be compatible with this MatrixBase type. * * \only_for_vectors + * \not_reentrant * * This variant is meant to be used for dynamic-size vector types. For fixed-size types, * it is redundant to pass \a size as argument, so Random() should be used @@ -76,7 +79,7 @@ DenseBase::Random(Index rows, Index cols) * a temporary vector whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random() + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random() */ template inline const CwiseNullaryOp::Scalar>, Derived> @@ -99,8 +102,10 @@ DenseBase::Random(Index size) * This expression has the "evaluate before nesting" flag so that it will be evaluated into * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. + * + * \not_reentrant * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random(Index) + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random(Index) */ template inline const CwiseNullaryOp::Scalar>, Derived> @@ -114,6 +119,8 @@ DenseBase::Random() * 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 + * * Example: \include MatrixBase_setRandom.cpp * Output: \verbinclude MatrixBase_setRandom.out * @@ -131,11 +138,12 @@ inline Derived& DenseBase::setRandom() * and in the [-1:1] range for floating point scalar types. * * \only_for_vectors + * \not_reentrant * * Example: \include Matrix_setRandom_int.cpp * Output: \verbinclude Matrix_setRandom_int.out * - * \sa MatrixBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, MatrixBase::Random() + * \sa DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random() */ template EIGEN_STRONG_INLINE Derived& @@ -150,13 +158,15 @@ PlainObjectBase::setRandom(Index newSize) * 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 + * * \param nbRows the new number of rows * \param nbCols the new number of columns * * Example: \include Matrix_setRandom_int_int.cpp * Output: \verbinclude Matrix_setRandom_int_int.out * - * \sa MatrixBase::setRandom(), setRandom(Index), class CwiseNullaryOp, MatrixBase::Random() + * \sa DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random() */ template EIGEN_STRONG_INLINE Derived& -- cgit v1.2.3