137 fftw_plan prepare_fft(
int, Tbl*&) ;
138 double* cheb_ini(
const int) ;
139 double* chebimp_ini(
const int ) ;
142 void cftcossinsp(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
161 cout <<
"cftcossinsp: nt > n2f : nt = " << nt <<
" , n2f = " 167 cout <<
"cftcossinsp: nt > n2c : nt = " << nt <<
" , n2c = " 173 cout <<
"cftcossinsp: n1f > n1c : n1f = " << n1f <<
" , n1c = " 179 cout <<
"cftcossinsp: n3f > n3c : n3f = " << n3f <<
" , n3c = " 191 fftw_plan p = prepare_fft(nm1, pg) ;
195 double* sinp = cheb_ini(nt);
198 double* x = chebimp_ini(nt);
203 int n2n3f = n2f * n3f ;
204 int n2n3c = n2c * n3c ;
219 for (k=0; k<n3f; k++) {
221 int i0 = n2n3f * j + k ;
222 double* ff0 = ff + i0 ;
225 double* cf0 = cf + i0 ;
234 for ( i = 1; i < nm1s2 ; i++ ) {
240 int ixsym = n3f * isym ;
242 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
244 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
245 g.set(i) = fps + fm ;
246 g.set(isym) = fps - fm ;
249 g.set(0) = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
250 g.set(nm1s2) = ff0[ n3f*nm1s2 ] ;
262 double fac = 2./double(nm1) ;
264 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -fac * g(nm1 - i/2);
275 cf0[n3c] = fac * g(0) ;
277 for ( i = 3; i < nt; i += 2 ) {
278 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + fac * g(i/2) ;
289 if ( (j != 1) && (j != n1f-1 ) ) {
293 for (k=0; k<n3f; k++) {
295 int i0 = n2n3f * j + k ;
296 double* ff0 = ff + i0 ;
299 double* cf0 = cf + i0 ;
308 for ( i = 1; i < nm1s2 ; i++ ) {
314 int ixsym = n3f * isym ;
316 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
318 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
319 g.set(i) = fps + fm ;
320 g.set(isym) = fps - fm ;
323 g.set(0) = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
324 g.set(nm1s2) = ff0[ n3f*nm1s2 ] ;
336 double fac = 2./double(nm1) ;
338 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -fac * g(nm1 - i/2);
349 cf0[n3c] = fac * g(0) ;
351 for ( i = 3; i < nt; i += 2 ) {
352 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + fac * g(i/2) ;
381 for (k=0; k<n3f; k++) {
383 int i0 = n2n3f * j + k ;
384 double* ff0 = ff + i0 ;
387 double* cf0 = cf + i0 ;
393 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
402 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
406 for ( i = 1; i < nm1s2 ; i++ ) {
412 int ixsym = n3c * isym ;
414 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
416 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
417 g.set(i) = fp + fms ;
418 g.set(isym) = fp - fms ;
421 g.set(0) = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
422 g.set(nm1s2) = cf0[ n3c*nm1s2 ];
436 double fac = 2./double(nm1) ;
437 cf0[0] = g(0) / double(nm1) ;
438 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(i/2) ;
439 cf0[n3c*nm1] = g(nm1s2) ;
450 for ( i = 3; i < nt; i += 2 ) {
451 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
456 double c1 = ( fmoins0 - som ) / nm1s2 ;
460 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
467 for (i=1; i<nm1; i++) {
468 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;
484 for (k=0; k<n3f; k++) {
486 int i0 = n2n3f * j + k ;
487 double* ff0 = ff + i0 ;
490 double* cf0 = cf + i0 ;
496 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
505 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
509 for ( i = 1; i < nm1s2 ; i++ ) {
515 int ixsym = n3c * isym ;
517 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
519 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
520 g.set(i) = fp + fms ;
521 g.set(isym) = fp - fms ;
524 g.set(0) = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
525 g.set(nm1s2) = cf0[ n3c*nm1s2 ];
539 double fac = 2./double(nm1) ;
540 cf0[0] = g(0) / double(nm1) ;
541 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(i/2) ;
542 cf0[n3c*nm1] = g(nm1s2) ;
553 for ( i = 3; i < nt; i += 2 ) {
554 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
559 double c1 = ( fmoins0 - som ) / nm1s2 ;
563 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
570 for (i=1; i<nm1; i++) {
571 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;