aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Random.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-13 19:55:23 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-13 19:55:23 +0000
commit89a134ba0b40b7cfc4554e3f06813fd32bbe2ede (patch)
tree2d0aa14b49b6b80802371f6bb5ac8ee6360d87d1 /Eigen/src/Core/Random.h
parente05a1aba1d83a7286e48576a053276c16633a7f1 (diff)
big architecture change dissociating "actual" dimensions from "maximum possible"
dimension. The advantage is that evaluating a dynamic-sized block in a fixed-size matrix no longer causes a dynamic memory allocation. Other new thing: IntAtRunTimeIfDynamic allows storing an integer at zero cost if it is known at compile time.
Diffstat (limited to 'Eigen/src/Core/Random.h')
-rw-r--r--Eigen/src/Core/Random.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index 6a8a9e726..0b6892d2e 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -43,12 +43,14 @@ template<typename MatrixType> class Random : NoOperatorEquals,
private:
enum {
RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime
+ ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
+ MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
};
const Random& _ref() const { return *this; }
- int _rows() const { return m_rows; }
- int _cols() const { return m_cols; }
+ int _rows() const { return m_rows.value(); }
+ int _cols() const { return m_cols.value(); }
Scalar _coeff(int, int) const
{
@@ -65,7 +67,8 @@ template<typename MatrixType> class Random : NoOperatorEquals,
}
protected:
- const int m_rows, m_cols;
+ const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows;
+ const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols;
};
/** \returns a random matrix (not an expression, the matrix is immediately evaluated).