aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Random.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-11 15:08:04 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-11 15:08:04 +0000
commite092cbc75cadef1158d43f07b32e4ae0bf9372e2 (patch)
treef95fb0f3e6c36c6e6badbed4fcd8d136b8483880 /Eigen/src/Core/Random.h
parentaae0667e1e120b5809a7e2fe442d67832ff9ed0f (diff)
-add set...() methods and their documentation; remove Generic
-use row-major traversal when the number of columns is fixed and the number of rows is dynamic -other minor changes
Diffstat (limited to 'Eigen/src/Core/Random.h')
-rw-r--r--Eigen/src/Core/Random.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index ad6142f4d..f07fa792a 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -64,7 +64,7 @@ template<typename MatrixType> class Random : NoOperatorEquals,
}
protected:
- int m_rows, m_cols;
+ const int m_rows, m_cols;
};
/** \returns a random matrix (not an expression, the matrix is immediately evaluated).
@@ -128,4 +128,17 @@ const Eval<Random<Derived> > MatrixBase<Scalar, Derived>::random()
return Random<Derived>(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime).eval();
}
+/** Sets all coefficients in this expression to random values.
+ *
+ * Example: \include MatrixBase_setRandom.cpp
+ * Output: \verbinclude MatrixBase_setRandom.out
+ *
+ * \sa class Random, random()
+ */
+template<typename Scalar, typename Derived>
+Derived& MatrixBase<Scalar, Derived>::setRandom()
+{
+ return *this = Random<Derived>(rows(), cols());
+}
+
#endif // EIGEN_RANDOM_H