121 fftw_plan prepare_fft(
int, Tbl*&) ;
122 double* cheb_ini(
const int) ;
125 void cftcossins(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
144 cout <<
"cftcossins: nt > n2f : nt = " << nt <<
" , n2f = " 150 cout <<
"cftcossins: nt > n2c : nt = " << nt <<
" , n2c = " 156 cout <<
"cftcossins: n1f > n1c : n1f = " << n1f <<
" , n1c = " 162 cout <<
"cftcossins: n3f > n3c : n3f = " << n3f <<
" , n3c = " 174 fftw_plan p = prepare_fft(nm1, pg) ;
178 double* sinp = cheb_ini(nt);
183 int n2n3f = n2f * n3f ;
184 int n2n3c = n2c * n3c ;
199 for (k=0; k<n3f; k++) {
201 int i0 = n2n3f * j + k ;
202 double* ff0 = ff + i0 ;
205 double* cf0 = cf + i0 ;
210 for ( i = 1; i < nm1s2 ; i++ ) {
213 int ixsym = n3f * isym ;
215 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
217 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
218 g.set(i) = fp + fms ;
219 g.set(isym) = fp - fms ;
222 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
223 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
236 double fac = -2. / double(nm1) ;
238 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(nm1 - i/2) ;
248 cf0[n3c] = -fac * g(0);
250 for ( i = 3; i < nt; i += 2 ) {
251 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(i/2) ;
266 for (k=0; k<n3f; k++) {
268 int i0 = n2n3f * j + k ;
269 double* ff0 = ff + i0 ;
272 double* cf0 = cf + i0 ;
276 for ( i = 1; i < nm1s2 ; i++ ) {
279 int ixsym = n3f * isym ;
281 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
283 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
284 g.set(i) = fp + fms ;
285 g.set(isym) = fp - fms ;
288 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
289 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
302 double fac = -2. / double(nm1) ;
304 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(nm1 - i/2) ;
314 cf0[n3c] = -fac * g(0);
316 for ( i = 3; i < nt; i += 2 ) {
317 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(i/2) ;
348 for (k=0; k<n3f; k++) {
350 int i0 = n2n3f * j + k ;
351 double* ff0 = ff + i0 ;
354 double* cf0 = cf + i0 ;
358 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
362 for ( i = 1; i < nm1s2 ; i++ ) {
365 int ixsym = n3f * isym ;
367 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
369 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
370 g.set(i) = fp + fms ;
371 g.set(isym) = fp - fms ;
374 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
375 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
388 double fac = 2./double(nm1) ;
389 cf0[0] = g(0) / double(nm1) ;
390 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
391 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
402 for ( i = 3; i < nt; i += 2 ) {
403 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
408 double c1 = ( fmoins0 - som ) / nm1s2 ;
412 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
423 if ( (j != 1) && (j != n1f-1 ) ) {
427 for (k=0; k<n3f; k++) {
429 int i0 = n2n3f * j + k ;
430 double* ff0 = ff + i0 ;
433 double* cf0 = cf + i0 ;
437 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
441 for ( i = 1; i < nm1s2 ; i++ ) {
444 int ixsym = n3f * isym ;
446 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
448 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
449 g.set(i) = fp + fms ;
450 g.set(isym) = fp - fms ;
453 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
454 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
467 double fac = 2./double(nm1) ;
468 cf0[0] = g(0) / double(nm1) ;
469 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
470 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
481 for ( i = 3; i < nt; i += 2 ) {
482 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
487 double c1 = ( fmoins0 - som ) / nm1s2 ;
491 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;