138 fftw_plan prepare_fft(
int, Tbl*&) ;
139 double* cheb_ini(
const int) ;
140 double* chebimp_ini(
const int ) ;
143 void cftcossinci(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
162 cout <<
"cftcossinci: nt > n2f : nt = " << nt <<
" , n2f = " 167 cout <<
"cftcossinci: nt > n2c : nt = " << nt <<
" , n2c = " 172 cout <<
"cftcossinci: n1f > n1c : n1f = " << n1f <<
" , n1c = " 177 cout <<
"cftcossinci: n3f > n3c : n3f = " << n3f <<
" , n3c = " 188 fftw_plan p = prepare_fft(nm1, pg) ;
192 double* sinp = cheb_ini(nt);
195 double* x = chebimp_ini(nt);
200 int n2n3f = n2f * n3f ;
201 int n2n3c = n2c * n3c ;
216 for (k=0; k<n3f; k++) {
218 int i0 = n2n3f * j + k ;
219 double* ff0 = ff + i0 ;
222 double* cf0 = cf + i0 ;
228 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
237 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
241 for ( i = 1; i < nm1s2 ; i++ ) {
247 int ixsym = n3c * isym ;
249 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
251 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
252 g.set(i) = fp + fms ;
253 g.set(isym) = fp - fms ;
256 g.set(0) = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
257 g.set(nm1s2) = cf0[ n3c*nm1s2 ];
271 double fac = 2./double(nm1) ;
272 cf0[0] = g(0) / double(nm1) ;
273 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(i/2) ;
274 cf0[n3c*nm1] = g(nm1s2) ;
285 for ( i = 3; i < nt; i += 2 ) {
286 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
291 double c1 = ( fmoins0 - som ) / nm1s2 ;
295 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
302 for (i=1; i<nm1; i++) {
303 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;
316 if ( (j != 1) && (j != n1f-1 ) ) {
320 for (k=0; k<n3f; k++) {
322 int i0 = n2n3f * j + k ;
323 double* ff0 = ff + i0 ;
326 double* cf0 = cf + i0 ;
332 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
341 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
345 for ( i = 1; i < nm1s2 ; i++ ) {
351 int ixsym = n3c * isym ;
353 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
355 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
356 g.set(i) = fp + fms ;
357 g.set(isym) = fp - fms ;
360 g.set(0) = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
361 g.set(nm1s2) = cf0[ n3c*nm1s2 ];
375 double fac = 2./double(nm1) ;
376 cf0[0] = g(0) / double(nm1) ;
377 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(i/2) ;
378 cf0[n3c*nm1] = g(nm1s2) ;
389 for ( i = 3; i < nt; i += 2 ) {
390 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
395 double c1 = ( fmoins0 - som ) / nm1s2 ;
399 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
406 for (i=1; i<nm1; i++) {
407 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;
437 for (k=0; k<n3f; k++) {
439 int i0 = n2n3f * j + k ;
440 double* ff0 = ff + i0 ;
443 double* cf0 = cf + i0 ;
452 for ( i = 1; i < nm1s2 ; i++ ) {
458 int ixsym = n3f * isym ;
460 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
462 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
463 g.set(i) = fps + fm ;
464 g.set(isym) = fps - fm ;
467 g.set(0) = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
468 g.set(nm1s2) = ff0[ n3f*nm1s2 ] ;
480 double fac = 2./double(nm1) ;
482 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -fac * g(nm1 - i/2);
493 cf0[n3c] = fac * g(0) ;
495 for ( i = 3; i < nt; i += 2 ) {
496 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + fac * g(i/2) ;
511 for (k=0; k<n3f; k++) {
513 int i0 = n2n3f * j + k ;
514 double* ff0 = ff + i0 ;
517 double* cf0 = cf + i0 ;
526 for ( i = 1; i < nm1s2 ; i++ ) {
532 int ixsym = n3f * isym ;
534 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
536 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
537 g.set(i) = fps + fm ;
538 g.set(isym) = fps - fm ;
541 g.set(0) = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
542 g.set(nm1s2) = ff0[ n3f*nm1s2 ] ;
555 double fac = 2./double(nm1) ;
557 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -fac * g(nm1 - i/2);
568 cf0[n3c] = fac * g(0) ;
570 for ( i = 3; i < nt; i += 2 ) {
571 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + fac * g(i/2) ;