24 T * fftw_cast(
const T* p)
26 return const_cast<T*
>( p);
30 fftw_complex * fftw_cast(
const std::complex<double> * p)
32 return const_cast<fftw_complex*
>(
reinterpret_cast<const fftw_complex*
>(p) );
36 fftwf_complex * fftw_cast(
const std::complex<float> * p)
38 return const_cast<fftwf_complex*
>(
reinterpret_cast<const fftwf_complex*
>(p) );
42 fftwl_complex * fftw_cast(
const std::complex<long double> * p)
44 return const_cast<fftwl_complex*
>(
reinterpret_cast<const fftwl_complex*
>(p) );
53 typedef float scalar_type;
54 typedef fftwf_complex complex_type;
57 ~
fftw_plan() {
if (m_plan) fftwf_destroy_plan(m_plan);}
60 void fwd(complex_type * dst,complex_type * src,
int nfft) {
61 if (m_plan==NULL) m_plan = fftwf_plan_dft_1d(nfft,src,dst, FFTW_FORWARD, FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
62 fftwf_execute_dft( m_plan, src,dst);
65 void inv(complex_type * dst,complex_type * src,
int nfft) {
66 if (m_plan==NULL) m_plan = fftwf_plan_dft_1d(nfft,src,dst, FFTW_BACKWARD , FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
67 fftwf_execute_dft( m_plan, src,dst);
70 void fwd(complex_type * dst,scalar_type * src,
int nfft) {
71 if (m_plan==NULL) m_plan = fftwf_plan_dft_r2c_1d(nfft,src,dst,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
72 fftwf_execute_dft_r2c( m_plan,src,dst);
75 void inv(scalar_type * dst,complex_type * src,
int nfft) {
77 m_plan = fftwf_plan_dft_c2r_1d(nfft,src,dst,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
78 fftwf_execute_dft_c2r( m_plan, src,dst);
82 void fwd2( complex_type * dst,complex_type * src,
int n0,
int n1) {
83 if (m_plan==NULL) m_plan = fftwf_plan_dft_2d(n0,n1,src,dst,FFTW_FORWARD,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
84 fftwf_execute_dft( m_plan, src,dst);
87 void inv2( complex_type * dst,complex_type * src,
int n0,
int n1) {
88 if (m_plan==NULL) m_plan = fftwf_plan_dft_2d(n0,n1,src,dst,FFTW_BACKWARD,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
89 fftwf_execute_dft( m_plan, src,dst);
96 typedef double scalar_type;
97 typedef fftw_complex complex_type;
100 ~
fftw_plan() {
if (m_plan) fftw_destroy_plan(m_plan);}
103 void fwd(complex_type * dst,complex_type * src,
int nfft) {
104 if (m_plan==NULL) m_plan = fftw_plan_dft_1d(nfft,src,dst, FFTW_FORWARD, FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
105 fftw_execute_dft( m_plan, src,dst);
108 void inv(complex_type * dst,complex_type * src,
int nfft) {
109 if (m_plan==NULL) m_plan = fftw_plan_dft_1d(nfft,src,dst, FFTW_BACKWARD , FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
110 fftw_execute_dft( m_plan, src,dst);
113 void fwd(complex_type * dst,scalar_type * src,
int nfft) {
114 if (m_plan==NULL) m_plan = fftw_plan_dft_r2c_1d(nfft,src,dst,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
115 fftw_execute_dft_r2c( m_plan,src,dst);
118 void inv(scalar_type * dst,complex_type * src,
int nfft) {
120 m_plan = fftw_plan_dft_c2r_1d(nfft,src,dst,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
121 fftw_execute_dft_c2r( m_plan, src,dst);
124 void fwd2( complex_type * dst,complex_type * src,
int n0,
int n1) {
125 if (m_plan==NULL) m_plan = fftw_plan_dft_2d(n0,n1,src,dst,FFTW_FORWARD,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
126 fftw_execute_dft( m_plan, src,dst);
129 void inv2( complex_type * dst,complex_type * src,
int n0,
int n1) {
130 if (m_plan==NULL) m_plan = fftw_plan_dft_2d(n0,n1,src,dst,FFTW_BACKWARD,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
131 fftw_execute_dft( m_plan, src,dst);
137 typedef long double scalar_type;
138 typedef fftwl_complex complex_type;
141 ~
fftw_plan() {
if (m_plan) fftwl_destroy_plan(m_plan);}
144 void fwd(complex_type * dst,complex_type * src,
int nfft) {
145 if (m_plan==NULL) m_plan = fftwl_plan_dft_1d(nfft,src,dst, FFTW_FORWARD, FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
146 fftwl_execute_dft( m_plan, src,dst);
149 void inv(complex_type * dst,complex_type * src,
int nfft) {
150 if (m_plan==NULL) m_plan = fftwl_plan_dft_1d(nfft,src,dst, FFTW_BACKWARD , FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
151 fftwl_execute_dft( m_plan, src,dst);
154 void fwd(complex_type * dst,scalar_type * src,
int nfft) {
155 if (m_plan==NULL) m_plan = fftwl_plan_dft_r2c_1d(nfft,src,dst,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
156 fftwl_execute_dft_r2c( m_plan,src,dst);
159 void inv(scalar_type * dst,complex_type * src,
int nfft) {
161 m_plan = fftwl_plan_dft_c2r_1d(nfft,src,dst,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
162 fftwl_execute_dft_c2r( m_plan, src,dst);
165 void fwd2( complex_type * dst,complex_type * src,
int n0,
int n1) {
166 if (m_plan==NULL) m_plan = fftwl_plan_dft_2d(n0,n1,src,dst,FFTW_FORWARD,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
167 fftwl_execute_dft( m_plan, src,dst);
170 void inv2( complex_type * dst,complex_type * src,
int n0,
int n1) {
171 if (m_plan==NULL) m_plan = fftwl_plan_dft_2d(n0,n1,src,dst,FFTW_BACKWARD,FFTW_ESTIMATE|FFTW_PRESERVE_INPUT);
172 fftwl_execute_dft( m_plan, src,dst);
176 template <
typename _Scalar>
180 typedef std::complex<Scalar> Complex;
190 void fwd( Complex * dst,
const Complex *src,
int nfft)
192 get_plan(nfft,
false,dst,src).fwd(fftw_cast(dst), fftw_cast(src),nfft );
197 void fwd( Complex * dst,
const Scalar * src,
int nfft)
199 get_plan(nfft,
false,dst,src).fwd(fftw_cast(dst), fftw_cast(src) ,nfft);
204 void fwd2(Complex * dst,
const Complex * src,
int n0,
int n1)
206 get_plan(n0,n1,
false,dst,src).fwd2(fftw_cast(dst), fftw_cast(src) ,n0,n1);
211 void inv(Complex * dst,
const Complex *src,
int nfft)
213 get_plan(nfft,
true,dst,src).inv(fftw_cast(dst), fftw_cast(src),nfft );
218 void inv( Scalar * dst,
const Complex * src,
int nfft)
220 get_plan(nfft,
true,dst,src).inv(fftw_cast(dst), fftw_cast(src),nfft );
225 void inv2(Complex * dst,
const Complex * src,
int n0,
int n1)
227 get_plan(n0,n1,
true,dst,src).inv2(fftw_cast(dst), fftw_cast(src) ,n0,n1);
234 typedef std::map<int64_t,PlanData> PlanMap;
239 PlanData & get_plan(
int nfft,
bool inverse,
void * dst,
const void * src)
241 bool inplace = (dst==src);
242 bool aligned = ( (
reinterpret_cast<size_t>(src)&15) | (
reinterpret_cast<size_t>(dst)&15) ) == 0;
243 int64_t key = ( (nfft<<3 ) | (inverse<<2) | (inplace<<1) | aligned ) << 1;
248 PlanData & get_plan(
int n0,
int n1,
bool inverse,
void * dst,
const void * src)
250 bool inplace = (dst==src);
251 bool aligned = ( (
reinterpret_cast<size_t>(src)&15) | (
reinterpret_cast<size_t>(dst)&15) ) == 0;
252 int64_t key = ( ( (((int64_t)n0) << 30)|(n1<<3 ) | (inverse<<2) | (inplace<<1) | aligned ) << 1 ) + 1;
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Definition: ei_fftw_impl.h:48
Definition: ei_fftw_impl.h:177
A small structure to hold a non zero as a triplet (i,j,value).
Definition: SparseUtil.h:148
Definition: BandTriangularSolver.h:13
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48