aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Random.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-04-03 16:54:19 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-04-03 16:54:19 +0000
commit249dc4f482f0427af3cb1e53b7a2ff4bbe6b54cf (patch)
treedd0fb314154a6ea9da51acc8c252f7772f0ed368 /Eigen/src/Core/Random.h
parentb8900d0b80734c6cca25595e8613d47f1d48909f (diff)
current state of the mess. One line fails in the tests, and
useless copies are made when evaluating nested expressions. Changes: - kill LazyBit, introduce EvalBeforeNestingBit and EvalBeforeAssigningBit - product and random don't evaluate immediately anymore - eval() always evaluates - change the value of Dynamic to some large positive value, in preparation of future simplifications
Diffstat (limited to 'Eigen/src/Core/Random.h')
-rw-r--r--Eigen/src/Core/Random.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index 4bd482958..7ac3633fe 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -41,7 +41,7 @@ struct ei_traits<Random<MatrixType> >
ColsAtCompileTime = ei_traits<MatrixType>::ColsAtCompileTime,
MaxRowsAtCompileTime = ei_traits<MatrixType>::MaxRowsAtCompileTime,
MaxColsAtCompileTime = ei_traits<MatrixType>::MaxColsAtCompileTime,
- Flags = ei_traits<MatrixType>::Flags,
+ Flags = ei_traits<MatrixType>::Flags | EvalBeforeNestingBit,
CoeffReadCost = 2 * NumTraits<Scalar>::MulCost // FIXME: arbitrary value
};
};
@@ -93,10 +93,10 @@ template<typename MatrixType> class Random : ei_no_assignment_operator,
* \sa ei_random(), ei_random(int)
*/
template<typename Derived>
-const typename ei_eval_unless_lazy<Random<Derived> >::type
+const Random<Derived>
MatrixBase<Derived>::random(int rows, int cols)
{
- return Random<Derived>(rows, cols).eval();
+ return Random<Derived>(rows, cols);
}
/** \returns a random vector (not an expression, the vector is immediately evaluated).
@@ -116,12 +116,12 @@ MatrixBase<Derived>::random(int rows, int cols)
* \sa ei_random(), ei_random(int,int)
*/
template<typename Derived>
-const typename ei_eval_unless_lazy<Random<Derived> >::type
+const Random<Derived>
MatrixBase<Derived>::random(int size)
{
ei_assert(IsVectorAtCompileTime);
- if(RowsAtCompileTime == 1) return Random<Derived>(1, size).eval();
- else return Random<Derived>(size, 1).eval();
+ if(RowsAtCompileTime == 1) return Random<Derived>(1, size);
+ else return Random<Derived>(size, 1);
}
/** \returns a fixed-size random matrix or vector
@@ -136,10 +136,10 @@ MatrixBase<Derived>::random(int size)
* \sa ei_random(int), ei_random(int,int)
*/
template<typename Derived>
-const typename ei_eval_unless_lazy<Random<Derived> >::type
+const Random<Derived>
MatrixBase<Derived>::random()
{
- return Random<Derived>(RowsAtCompileTime, ColsAtCompileTime).eval();
+ return Random<Derived>(RowsAtCompileTime, ColsAtCompileTime);
}
/** Sets all coefficients in this expression to random values.