134 fftw_plan prepare_fft(
int, Tbl*&) ;
135 double* cheb_ini(
const int) ;
139 void cftcosp(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
158 cout <<
"cftcosp: nt > n2f : nt = " << nt <<
" , n2f = " 164 cout <<
"cftcosp: nt > n2c : nt = " << nt <<
" , n2c = " 170 cout <<
"cftcosp: n1f > n1c : n1f = " << n1f <<
" , n1c = " 176 cout <<
"cftcosp: n3f > n3c : n3f = " << n3f <<
" , n3c = " 188 fftw_plan p = prepare_fft(nm1, pg) ;
192 double* sinp = cheb_ini(nt);
197 int n2n3f = n2f * n3f ;
198 int n2n3c = n2c * n3c ;
206 int borne_phi = ( n1f > 1 ) ? n1f-1 : 1 ;
208 for (j=0; j< borne_phi; j++) {
212 for (k=0; k<n3f; k++) {
214 int i0 = n2n3f * j + k ;
215 double* ff0 = ff + i0 ;
218 double* cf0 = cf + i0 ;
226 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
230 for ( i = 1; i < nm1s2 ; i++ ) {
236 int ixsym = n3f * isym ;
238 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
240 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
241 g.set(i) = fp + fms ;
242 g.set(isym) = fp - fms ;
245 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
246 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
259 double fac = 2./double(nm1) ;
260 cf0[0] = g(0) / double(nm1) ;
261 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
262 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
273 for ( i = 3; i < nt; i += 2 ) {
274 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
279 double c1 = ( fmoins0 - som ) / nm1s2 ;
283 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;