Commit a7763eac authored by Martin Reinecke's avatar Martin Reinecke
Browse files

replace reduce by accumulate

parent fd7a243c
...@@ -122,7 +122,7 @@ class fmav_info ...@@ -122,7 +122,7 @@ class fmav_info
public: public:
fmav_info(const shape_t &shape_, const stride_t &stride_) fmav_info(const shape_t &shape_, const stride_t &stride_)
: shp(shape_), str(stride_), sz(reduce(shp.begin(),shp.end(),size_t(1),multiplies<>())) : shp(shape_), str(stride_), sz(accumulate(shp.begin(),shp.end(),size_t(1),multiplies<>()))
{ {
MR_assert(shp.size()>0, "at least 1D required"); MR_assert(shp.size()>0, "at least 1D required");
MR_assert(shp.size()==str.size(), "dimensions mismatch"); MR_assert(shp.size()==str.size(), "dimensions mismatch");
...@@ -184,7 +184,7 @@ template<size_t ndim> class mav_info ...@@ -184,7 +184,7 @@ template<size_t ndim> class mav_info
public: public:
mav_info(const shape_t &shape_, const stride_t &stride_) mav_info(const shape_t &shape_, const stride_t &stride_)
: shp(shape_), str(stride_), sz(reduce(shp.begin(),shp.end(),size_t(1),multiplies<>())) {} : shp(shape_), str(stride_), sz(accumulate(shp.begin(),shp.end(),size_t(1),multiplies<>())) {}
mav_info(const shape_t &shape_) mav_info(const shape_t &shape_)
: mav_info(shape_, shape2stride(shape_)) {} : mav_info(shape_, shape2stride(shape_)) {}
size_t size() const { return sz; } size_t size() const { return sz; }
......
...@@ -78,8 +78,8 @@ static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d, ...@@ -78,8 +78,8 @@ static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d,
static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d, static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d,
complex<double> * MRUTIL_RESTRICT cc) complex<double> * MRUTIL_RESTRICT cc)
{ {
cc[0] += complex<double>(reduce(a,std::plus<>()),reduce(b,std::plus<>())); cc[0] += complex<double>(accumulate(a,std::plus<>()),accumulate(b,std::plus<>()));
cc[1] += complex<double>(reduce(c,std::plus<>()),reduce(d,std::plus<>())); cc[1] += complex<double>(accumulate(c,std::plus<>()),accumulate(d,std::plus<>()));
} }
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment