aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Random.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-03 19:36:32 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-03 19:36:32 +0000
commit23ffede3d0d280962bad418a41957cf82e3fadc9 (patch)
treea6dacc6b06f39b19d342664d2b73a6de3b0d424b /Eigen/src/Core/Random.h
parent42f6590bb26d77bfa67f57c64ff9cc6d38e23f58 (diff)
more documentation, 12 more code snippets
Diffstat (limited to 'Eigen/src/Core/Random.h')
-rw-r--r--Eigen/src/Core/Random.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index 6e672709c..ef07bfa43 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -26,6 +26,12 @@
#ifndef EIGEN_RANDOM_H
#define EIGEN_RANDOM_H
+/** \class Random
+ *
+ * \brief Expression of a random matrix or vector.
+ *
+ * \sa MatrixBase::random(), MatrixBase::random(int), MatrixBase::random(int,int)
+ */
template<typename MatrixType> class Random : NoOperatorEquals,
public MatrixBase<typename MatrixType::Scalar, Random<MatrixType> >
{
@@ -59,12 +65,42 @@ template<typename MatrixType> class Random : NoOperatorEquals,
int m_rows, m_cols;
};
+/** \returns a random matrix (not an expression, the matrix is immediately evaluated).
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * Example: \include MatrixBase_random_int_int.cpp
+ * Output: \verbinclude MatrixBase_random_int_int.out
+ *
+ * \sa random(), random(int)
+ */
template<typename Scalar, typename Derived>
const Eval<Random<Derived> > MatrixBase<Scalar, Derived>::random(int rows, int cols)
{
return Random<Derived>(rows, cols).eval();
}
+/** \returns a random vector (not an expression, the vector is immediately evaluated).
+ *
+ * The parameter \a size is the size of the returned vector.
+ * Must be compatible with this MatrixBase type.
+ *
+ * \only_for_vectors
+ *
+ * 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
+ * instead.
+ *
+ * Example: \include MatrixBase_random_int.cpp
+ * Output: \verbinclude MatrixBase_random_int.out
+ *
+ * \sa random(), random(int,int)
+ */
template<typename Scalar, typename Derived>
const Eval<Random<Derived> > MatrixBase<Scalar, Derived>::random(int size)
{
@@ -73,6 +109,17 @@ const Eval<Random<Derived> > MatrixBase<Scalar, Derived>::random(int size)
else return Random<Derived>(size, 1).eval();
}
+/** \returns a fixed-size random matrix or vector
+ * (not an expression, the matrix is immediately evaluated).
+ *
+ * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
+ * need to use the variants taking size arguments.
+ *
+ * Example: \include MatrixBase_random.cpp
+ * Output: \verbinclude MatrixBase_random.out
+ *
+ * \sa random(int), random(int,int)
+ */
template<typename Scalar, typename Derived>
const Eval<Random<Derived> > MatrixBase<Scalar, Derived>::random()
{