147 fftw_plan prepare_fft(
int, Tbl*&) ;
148 double* cheb_ini(
const int) ;
149 double* chebimp_ini(
const int ) ;
153 void cfrchebpimp(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
173 cout <<
"cfrchebpimp: nr > n3f : nr = " << nr <<
" , n3f = " 179 cout <<
"cfrchebpimp: nr > n3c : nr = " << nr <<
" , n3c = " 185 cout <<
"cfrchebpimp: n1f > n1c : n1f = " << n1f <<
" , n1c = " 191 cout <<
"cfrchebpimp: n2f > n2c : n2f = " << n2f <<
" , n2c = " 203 fftw_plan p = prepare_fft(nm1, pg) ;
207 double* sinp = cheb_ini(nr);
210 double* x = chebimp_ini(nr);
214 int n2n3f = n2f * n3f ;
215 int n2n3c = n2c * n3c ;
230 for (k=0; k<n2f; k++) {
232 int i0 = n2n3f * j + n3f * k ;
233 double* ff0 = ff + i0 ;
235 i0 = n2n3c * j + n3c * k ;
236 double* cf0 = cf + i0 ;
244 double fmoins0 = 0.5 * ( ff0[nm1] - ff0[0] );
248 for ( i = 1; i < nm1s2 ; i++ ) {
254 int ixsym = nm1 - isym ;
257 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
259 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
260 g.set(i) = fp + fms ;
261 g.set(isym) = fp - fms ;
264 g.set(0) = 0.5 * ( ff0[nm1] + ff0[0] );
265 g.set(nm1s2) = ff0[nm1s2];
278 double fac = 2./double(nm1) ;
279 cf0[0] = g(0) / double(nm1) ;
280 for (i=2; i<nm1; i += 2) cf0[i] = fac*g(i/2) ;
281 cf0[nm1] = g(nm1s2) / double(nm1) ;
292 for ( i = 3; i < nr; i += 2 ) {
293 cf0[i] = cf0[i-2] + fac * g(nm1-i/2) ;
298 double c1 = ( fmoins0 - som ) / nm1s2 ;
302 for ( i = 3; i < nr; i += 2 ) cf0[i] += c1 ;
312 if ( (j != 1) && (j != n1f-1) ) {
316 for (k=0; k<n2f; k++) {
318 int i0 = n2n3f * j + n3f * k ;
319 double* ff0 = ff + i0 ;
321 i0 = n2n3c * j + n3c * k ;
322 double* cf0 = cf + i0 ;
330 double fmoins0 = 0.5 * ( ff0[nm1] - ff0[0] );
334 for ( i = 1; i < nm1s2 ; i++ ) {
340 int ixsym = nm1 - isym ;
343 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
345 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
346 g.set(i) = fp + fms ;
347 g.set(isym) = fp - fms ;
350 g.set(0) = 0.5 * ( ff0[nm1] + ff0[0] );
351 g.set(nm1s2) = ff0[nm1s2];
364 double fac = 2./double(nm1) ;
365 cf0[0] = g(0) / double(nm1) ;
366 for (i=2; i<nm1; i += 2) cf0[i] = fac*g(i/2) ;
367 cf0[nm1] = g(nm1s2) / double(nm1) ;
378 for ( i = 3; i < nr; i += 2 ) {
379 cf0[i] = cf0[i-2] + fac * g(nm1-i/2) ;
384 double c1 = ( fmoins0 - som ) / nm1s2 ;
388 for ( i = 3; i < nr; i += 2 ) cf0[i] += c1 ;
416 for (k=0; k<n2f; k++) {
418 int i0 = n2n3f * j + n3f * k ;
419 double* ff0 = ff + i0 ;
421 i0 = n2n3c * j + n3c * k ;
422 double* cf0 = cf + i0 ;
429 for (i=1; i<nr; i++) cf0[i] = x[i] * ff0[i] ;
437 double fmoins0 = 0.5 * ( cf0[nm1] - cf0[0] );
441 for ( i = 1; i < nm1s2 ; i++ ) {
447 int ixsym = nm1 - isym ;
450 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
452 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
453 g.set(i) = fp + fms ;
454 g.set(isym) = fp - fms ;
457 g.set(0) = 0.5 * ( cf0[nm1] + cf0[0] );
458 g.set(nm1s2) = cf0[nm1s2];
472 double fac = 2./double(nm1) ;
473 cf0[0] = g(0) / double(nm1) ;
474 for (i=2; i<nm1; i += 2 ) cf0[i] = fac * g(i/2) ;
475 cf0[nm1] = g(nm1s2) / double(nm1) ;
486 for ( i = 3; i < nr; i += 2 ) {
487 cf0[i] = cf0[i-2] + fac * g(nm1 - i/2) ;
492 double c1 = ( fmoins0 - som ) / nm1s2 ;
496 for ( i = 3; i < nr; i += 2 ) cf0[i] += c1 ;
502 for (i=1; i<nm1; i++) {
503 cf0[i] = 2 * cf0[i] - cf0[i-1] ;
520 for (k=0; k<n2f; k++) {
522 int i0 = n2n3f * j + n3f * k ;
523 double* ff0 = ff + i0 ;
525 i0 = n2n3c * j + n3c * k ;
526 double* cf0 = cf + i0 ;
533 for (i=1; i<nr; i++) cf0[i] = x[i] * ff0[i] ;
541 double fmoins0 = 0.5 * ( cf0[nm1] - cf0[0] );
545 for ( i = 1; i < nm1s2 ; i++ ) {
551 int ixsym = nm1 - isym ;
554 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
556 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
557 g.set(i) = fp + fms ;
558 g.set(isym) = fp - fms ;
561 g.set(0) = 0.5 * ( cf0[nm1] + cf0[0] );
562 g.set(nm1s2) = cf0[nm1s2];
576 double fac = 2./double(nm1) ;
577 cf0[0] = g(0) / double(nm1) ;
578 for (i=2; i<nm1; i += 2 ) cf0[i] = fac * g(i/2) ;
579 cf0[nm1] = g(nm1s2) / double(nm1) ;
590 for ( i = 3; i < nr; i += 2 ) {
591 cf0[i] = cf0[i-2] + fac * g(nm1 - i/2) ;
596 double c1 = ( fmoins0 - som ) / nm1s2 ;
600 for ( i = 3; i < nr; i += 2 ) cf0[i] += c1 ;
606 for (i=1; i<nm1; i++) {
607 cf0[i] = 2 * cf0[i] - cf0[i-1] ;