aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Random.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-03-12 17:17:36 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-03-12 17:17:36 +0000
commit2ee68a074efc1163358fb3b51fb4b23e83a05f97 (patch)
tree48df581770a55f8eb9f632aee54c777816478b64 /Eigen/src/Core/Random.h
parent01572b9f54e769a7d1bb3d5073c264a5fbc7ce42 (diff)
generalized ei_traits<>.
Finally the importing macro is named EIGEN_BASIC_PUBLIC_INTERFACE because it does not only import the ei_traits, it also makes the base class a friend, etc.
Diffstat (limited to 'Eigen/src/Core/Random.h')
-rw-r--r--Eigen/src/Core/Random.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index 364b8f4ed..1c2154b43 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -33,25 +33,23 @@
* MatrixBase::setRandom()
*/
template<typename MatrixType>
-struct Scalar<Random<MatrixType> >
-{ typedef typename Scalar<MatrixType>::Type Type; };
+struct ei_traits<Random<MatrixType> >
+{
+ typedef typename MatrixType::Scalar Scalar;
+ enum {
+ RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime,
+ MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
+ };
+};
template<typename MatrixType> class Random : NoOperatorEquals,
public MatrixBase<Random<MatrixType> >
{
public:
- typedef typename MatrixType::Scalar Scalar;
- friend class MatrixBase<Random>;
- friend class MatrixBase<Random>::Traits;
- typedef MatrixBase<Random> Base;
- private:
- enum {
- RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
- MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
- };
+ EIGEN_BASIC_PUBLIC_INTERFACE(Random)
const Random& _asArg() const { return *this; }
int _rows() const { return m_rows.value(); }
@@ -117,8 +115,8 @@ template<typename Derived>
const Eval<Random<Derived> >
MatrixBase<Derived>::random(int size)
{
- assert(Traits::IsVectorAtCompileTime);
- if(Traits::RowsAtCompileTime == 1) return Random<Derived>(1, size).eval();
+ assert(IsVectorAtCompileTime);
+ if(RowsAtCompileTime == 1) return Random<Derived>(1, size).eval();
else return Random<Derived>(size, 1).eval();
}
@@ -137,7 +135,7 @@ template<typename Derived>
const Eval<Random<Derived> >
MatrixBase<Derived>::random()
{
- return Random<Derived>(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime).eval();
+ return Random<Derived>(RowsAtCompileTime, ColsAtCompileTime).eval();
}
/** Sets all coefficients in this expression to random values.