diff options
author | 2016-06-14 11:29:06 +0200 | |
---|---|---|
committer | 2016-06-14 11:29:06 +0200 | |
commit | f5b1c7394537cc74978617383628c3b6b9399e57 (patch) | |
tree | 64f53f73433a67f5e5811ec2fc50fdd4434d97a0 /Eigen/src/Core/functors | |
parent | deb8306e60c53f052d1df16dce38a4b6c6c98aab (diff) |
Set cost of constant expression to 0 (the cost should be amortized through the expression)
Diffstat (limited to 'Eigen/src/Core/functors')
-rw-r--r-- | Eigen/src/Core/functors/NullaryFunctors.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Eigen/src/Core/functors/NullaryFunctors.h b/Eigen/src/Core/functors/NullaryFunctors.h index 78cc22277..eaa582f23 100644 --- a/Eigen/src/Core/functors/NullaryFunctors.h +++ b/Eigen/src/Core/functors/NullaryFunctors.h @@ -26,7 +26,8 @@ struct scalar_constant_op { }; template<typename Scalar> struct functor_traits<scalar_constant_op<Scalar> > -{ enum { Cost = 1, PacketAccess = packet_traits<Scalar>::Vectorizable, IsRepeatable = true }; }; +{ enum { Cost = 0 /* as the constant value should be loaded in register only once for the whole expression */, + PacketAccess = packet_traits<Scalar>::Vectorizable, IsRepeatable = true }; }; template<typename Scalar> struct scalar_identity_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_identity_op) |