lib/gs2crmod/gsl_tools.rb in gs2crmod-0.11.26 vs lib/gs2crmod/gsl_tools.rb in gs2crmod-0.11.27

- old
+ new

@@ -83,9 +83,25 @@ end gm = gm / rows if normalise gm end + def backward_rows_c2c(normalise = false) + gm = self.dup + rows, cols = gm.shape + table = GSL.cache[[:fft_table, :complex, cols]] ||= GSL::FFT::ComplexWavetable.alloc(cols) + work = GSL.cache[[:fft_work, :complex, cols]] ||= GSL::FFT::ComplexWorkspace.alloc(cols) + for i in 0...rows + vec = gm.row(i) + vec.backward!(table, work) + for j in 0...cols + gm[i,j] = vec[j] + end + end + gm = gm / cols if normalise + gm + end + def forward_cols_c2c gm = self.dup rows, cols = gm.shape table = GSL.cache[[:fft_table, :complex, rows]] ||= GSL::FFT::ComplexWavetable.alloc(rows) work = GSL.cache[[:fft_work, :complex, rows]] ||= GSL::FFT::ComplexWorkspace.alloc(rows)