Commit 5331805d authored by Martin Reinecke's avatar Martin Reinecke

polishing

parent d6c1f716
...@@ -2225,13 +2225,13 @@ template<typename T> void pocketfft_general_hartley(const shape_t &shape, ...@@ -2225,13 +2225,13 @@ template<typename T> void pocketfft_general_hartley(const shape_t &shape,
plan->forward((T *)tdata, fct); plan->forward((T *)tdata, fct);
// Hartley order // Hartley order
data_out[it_out.offset()] = tdata[0]; data_out[it_out.offset()] = tdata[0];
size_t i=1, i1=1, i2=it_out.length()-1; size_t i=1, i1=1, i2=len()-1;
for (i=1; i<len-1; i+=2, ++i1, --i2) for (i=1; i<len-1; i+=2, ++i1, --i2)
{ {
data_out[it_out.offset()+i1*s_o] = tdata[i]+tdata[i+1]; data_out[it_out.offset()+i1*s_o] = tdata[i]+tdata[i+1];
data_out[it_out.offset()+i2*s_o] = tdata[i]-tdata[i+1]; data_out[it_out.offset()+i2*s_o] = tdata[i]-tdata[i+1];
} }
if (i<it_out.length()) if (i<len)
data_out[it_out.offset()+i1*s_o] = tdata[i]; data_out[it_out.offset()+i1*s_o] = tdata[i];
it_in.advance(); it_in.advance();
it_out.advance(); it_out.advance();
...@@ -2269,13 +2269,13 @@ template<typename T> void pocketfft_general_r2c(const shape_t &shape, ...@@ -2269,13 +2269,13 @@ template<typename T> void pocketfft_general_r2c(const shape_t &shape,
plan.forward((vtype *)tdatav, fct); plan.forward((vtype *)tdatav, fct);
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
data_out[p_o[j]].Set(tdatav[0][j]); data_out[p_o[j]].Set(tdatav[0][j]);
size_t i; size_t i=1, ii=1;
for (i=1; i<len-1; i+=2) for (; i<len-1; i+=2, ++ii)
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
data_out[p_o[j]+((i+1)/2)*s_o].Set(tdatav[i][j], tdatav[i+1][j]); data_out[p_o[j]+ii*s_o].Set(tdatav[i][j], tdatav[i+1][j]);
if (i<len) if (i<len)
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
data_out[p_o[j]+((i+1)/2)*s_o].Set(tdatav[i][j]); data_out[p_o[j]+ii*s_o].Set(tdatav[i][j]);
} }
while (it_in.remaining()>0) while (it_in.remaining()>0)
{ {
...@@ -2285,11 +2285,11 @@ template<typename T> void pocketfft_general_r2c(const shape_t &shape, ...@@ -2285,11 +2285,11 @@ template<typename T> void pocketfft_general_r2c(const shape_t &shape,
tdata[i] = d_i[i*s_i]; tdata[i] = d_i[i*s_i];
plan.forward(tdata, fct); plan.forward(tdata, fct);
d_o[0].Set(tdata[0]); d_o[0].Set(tdata[0]);
size_t i; size_t i=1, ii=1;
for (i=1; i<len-1; i+=2) for (; i<len-1; i+=2, ++ii)
d_o[((i+1)/2)*s_o].Set(tdata[i], tdata[i+1]); d_o[ii*s_o].Set(tdata[i], tdata[i+1]);
if (i<len) if (i<len)
d_o[((i+1)/2)*s_o].Set(tdata[i]); d_o[ii*s_o].Set(tdata[i]);
it_in.advance(); it_in.advance();
it_out.advance(); it_out.advance();
} }
...@@ -2315,16 +2315,16 @@ template<typename T> void pocketfft_general_c2r(const shape_t &shape_out, ...@@ -2315,16 +2315,16 @@ template<typename T> void pocketfft_general_c2r(const shape_t &shape_out,
multioffset<vlen> p_i(it_in), p_o(it_out); multioffset<vlen> p_i(it_in), p_o(it_out);
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
tdatav[0][j]=data_in[p_i[j]].r; tdatav[0][j]=data_in[p_i[j]].r;
size_t i; size_t i=1, ii=1;
for (i=1; i<len-1; i+=2) for (; i<len-1; i+=2, ++ii)
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
{ {
tdatav[i][j] = data_in[p_i[j]+((i+1)/2)*s_i].r; tdatav[i][j] = data_in[p_i[j]+ii*s_i].r;
tdatav[i+1][j] = data_in[p_i[j]+((i+1)/2)*s_i].i; tdatav[i+1][j] = data_in[p_i[j]+ii*s_i].i;
} }
if (i<len) if (i<len)
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
tdatav[i][j] = data_in[p_i[j]+((i+1)/2)*s_i].r; tdatav[i][j] = data_in[p_i[j]+ii*s_i].r;
plan.backward(tdatav, fct); plan.backward(tdatav, fct);
for (size_t i=0; i<len; ++i) for (size_t i=0; i<len; ++i)
for (size_t j=0; j<vlen; ++j) for (size_t j=0; j<vlen; ++j)
...@@ -2335,15 +2335,14 @@ template<typename T> void pocketfft_general_c2r(const shape_t &shape_out, ...@@ -2335,15 +2335,14 @@ template<typename T> void pocketfft_general_c2r(const shape_t &shape_out,
const cmplx<T> *d_i = data_in+it_in.offset(); const cmplx<T> *d_i = data_in+it_in.offset();
T *d_o = data_out+it_out.offset(); T *d_o = data_out+it_out.offset();
tdata[0]=d_i[0].r; tdata[0]=d_i[0].r;
size_t i; size_t i=1, ii=1;
for (i=1; i<len-1; i+=2) for (; i<len-1; i+=2, ++ii)
{ {
size_t ii = (i+1)/2;
tdata[i] = d_i[ii*s_i].r; tdata[i] = d_i[ii*s_i].r;
tdata[i+1] = d_i[ii*s_i].i; tdata[i+1] = d_i[ii*s_i].i;
} }
if (i<len) if (i<len)
tdata[i] = d_i[((i+1)/2)*s_i].r; tdata[i] = d_i[ii*s_i].r;
plan.backward(tdata, fct); plan.backward(tdata, fct);
for (size_t i=0; i<len; ++i) for (size_t i=0; i<len; ++i)
d_o[i*s_o] = tdata[i]; d_o[i*s_o] = tdata[i];
...@@ -2581,7 +2580,7 @@ axes : list of integers ...@@ -2581,7 +2580,7 @@ axes : list of integers
fct : float fct : float
Normalization factor Normalization factor
inplace : bool inplace : bool
if False, returns the esult in a new array and leaves the input unchanged. if False, returns the result in a new array and leaves the input unchanged.
if True, stores the result in the input array and returns a handle to it. if True, stores the result in the input array and returns a handle to it.
Returns Returns
...@@ -2602,7 +2601,7 @@ axes : list of integers ...@@ -2602,7 +2601,7 @@ axes : list of integers
fct : float fct : float
Normalization factor Normalization factor
inplace : bool inplace : bool
if False, returns the esult in a new array and leaves the input unchanged. if False, returns the result in a new array and leaves the input unchanged.
if True, stores the result in the input array and returns a handle to it. if True, stores the result in the input array and returns a handle to it.
Returns Returns
...@@ -2668,7 +2667,7 @@ axes : list of integers ...@@ -2668,7 +2667,7 @@ axes : list of integers
fct : float fct : float
Normalization factor Normalization factor
inplace : bool inplace : bool
if False, returns the esult in a new array and leaves the input unchanged. if False, returns the result in a new array and leaves the input unchanged.
if True, stores the result in the input array and returns a handle to it. if True, stores the result in the input array and returns a handle to it.
Returns Returns
......
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