mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
-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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user