From 249dc4f482f0427af3cb1e53b7a2ff4bbe6b54cf Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 3 Apr 2008 16:54:19 +0000 Subject: 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 --- Eigen/src/Core/Random.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Eigen/src/Core/Random.h') 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 > ColsAtCompileTime = ei_traits::ColsAtCompileTime, MaxRowsAtCompileTime = ei_traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = ei_traits::MaxColsAtCompileTime, - Flags = ei_traits::Flags, + Flags = ei_traits::Flags | EvalBeforeNestingBit, CoeffReadCost = 2 * NumTraits::MulCost // FIXME: arbitrary value }; }; @@ -93,10 +93,10 @@ template class Random : ei_no_assignment_operator, * \sa ei_random(), ei_random(int) */ template -const typename ei_eval_unless_lazy >::type +const Random MatrixBase::random(int rows, int cols) { - return Random(rows, cols).eval(); + return Random(rows, cols); } /** \returns a random vector (not an expression, the vector is immediately evaluated). @@ -116,12 +116,12 @@ MatrixBase::random(int rows, int cols) * \sa ei_random(), ei_random(int,int) */ template -const typename ei_eval_unless_lazy >::type +const Random MatrixBase::random(int size) { ei_assert(IsVectorAtCompileTime); - if(RowsAtCompileTime == 1) return Random(1, size).eval(); - else return Random(size, 1).eval(); + if(RowsAtCompileTime == 1) return Random(1, size); + else return Random(size, 1); } /** \returns a fixed-size random matrix or vector @@ -136,10 +136,10 @@ MatrixBase::random(int size) * \sa ei_random(int), ei_random(int,int) */ template -const typename ei_eval_unless_lazy >::type +const Random MatrixBase::random() { - return Random(RowsAtCompileTime, ColsAtCompileTime).eval(); + return Random(RowsAtCompileTime, ColsAtCompileTime); } /** Sets all coefficients in this expression to random values. -- cgit v1.2.3