11#ifndef __fft_interpolate_h
12#define __fft_interpolate_h
23 void interpolate (std::complex<float>* dest,
unsigned n_dest,
const std::complex<float>* src,
unsigned n_src);
27 void interpolate (std::vector<T>& out,
const std::vector<T>& in,
bool verbose =
false)
29 if (in.size() >= out.size())
30 throw Error (InvalidParam,
"fft::interpolate",
31 "in.size=%d >= out.size=%d. just scrunch",
32 in.size() >= out.size());
34 std::vector< std::complex<float> > dom1 (in.size());
35 std::vector< std::complex<float> > dom2 (out.size());
37 DatumTraits<T> datum_traits;
39 unsigned ndim = datum_traits.ndim();
41 std::cerr <<
"fft::interpolate ndim=" << ndim <<
" in.size=" << in.size() <<
" out.size=" << out.size() << std::endl;
46 for (
unsigned idim=0; idim<ndim; idim++)
48 for (ipt=0; ipt < in.size(); ipt++)
49 dom1[ipt] = datum_traits.element (in[ipt], idim);
51 interpolate (dom2.data(), dom2.size(), dom1.data(), dom1.size());
53 for (ipt=0; ipt < out.size(); ipt++)
54 datum_traits.element (out[ipt], idim) = datum_traits.
element_traits.from_complex (dom2[ipt]);
E element_traits
Definition Traits.h:73