* Make ReturnByValue have the EvalBeforeAssigningBit and explicitly

enforce this mechanism (otherwise ReturnByValue bypasses it).
 (use .noalias() to get the old behavior.)
* Remove a hack in Inverse, futile optimization for 2x2 expressions.
This commit is contained in:
Benoit Jacob
2010-05-30 13:43:08 -04:00
parent 48b8ace517
commit 641d968a9a
4 changed files with 21 additions and 23 deletions

View File

@@ -281,15 +281,9 @@ struct ei_traits<ei_inverse_impl<MatrixType> >
template<typename MatrixType>
struct ei_inverse_impl : public ReturnByValue<ei_inverse_impl<MatrixType> >
{
// for 2x2, it's worth giving a chance to avoid evaluating.
// for larger sizes, evaluating has negligible cost, limits code size,
// and allows for vectorized paths.
typedef typename ei_meta_if<
MatrixType::RowsAtCompileTime == 2,
typename ei_nested<MatrixType,2>::type,
typename ei_eval<MatrixType>::type
>::ret MatrixTypeNested;
typedef typename MatrixType::Nested MatrixTypeNested;
typedef typename ei_cleantype<MatrixTypeNested>::type MatrixTypeNestedCleaned;
const MatrixTypeNested m_matrix;
ei_inverse_impl(const MatrixType& matrix)
@@ -359,14 +353,7 @@ inline void MatrixBase<Derived>::computeInverseAndDetWithCheck(
{
// i'd love to put some static assertions there, but SFINAE means that they have no effect...
ei_assert(rows() == cols());
// for 2x2, it's worth giving a chance to avoid evaluating.
// for larger sizes, evaluating has negligible cost and limits code size.
typedef typename ei_meta_if<
RowsAtCompileTime == 2,
typename ei_cleantype<typename ei_nested<Derived, 2>::type>::type,
PlainObject
>::ret MatrixType;
ei_compute_inverse_and_det_with_check<MatrixType, ResultType>::run
ei_compute_inverse_and_det_with_check<PlainObject, ResultType>::run
(derived(), absDeterminantThreshold, inverse, determinant, invertible);
}