121 fftw_plan prepare_fft(
int, Tbl*&) ;
122 double* cheb_ini(
const int) ;
125 void cftcossinc(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
144 cout <<
"cftcossinc: nt > n2f : nt = " << nt <<
" , n2f = " 150 cout <<
"cftcossinc: nt > n2c : nt = " << nt <<
" , n2c = " 156 cout <<
"cftcossinc: n1f > n1c : n1f = " << n1f <<
" , n1c = " 162 cout <<
"cftcossinc: 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 ;
200 for (k=0; k<n3f; k++) {
202 int i0 = n2n3f * j + k ;
203 double* ff0 = ff + i0 ;
206 double* cf0 = cf + i0 ;
210 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
214 for ( i = 1; i < nm1s2 ; i++ ) {
217 int ixsym = n3f * isym ;
219 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
221 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
222 g.set(i) = fp + fms ;
223 g.set(isym) = fp - fms ;
226 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
227 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
240 double fac = 2./double(nm1) ;
241 cf0[0] = g(0) / double(nm1) ;
242 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
243 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
254 for ( i = 3; i < nt; i += 2 ) {
255 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
260 double c1 = ( fmoins0 - som ) / nm1s2 ;
264 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
275 if ( (j != 1) && (j != n1f-1 ) ) {
279 for (k=0; k<n3f; k++) {
281 int i0 = n2n3f * j + k ;
282 double* ff0 = ff + i0 ;
285 double* cf0 = cf + i0 ;
289 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
293 for ( i = 1; i < nm1s2 ; i++ ) {
296 int ixsym = n3f * isym ;
298 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
300 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
301 g.set(i) = fp + fms ;
302 g.set(isym) = fp - fms ;
305 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
306 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
319 double fac = 2./double(nm1) ;
320 cf0[0] = g(0) / double(nm1) ;
321 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac*g(i/2) ;
322 cf0[n3c*nm1] = g(nm1s2) / double(nm1) ;
333 for ( i = 3; i < nt; i += 2 ) {
334 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(nm1 - i/2) ;
339 double c1 = ( fmoins0 - som ) / nm1s2 ;
343 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
371 for (k=0; k<n3f; k++) {
373 int i0 = n2n3f * j + k ;
374 double* ff0 = ff + i0 ;
377 double* cf0 = cf + i0 ;
382 for ( i = 1; i < nm1s2 ; i++ ) {
385 int ixsym = n3f * isym ;
387 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
389 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
390 g.set(i) = fp + fms ;
391 g.set(isym) = fp - fms ;
394 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
395 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
408 double fac = -2. / double(nm1) ;
410 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(nm1 - i/2) ;
420 cf0[n3c] = -fac * g(0);
422 for ( i = 3; i < nt; i += 2 ) {
423 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(i/2) ;
438 for (k=0; k<n3f; k++) {
440 int i0 = n2n3f * j + k ;
441 double* ff0 = ff + i0 ;
444 double* cf0 = cf + i0 ;
448 for ( i = 1; i < nm1s2 ; i++ ) {
451 int ixsym = n3f * isym ;
453 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
455 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
456 g.set(i) = fp + fms ;
457 g.set(isym) = fp - fms ;
460 g.set(0) = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
461 g.set(nm1s2) = ff0[ n3f*nm1s2 ];
474 double fac = -2. / double(nm1) ;
476 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = fac * g(nm1 - i/2) ;
486 cf0[n3c] = -fac * g(0);
488 for ( i = 3; i < nt; i += 2 ) {
489 cf0[n3c*i] = cf0[n3c*(i-2)] + fac * g(i/2) ;