20 using namespace Eigen;
34 T mag2(
const std::vector<T> & vec)
37 for (
size_t k=0;k<vec.size();++k)
43 T mag2(
const std::vector<std::complex<T> > & vec)
46 for (
size_t k=0;k<vec.size();++k)
52 vector<T>
operator-(
const vector<T> & a,
const vector<T> &
b )
55 for (
size_t k=0;k<
b.size();++k)
63 for (
size_t k=0;k<vec.size();++k)
64 vec[k] =
T( rand() )/
T(RAND_MAX) -
T(.5);
70 for (
size_t k=0;k<vec.size();++k)
71 vec[k] = std::complex<T> (
T( rand() )/
T(RAND_MAX) -
T(.5),
T( rand() )/
T(RAND_MAX) -
T(.5));
74 template <
typename T_time,
typename T_freq>
78 vector<T_time> timebuf(nfft);
81 vector<T_freq> freqbuf;
83 fft.
fwd(freqbuf,timebuf);
85 vector<T_time> timebuf2;
86 fft.
inv(timebuf2,freqbuf);
88 T_time rmse =
mag2(timebuf - timebuf2) /
mag2(timebuf);
89 cout <<
"roundtrip rmse: " << rmse << endl;
92 template <
typename T_scalar>
96 fwd_inv<T_scalar,std::complex<T_scalar> >(nfft);
98 fwd_inv<std::complex<T_scalar>,std::complex<T_scalar> >(nfft);
103 cout <<
"nfft=" << nfft << endl;
104 cout <<
" float" << endl;
105 two_demos<float>(nfft);
106 cout <<
" double" << endl;
107 two_demos<double>(nfft);
108 cout <<
" long double" << endl;
109 two_demos<long double>(nfft);
vector< T > operator-(const vector< T > &a, const vector< T > &b)
void fwd_inv(size_t nfft)
void demo_all_types(int nfft)
void RandomFill(std::vector< T > &vec)
void fwd(Complex *dst, const Scalar *src, Index nfft)
fft_inv_proxy< MatrixBase< InputDerived >, FFT< T_Scalar, T_Impl > > inv(const MatrixBase< InputDerived > &src, Index nfft=-1)
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend