141 fftw_plan prepare_fft(
int, Tbl*&) ;
142 double* cheb_ini(
const int) ;
143 double* chebimp_ini(
const int ) ;
146 void cftcossincp(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
165 cout <<
"cftcossincp: nt > n2f : nt = " << nt <<
" , n2f = " 171 cout <<
"cftcossincp: nt > n2c : nt = " << nt <<
" , n2c = " 177 cout <<
"cftcossincp: n1f > n1c : n1f = " << n1f <<
" , n1c = " 183 cout <<
"cftcossincp: n3f > n3c : n3f = " << n3f <<
" , n3c = " 195 fftw_plan p = prepare_fft(nm1, pg) ;
199 double* sinp = cheb_ini(nt);
202 double* sinth = chebimp_ini(nt);
207 int n2n3f = n2f * n3f ;
208 int n2n3c = n2c * n3c ;
223 for (k=0; k<n3f; k++) {
225 int i0 = n2n3f * j + k ;
226 double* ff0 = ff + i0 ;
229 double* cf0 = cf + i0 ;
237 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
241 for ( i = 1; i < nm1s2 ; i++ ) {
247 int ixsym = n3f * isym ;
249 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
251 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
252 g.set(i) = fp + fms ;
253 g.set(isym) = fp - fms ;
256 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
257 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
270 double fac = 2./double(nm1) ;
271 cf0[0] = g(0) / double(nm1) ;
272 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
273 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
284 for ( i = 3; i < nt; i += 2 ) {
285 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
290 double c1 = ( fmoins0 - som ) / nm1s2 ;
294 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
305 if ( (j != 1) && (j != n1f-1 ) ) {
308 for (k=0; k<n3f; k++) {
310 int i0 = n2n3f * j + k ;
311 double* ff0 = ff + i0 ;
314 double* cf0 = cf + i0 ;
322 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
326 for ( i = 1; i < nm1s2 ; i++ ) {
332 int ixsym = n3f * isym ;
334 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
336 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
337 g.set(i) = fp + fms ;
338 g.set(isym) = fp - fms ;
341 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
342 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
355 double fac = 2./double(nm1) ;
356 cf0[0] = g(0) / double(nm1) ;
357 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
358 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
369 for ( i = 3; i < nt; i += 2 ) {
370 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
375 double c1 = ( fmoins0 - som ) / nm1s2 ;
379 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
407 for (k=0; k<n3f; k++) {
409 int i0 = n2n3f * j + k ;
410 double* ff0 = ff + i0 ;
413 double* cf0 = cf + i0 ;
422 for (i=1; i<nt; i++) cf0[n3c*i] = sinth[i] * ff0[n3f*i] ;
430 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
434 for ( i = 1; i < nm1s2 ; i++ ) {
440 int ixsym = n3c * isym ;
442 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
444 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
445 g.set(i) = fp + fms ;
446 g.set(isym) = fp - fms ;
449 g.set(0) = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
450 g.set(nm1s2) = cf0[ n3c*nm1s2 ];
463 double fac = 2./double(nm1) ;
464 cf0[0] = g(0)/double(nm1) ;
465 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(i/2) ;
466 cf0[n3c*nm1] = g(nm1s2)/double(nm1) ;
477 for ( i = 3; i < nt; i += 2 ) {
478 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
483 double c1 = ( fmoins0 - som ) / nm1s2 ;
487 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
493 for (i=1; i<nm1; i++) {
494 cf0[n3c*i] = 2 * cf0[n3c*i] + cf0[n3c*(i-1)] ;
510 for (k=0; k<n3f; k++) {
512 int i0 = n2n3f * j + k ;
513 double* ff0 = ff + i0 ;
516 double* cf0 = cf + i0 ;
525 for (i=1; i<nt; i++) cf0[n3c*i] = sinth[i] * ff0[n3f*i] ;
533 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
537 for ( i = 1; i < nm1s2 ; i++ ) {
543 int ixsym = n3c * isym ;
545 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
547 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
548 g.set(i) = fp + fms ;
549 g.set(isym) = fp - fms ;
552 g.set(0) = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
553 g.set(nm1s2) = cf0[ n3c*nm1s2 ];
566 double fac = 2./double(nm1) ;
567 cf0[0] = g(0)/double(nm1) ;
568 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(i/2) ;
569 cf0[n3c*nm1] = g(nm1s2)/double(nm1) ;
580 for ( i = 3; i < nt; i += 2 ) {
581 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
586 double c1 = ( fmoins0 - som ) / nm1s2 ;
590 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
596 for (i=1; i<nm1; i++) {
597 cf0[n3c*i] = 2 * cf0[n3c*i] + cf0[n3c*(i-1)] ;