Commit 5361953a authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'tweaks_for_older_compilers' into 'master'

replace reduce by accumulate

See merge request mtr/cxxbase!11
parents 5fedd515 a7763eac
......@@ -122,7 +122,7 @@ class fmav_info
public:
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()==str.size(), "dimensions mismatch");
......@@ -184,7 +184,7 @@ template<size_t ndim> class mav_info
public:
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(shape_, shape2stride(shape_)) {}
size_t size() const { return sz; }
......
......@@ -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,
complex<double> * MRUTIL_RESTRICT cc)
{
cc[0] += complex<double>(reduce(a,std::plus<>()),reduce(b,std::plus<>()));
cc[1] += complex<double>(reduce(c,std::plus<>()),reduce(d,std::plus<>()));
cc[0] += complex<double>(accumulate(a,std::plus<>()),accumulate(b,std::plus<>()));
cc[1] += complex<double>(accumulate(c,std::plus<>()),accumulate(d,std::plus<>()));
}
#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