Skip to content

Commit ba2ded9

Browse files
committed
...
1 parent 2dbb56d commit ba2ded9

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

hydra/Convolution.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,17 @@ convolute(detail::BackendPolicy<BACKEND> policy, detail::FFTPolicy<T, FFTBackend
128128
hydra_thrust::transform( policy, ffts.begin(), ffts.end(),
129129
complex_buffer.first, detail::convolution::MultiplyFFT<T>());
130130

131-
std::cout<<"fft_functor_range :"<< fft_functor_range.size() <<std::endl;
132-
std::cout<<"fft_kernel_range :" << fft_kernel_range.size() <<std::endl;
133-
std::cout<<"complex_buffer :"<< complex_buffer.second<<std::endl;
134131

135132
//transform product back to real
136133

137-
auto fft_product = _ComplexToRealFFT( complex_buffer.second );
134+
auto fft_product = _ComplexToRealFFT( 2*complex_buffer.second-2 );
138135

139136
fft_product.LoadInputData(complex_buffer.second, complex_buffer.first);
140137
fft_product.Execute();
141138

142139
auto fft_product_output = fft_product.GetOutputData();
143140

144-
T n = 2*nsamples;//*norm_factor;
141+
T n = 2*complex_buffer.second-2;
145142

146143
auto normalize_fft = detail::convolution::NormalizeFFT<T>(n);
147144

hydra/detail/fftw/BaseFFTW.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ class BaseFFTW
250250

251251
void LoadInput(int size, const InputType* data )
252252
{
253+
std::cout << "size "<< size<<std::endl;
254+
std::cout << "fNInput "<< fNInput<<std::endl;
255+
253256
assert(size <= fNInput);
254257
memcpy(&fInput.get()[0], data, sizeof(InputType)*size);
255258
memset(&fInput.get()[size], 0, sizeof(InputType)*( fNInput-size ));

hydra/detail/utility/MSB.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ inline typename std::enable_if<
5555
!(std::is_signed<Integer>::value) &&
5656
(std::numeric_limits<Integer>::digits==64)
5757
, unsigned>::type
58-
msb( Integer const& x){
58+
msb( Integer const x){
5959

6060
if(!x) return 64;
6161

@@ -73,17 +73,18 @@ msb( Integer const& x){
7373

7474
#else
7575

76+
Integer _x
7677
unsigned y;
7778
int n = 64;
7879

79-
y = x >>32; if (y != 0) {n = n -32; x = y;}
80-
y = x >>16; if (y != 0) {n = n -16; x = y;}
81-
y = x >> 8; if (y != 0) {n = n - 8; x = y;}
82-
y = x >> 4; if (y != 0) {n = n - 4; x = y;}
83-
y = x >> 2; if (y != 0) {n = n - 2; x = y;}
84-
y = x >> 1; if (y != 0) return n - 2;
80+
y = _x >>32; if (y != 0) {n = n -32; _x = y;}
81+
y = _x >>16; if (y != 0) {n = n -16; _x = y;}
82+
y = _x >> 8; if (y != 0) {n = n - 8; _x = y;}
83+
y = _x >> 4; if (y != 0) {n = n - 4; _x = y;}
84+
y = _x >> 2; if (y != 0) {n = n - 2; _x = y;}
85+
y = _x >> 1; if (y != 0) return n - 2;
8586

86-
return 63 - n - x;
87+
return 63 - n - _x;
8788

8889
#endif
8990
//device path will try to use
@@ -105,7 +106,7 @@ inline typename std::enable_if<
105106
!(std::is_signed<Integer>::value) &&
106107
(std::numeric_limits<Integer>::digits<=32)
107108
, unsigned>::type
108-
msb( Integer const& x){
109+
msb( Integer const x){
109110

110111
if(!x) return 32;
111112

@@ -126,12 +127,12 @@ msb( Integer const& x){
126127

127128
unsigned y;
128129
int n = 32;
129-
y = x >>16; if (y != 0) {n = n -16; x = y;}
130-
y = x >> 8; if (y != 0) {n = n - 8; x = y;}
131-
y = x >> 4; if (y != 0) {n = n - 4; x = y;}
132-
y = x >> 2; if (y != 0) {n = n - 2; x = y;}
133-
y = x >> 1; if (y != 0) return n - 2;
134-
return 31 - n - x;
130+
y = _x >>16; if (y != 0) {n = n -16; _x = y;}
131+
y = _x >> 8; if (y != 0) {n = n - 8; _x = y;}
132+
y = _x >> 4; if (y != 0) {n = n - 4; _x = y;}
133+
y = _x >> 2; if (y != 0) {n = n - 2; _x = y;}
134+
y = _x >> 1; if (y != 0) return n - 2;
135+
return 31 - n - _x;
135136

136137
#endif
137138
#else

0 commit comments

Comments
 (0)