5 template<
unsigned int Nunmod,
class Unmod,
unsigned int Nsum,
class Sum,
bool Magn>
12 TinyVector<int,Nsum+Nunmod> inshape(indata.shape());
14 TinyVector<int,Nsum> sumshape;
15 for(
int i=0; i<int(Nsum); i++) sumshape(i)=inshape(i);
17 TinyVector<int,Nunmod> outshape;
18 for(
int i=0; i<int(Nunmod); i++) outshape(i)=inshape(Nsum+i);
20 ODINLOG(odinlog,normalDebug) <<
"indata.shape()/outshape/sumshape=" << indata.shape() <<
"/" << outshape <<
"/" << sumshape << STD_endl;
23 TinyVector<int,Nsum+Nunmod> outshape_padded=1;
24 for(
unsigned int i=0; i<Nunmod; i++) outshape_padded(Nsum+i)=outshape(i);
29 TinyVector<int,Nsum+Nunmod> lowin=0;
30 TinyVector<int,Nsum+Nunmod> uppin=outshape_padded-1;
32 TinyVector<int,Nsum+Nunmod> lowout=0;
33 TinyVector<int,Nsum+Nunmod> uppout=outshape_padded-1;
36 RectDomain<Nsum+Nunmod> outdomain(lowout,uppout);
40 for(
int isum=0; isum<product(sumshape); isum++) {
43 TinyVector<int,Nsum> sumindex=index2extent(sumshape, isum);
46 for(
unsigned int i=0; i<Nsum; i++) lowin(i)=uppin(i)=sumindex(i);
49 RectDomain<Nsum+Nunmod> indomain(lowin,uppin);
51 if(Magn) outdata_padded(outdomain)+=float2real(cabs(indata(indomain)));
52 else outdata_padded(outdomain)+=indata(indomain);
56 outdata_padded.convert_to(outdata);
59 ODINLOG(odinlog,normalDebug) <<
" outshape=" << outshape << STD_endl;
61 modify_coord(rd.
coord());
63 if(Magn) rd.
mode=RecoData::real_data;
65 if(!execute_next_step(rd,controller))
return false;
ComplexData< 1 > & data(Rank< 1 >) const
averagesum, cyclesum, repmagnsum, repsum: Sum up data in one or more dimensions