From c69d0d08d0d71c779a245babe80342f0cf1ea985 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 18 Feb 2019 14:43:07 +0100 Subject: Set cost of conjugate to 0 (in practice it boils down to a no-op). This is also important to make sure that A.conjugate() * B.conjugate() does not evaluate its arguments into temporaries (e.g., if A and B are fixed and small, or * fall back to lazyProduct) --- Eigen/src/Core/functors/UnaryFunctors.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Eigen/src/Core/functors') diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index 55994047e..1d5eb3678 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h @@ -117,7 +117,15 @@ template struct functor_traits > { enum { - Cost = NumTraits::IsComplex ? NumTraits::AddCost : 0, + Cost = 0, + // Yes the cost is zero even for complexes because in most cases for which + // the cost is used, conjugation turns to be a no-op. Some examples: + // cost(a*conj(b)) == cost(a*b) + // cost(a+conj(b)) == cost(a+b) + // ::HasConj }; }; -- cgit v1.2.3