mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-03 11:45:12 +08:00
Propagate fixed size dimensions if available (on MSVC it leads >2.5x speedup for some reductions).
This commit is contained in:
parent
3e08c22028
commit
b9644f3323
@ -121,8 +121,20 @@ class CwiseBinaryOp : ei_no_assignment_operator,
|
|||||||
ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); }
|
EIGEN_STRONG_INLINE int rows() const {
|
||||||
EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); }
|
// return the fixed size type if available to enable compile time optimizations
|
||||||
|
if (ei_traits<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<ei_cleantype<LhsNested>::type>::ColsAtCompileTime==Dynamic)
|
||||||
|
return m_rhs.cols();
|
||||||
|
else
|
||||||
|
return m_lhs.cols();
|
||||||
|
}
|
||||||
|
|
||||||
/** \returns the left hand side nested expression */
|
/** \returns the left hand side nested expression */
|
||||||
const _LhsNested& lhs() const { return m_lhs; }
|
const _LhsNested& lhs() const { return m_lhs; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user