diff options
Diffstat (limited to 'bench/vdw_new.cpp')
-rw-r--r-- | bench/vdw_new.cpp | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/bench/vdw_new.cpp b/bench/vdw_new.cpp index b1237c4c7..a1bd422ae 100644 --- a/bench/vdw_new.cpp +++ b/bench/vdw_new.cpp @@ -1,35 +1,5 @@ -#include <Eigen/Core> +#include <Eigen/Array> -namespace Eigen { - -template<typename Scalar> struct pow12_op EIGEN_EMPTY_STRUCT { - inline const Scalar operator() (const Scalar& a) const - { - Scalar b = a*a*a; - Scalar c = b*b; - return c*c; - } - template<typename PacketScalar> - inline const PacketScalar packetOp(const PacketScalar& a) const - { - PacketScalar b = ei_pmul(a, ei_pmul(a, a)); - PacketScalar c = ei_pmul(b, b); - return ei_pmul(c, c); - } -}; - -template<typename Scalar> -struct ei_functor_traits<pow12_op<Scalar> > -{ - enum { - Cost = 4 * NumTraits<Scalar>::MulCost, - PacketAccess = int(ei_packet_traits<Scalar>::size) > 1 - }; -}; - -} // namespace Eigen - -using Eigen::pow12_op; USING_PART_OF_NAMESPACE_EIGEN #ifndef SCALAR @@ -50,9 +20,10 @@ using namespace std; SCALAR E_VDW(const Vec &interactions1, const Vec &interactions2) { - return interactions2 - .cwiseQuotient(interactions1) - .cwise(pow12_op<SCALAR>()) + return (interactions2.cwise()/interactions1) + .cwise().cube() + .cwise().square() + .cwise().square() .sum(); } |