136 fftw_plan back_fft(
int, Tbl*&) ;
137 double* cheb_ini(
const int) ;
138 double* chebimp_ini(
const int ) ;
141 void citcossincp(
const int* deg,
const int* dimc,
double* cf,
const int* dimf,
160 cout <<
"citcossincp: nt > n2f : nt = " << nt <<
" , n2f = " 166 cout <<
"citcossincp: nt > n2c : nt = " << nt <<
" , n2c = " 171 if ( (n1f > 1) && (n1c > n1f) ) {
172 cout <<
"citcossincp: n1c > n1f : n1c = " << n1c <<
" , n1f = " 178 cout <<
"citcossincp: n3c > n3f : n3c = " << n3c <<
" , n3f = " 190 fftw_plan p = back_fft(nm1, pg) ;
192 double* t1 =
new double[nt] ;
195 double* sinp = cheb_ini(nt);
198 double* sinth = chebimp_ini(nt);
202 int n2n3f = n2f * n3f ;
203 int n2n3c = n2c * n3c ;
211 int borne_phi = n1f-1 ;
212 if (n1f == 1) borne_phi = 1 ;
220 while (j < borne_phi) {
227 for (k=0; k<n3c; k++) {
229 int i0 = n2n3c * j + k ;
230 double* cf0 = cf + i0 ;
233 double* ff0 = ff + i0 ;
247 double c1 = cf0[n3c] ;
251 for ( i = 3; i < nt; i += 2 ) {
252 ff0[ n3f*i ] = cf0[ n3c*i ] - c1 ;
253 som += ff0[ n3f*i ] ;
257 double fmoins0 = nm1s2 * c1 + som ;
262 for ( i = 3; i < nt; i += 2 ) {
263 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
275 for (i=1; i<nm1s2; i++ ) g.set(i) = 0.5 * cf0[ n3c*2*i ] ;
276 g.set(nm1s2) = cf0[ n3c*nm1 ] ;
287 for ( i = 1; i < nm1s2 ; i++ ) {
291 double fp = 0.5 * ( g(i) + g(isym) ) ;
292 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
293 ff0[ n3f*i ] = fp + fm ;
294 ff0[ n3f*isym ] = fp - fm ;
298 ff0[0] = g(0) + fmoins0 ;
299 ff0[ n3f*nm1 ] = g(0) - fmoins0 ;
300 ff0[ n3f*nm1s2 ] = g(nm1s2) ;
310 if ( (j != 1) && (j != borne_phi ) ) {
314 for (k=0; k<n3c; k++) {
316 int i0 = n2n3c * j + k ;
317 double* cf0 = cf + i0 ;
320 double* ff0 = ff + i0 ;
334 double c1 = cf0[n3c] ;
338 for ( i = 3; i < nt; i += 2 ) {
339 ff0[ n3f*i ] = cf0[ n3c*i ] - c1 ;
340 som += ff0[ n3f*i ] ;
344 double fmoins0 = nm1s2 * c1 + som ;
349 for ( i = 3; i < nt; i += 2 ) {
350 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
362 for (i=1; i<nm1s2; i++ ) g.set(i) = 0.5 * cf0[ n3c*2*i ] ;
363 g.set(nm1s2) = cf0[ n3c*nm1 ] ;
374 for ( i = 1; i < nm1s2 ; i++ ) {
378 double fp = 0.5 * ( g(i) + g(isym) ) ;
379 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
380 ff0[ n3f*i ] = fp + fm ;
381 ff0[ n3f*isym ] = fp - fm ;
385 ff0[0] = g(0) + fmoins0 ;
386 ff0[ n3f*nm1 ] = g(0) - fmoins0 ;
387 ff0[ n3f*nm1s2 ] = g(nm1s2) ;
411 while (j < borne_phi) {
418 for (k=0; k<n3c; k++) {
420 int i0 = n2n3c * j + k ;
421 double* cf0 = cf + i0 ;
424 double* ff0 = ff + i0 ;
429 t1[0] = .5 * cf0[0] ;
430 for (i=1; i<nm1; i++) {
431 t1[i] = .5 * ( cf0[ n3c*i ] - cf0[ n3c*(i-1) ] ) ;
433 t1[nm1] = -.5 * cf0[ n3c*(nt-2) ] ;
451 for ( i = 3; i < nt; i += 2 ) {
452 ff0[ n3f*i ] = t1[i] - c1 ;
453 som += ff0[ n3f*i ] ;
457 double fmoins0 = nm1s2 * c1 + som ;
462 for ( i = 3; i < nt; i += 2 ) {
463 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
474 for (i=1; i<nm1s2; i ++ ) g.set(i) = 0.5 * t1[2*i] ;
475 g.set(nm1s2) = t1[nm1] ;
486 for ( i = 1; i < nm1s2 ; i++ ) {
490 double fp = 0.5 * ( g(i) + g(isym) ) ;
491 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
492 ff0[ n3f*i ] = ( fp + fm ) / sinth[i] ;
493 ff0[ n3f*isym ] = ( fp - fm ) / sinth[isym] ;
498 ff0[ n3f*nm1 ] = g(0) - fmoins0 ;
499 ff0[ n3f*nm1s2 ] = g(nm1s2) / sinth[nm1s2];
509 if ( j != borne_phi ) {
513 for (k=0; k<n3c; k++) {
515 int i0 = n2n3c * j + k ;
516 double* cf0 = cf + i0 ;
519 double* ff0 = ff + i0 ;
524 t1[0] = .5 * cf0[0] ;
525 for (i=1; i<nm1; i++) {
526 t1[i] = .5 * ( cf0[ n3c*i ] - cf0[ n3c*(i-1) ] ) ;
528 t1[nm1] = -.5 * cf0[ n3c*(nt-2) ] ;
546 for ( i = 3; i < nt; i += 2 ) {
547 ff0[ n3f*i ] = t1[i] - c1 ;
548 som += ff0[ n3f*i ] ;
552 double fmoins0 = nm1s2 * c1 + som ;
557 for ( i = 3; i < nt; i += 2 ) {
558 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
569 for (i=1; i<nm1s2; i ++ ) g.set(i) = 0.5 * t1[2*i] ;
570 g.set(nm1s2) = t1[nm1] ;
581 for ( i = 1; i < nm1s2 ; i++ ) {
585 double fp = 0.5 * ( g(i) + g(isym) ) ;
586 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
587 ff0[ n3f*i ] = ( fp + fm ) / sinth[i] ;
588 ff0[ n3f*isym ] = ( fp - fm ) / sinth[isym] ;
593 ff0[ n3f*nm1 ] = g(0) - fmoins0 ;
594 ff0[ n3f*nm1s2 ] = g(nm1s2) / sinth[nm1s2];