11 typedef std::complex<double>
cplx;
47 double cth,ctth,spth2,sth,sth4i,stth,th2,th4,tmth2,tth4i;
50 if (fabs(th) < 5.0e-2) {
55 *corfac=1.0-(11.0/720.0)*t4+(23.0/15120.0)*t6;
56 ar[0]=(-2.0/3.0)+t2/45.0+(103.0/15120.0)*t4-(169.0/226800.0)*t6;
57 ar[1]=(7.0/24.0)-(7.0/180.0)*t2+(5.0/3456.0)*t4-(7.0/259200.0)*t6;
58 ar[2]=(-1.0/6.0)+t2/45.0-(5.0/6048.0)*t4+t6/64800.0;
59 ar[3]=(1.0/24.0)-t2/180.0+(5.0/24192.0)*t4-t6/259200.0;
60 ai[0]=t*(2.0/45.0+(2.0/105.0)*t2-(8.0/2835.0)*t4+(86.0/467775.0)*t6);
61 ai[1]=t*(7.0/72.0-t2/168.0+(11.0/72576.0)*t4-(13.0/5987520.0)*t6);
62 ai[2]=t*(-7.0/90.0+t2/210.0-(11.0/90720.0)*t4+(13.0/7484400.0)*t6);
63 ai[3]=t*(7.0/360.0-t2/840.0+(11.0/362880.0)*t4-(13.0/29937600.0)*t6);
73 sth4i=1.0/(6.0e0*th4);
75 *corfac=tth4i*spth2*(3.0e0-4.0e0*cth+ctth);
76 ar[0]=sth4i*(-42.0e0+5.0e0*th2+spth2*(8.0e0*cth-ctth));
77 ai[0]=sth4i*(th*(-12.0e0+6.0e0*th2)+spth2*stth);
78 ar[1]=sth4i*(14.0e0*tmth2-7.0e0*spth2*cth);
79 ai[1]=sth4i*(30.0e0*th-5.0e0*spth2*sth);
80 ar[2]=tth4i*(-4.0e0*tmth2+2.0e0*spth2*cth);
81 ai[2]=tth4i*(-12.0e0*th+2.0e0*spth2*sth);
82 ar[3]=sth4i*(2.0e0*tmth2-spth2*cth);
83 ai[3]=sth4i*(6.0e0*th-spth2*sth);
85 for(j=0;j<=3;j++) endcor[j]=
cplx(ar[j],ai[j]);
120 double th2,th4,th6,cth,sth;
122 if (fabs(th) < 5.0e-2) {
126 *corfac=1.0-(1.0/12.0)*th2+(1.0/360.0)*th4-(1.0/20160.0)*th6;
127 ar=-0.5+th2/24.0-(1.0/720.0)*th4+(1.0/40320.0)*th6;
128 ai=th*(1.0/6.0-(1.0/120.0)*th2+(1.0/5040.0)*th4-(1.0/362880.0)*th6);
133 *corfac=2.0*(1.0-cth)/th2;
137 endcor[0]=
cplx(ar,ai);
184 double ai[4],ar[4],arg,t;
186 double cth,ctth,spth2,sth,sth4i,stth,th,th2,th4,tmth2,tth4i;
187 cplx expfac,cr,cl,cor,al;
191 if (fabs(th) < 5.0e-2) {
196 *corfac=1.0-(11.0/720.0)*t4+(23.0/15120.0)*t6;
197 ar[0]=(-2.0/3.0)+t2/45.0+(103.0/15120.0)*t4-(169.0/226800.0)*t6;
198 ar[1]=(7.0/24.0)-(7.0/180.0)*t2+(5.0/3456.0)*t4-(7.0/259200.0)*t6;
199 ar[2]=(-1.0/6.0)+t2/45.0-(5.0/6048.0)*t4+t6/64800.0;
200 ar[3]=(1.0/24.0)-t2/180.0+(5.0/24192.0)*t4-t6/259200.0;
201 ai[0]=t*(2.0/45.0+(2.0/105.0)*t2-(8.0/2835.0)*t4+(86.0/467775.0)*t6);
202 ai[1]=t*(7.0/72.0-t2/168.0+(11.0/72576.0)*t4-(13.0/5987520.0)*t6);
203 ai[2]=t*(-7.0/90.0+t2/210.0-(11.0/90720.0)*t4+(13.0/7484400.0)*t6);
204 ai[3]=t*(7.0/360.0-t2/840.0+(11.0/362880.0)*t4-(13.0/29937600.0)*t6);
208 ctth=cth*cth-sth*sth;
214 sth4i=1.0/(6.0e0*th4);
216 *corfac=tth4i*spth2*(3.0e0-4.0e0*cth+ctth);
217 ar[0]=sth4i*(-42.0e0+5.0e0*th2+spth2*(8.0e0*cth-ctth));
218 ai[0]=sth4i*(th*(-12.0e0+6.0e0*th2)+spth2*stth);
219 ar[1]=sth4i*(14.0e0*tmth2-7.0e0*spth2*cth);
220 ai[1]=sth4i*(30.0e0*th-5.0e0*spth2*sth);
221 ar[2]=tth4i*(-4.0e0*tmth2+2.0e0*spth2*cth);
222 ai[2]=tth4i*(-12.0e0*th+2.0e0*spth2*sth);
223 ar[3]=sth4i*(2.0e0*tmth2-spth2*cth);
224 ai[3]=sth4i*(6.0e0*th-spth2*sth);
228 al=
cplx(ar[j],ai[j]);
234 al=
cplx(ar[j],-ai[j]);
239 expfac=
cplx(cos(arg),sin(arg));
288 double theta,delta,len,corfac,corfac2,arg;
289 cplx endpoints[8],endcor,endcor2,res2,expfac,z;
293 if(n<=16 || (n/2)*2!=n || len<=0.0) std::cerr <<
"n=" << n <<
" len= " << len << std::endl;
294 if(n<=16 || (n/2)*2!=n || len<=0.0) {std::cerr <<
"complex_ft_cubic_err: wrong input" << std::endl;abort();}
295 delta=len/((double) n);
301 endpoints[7-j]=f[n-j];
309 endpoints[7-j]=f[n-2*j];
318 arg=((double) j)*theta;
319 expfac=
cplx(cos(arg),sin(arg));
325 arg=((double) j)*theta;
326 expfac=
cplx(cos(arg),sin(arg));
333 expfac=
cplx(delta*cos(arg),delta*sin(arg));
std::complex< double > cplx
void get_dftcorr_linear(double th, double *corfac, cplx *endcor)
Returns correction factor and boundary correction term needed for linearly corrected DFT...
void dft_cplx(double w, int n, double a, double b, cplx *f, cplx &res, cplx &err)
Computes the Fourier integral using cubically corrected DFT.
void complex_dftcor_cubic(double w, double delta, double a, double b, cplx *endpts, cplx *endcor, double *corfac)
Returns correction factor and evaluate boundary correction terms needed for cubically corrected DFT...
void get_dftcorr_cubic(double th, double *corfac, cplx *endcor)
Returns correction factor and boundary correction terms needed for cubically corrected DFT...