diff options
author | 2010-03-18 20:11:38 -0400 | |
---|---|---|
committer | 2010-03-18 20:11:38 -0400 | |
commit | 9dba86df0b5c1d28a18666003a10f53e59154904 (patch) | |
tree | 761906f4de819abf661ce4ff3e2bb7b5041894f8 /Eigen/src/Core/CwiseBinaryOp.h | |
parent | 74a7c5caeeb6631ddd9d97a0832d80f35e888600 (diff) | |
parent | 089bd8951211f8771cfc0a8143812c4fb0aaeb4e (diff) |
merge
Diffstat (limited to 'Eigen/src/Core/CwiseBinaryOp.h')
-rw-r--r-- | Eigen/src/Core/CwiseBinaryOp.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 9ed005dce..df13d3aad 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -121,8 +121,20 @@ class CwiseBinaryOp : ei_no_assignment_operator, ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); } - EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); } + EIGEN_STRONG_INLINE int rows() const { + // return the fixed size type if available to enable compile time optimizations + if (ei_traits<typename ei_cleantype<LhsNested>::type>::RowsAtCompileTime==Dynamic) + return m_rhs.rows(); + else + return m_lhs.rows(); + } + EIGEN_STRONG_INLINE int cols() const { + // return the fixed size type if available to enable compile time optimizations + if (ei_traits<typename ei_cleantype<LhsNested>::type>::ColsAtCompileTime==Dynamic) + return m_rhs.cols(); + else + return m_lhs.cols(); + } /** \returns the left hand side nested expression */ const _LhsNested& lhs() const { return m_lhs; } |