[eigen] Problem with fft and custom allocator |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hello, I am using the FFT of eigen, however with a custom allocator. The custom one is based on the code from Nicolai M. Josuttis http://www.josuttis.com/libbook/memory/myalloc.hpp.html with fftw_malloc and fftw_free instead of new and delete. The class is called fftalloc. This simple code however fails: std::vector<complex<double>,fftalloc<complex<double> > > data(N); std::vector<complex<double>,fftalloc<complex<double> > > dataFourier(N); FFT<double> fft; fft.fwd(dataFourier, data); It gives me template errors (mingw 4.92 32 bit), because no match was found basically because cannot convert 'dataFourier' (type 'std::vector<std::complex<double>, fftwcpp::fftalloc<std::complex<double> > >') to type 'std::vector<std::complex<double>, std::allocator<std::complex<double> > >&' The template code provided by EIGEN::FFT is template <typename _Input> inline void fwd( std::vector<Complex> & dst, const std::vector<_Input > & src) { if ( NumTraits<_Input>::IsComplex == 0 && HasFlag(HalfSpectrum) ) dst.resize( (src.size()>>1)+1); // half the bins + fft.fwd(dataFourier, data); ^ ..\..\fftwcpp\src\main.cpp:37:34: note: candidates are: In file included from ..\..\fftwcpp\src\main.cpp:3:0: ..\..\fftwcpp\src\fftwcpp.h:152:10: note: void FFT<T_Scalar, T_Impl>::fwd(FFT<T_Scalar, T_Impl>::Complex*, const Scalar*, FFT<T_Scalar, T_Impl>::Index) [with T_Scalar = double; T_Impl = default_fft_impl<double>; FFT<T_Scalar, T_Impl>::Complex = std::complex<double>; FFT<T_Scalar, T_Impl>::Scalar = double; FFT<T_Scalar, T_Impl>::Index = int] void fwd( Complex * dst, const Scalar * src, Index nfft) ^ ..\..\fftwcpp\src\fftwcpp.h:152:10: note: candidate expects 3 arguments, 2 provided ..\..\fftwcpp\src\fftwcpp.h:161:10: note: void FFT<T_Scalar, T_Impl>::fwd(FFT<T_Scalar, T_Impl>::Complex*, const Complex*, FFT<T_Scalar, T_Impl>::Index) [with T_Scalar = double; T_Impl = default_fft_impl<double>; FFT<T_Scalar, T_Impl>::Complex = std::complex<double>; FFT<T_Scalar, T_Impl>::Index = int] void fwd( Complex * dst, const Complex * src, Index nfft) ^ ..\..\fftwcpp\src\fftwcpp.h:161:10: note: candidate expects 3 arguments, 2 provided ..\..\fftwcpp\src\fftwcpp.h:177:10: note: template<class _Input> void FFT<T_Scalar, T_Impl>::fwd(std::vector<typename T_Impl::Complex>&, const std::vector<_Input>&) [with _Input = _Input; T_Scalar = double; T_Impl = default_fft_impl<double>] void fwd( std::vector<Complex> & dst, const std::vector<_Input> & src) ^ ..\..\fftwcpp\src\fftwcpp.h:177:10: note: template argument deduction/substitution failed: ..\..\fftwcpp\src\main.cpp:37:34: note: cannot convert 'dataFourier' (type 'std::vector<std::complex<double>, fftwcpp::fftalloc<std::complex<double> > >') to type 'std::vector<std::complex<double>, std::allocator<std::complex<double> > >&' fft.fwd(dataFourier, data);
BTW: I plan to upload the code to github once it compiles and is in principle useable. Matthias |
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |