139 fftw_plan back_fft(
int, Tbl*&) ;
140 double* cheb_ini(
const int) ;
141 double* chebimp_ini(
const int ) ;
144 void citcossinci(
const int* deg,
const int* dimc,
double* cf,
const int* dimf,
163 cout <<
"citcossinci: nt > n2f : nt = " << nt <<
" , n2f = " 168 cout <<
"citcossinci: nt > n2c : nt = " << nt <<
" , n2c = " 172 if ( (n1f > 1) && (n1c > n1f) ) {
173 cout <<
"citcossinci: n1c > n1f : n1c = " << n1c <<
" , n1f = " 178 cout <<
"citcossinci: n3c > n3f : n3c = " << n3c <<
" , n3f = " 189 fftw_plan p = back_fft(nm1, pg) ;
191 double* t1 =
new double[nt] ;
194 double* sinp = cheb_ini(nt);
197 double* x = chebimp_ini(nt) ;
202 int n2n3f = n2f * n3f ;
203 int n2n3c = n2c * n3c ;
204 int borne_phi = n1f-1 ;
205 if (n1f == 1) borne_phi = 1 ;
213 while (j < borne_phi) {
220 for (k=0; k<n3c; k++) {
222 int i0 = n2n3c * j + k ;
223 double* cf0 = cf + i0 ;
226 double* ff0 = ff + i0 ;
231 t1[0] = .5 * cf0[0] ;
232 for (i=1; i<nm1; i++) t1[i] = .5 * ( cf0[n3c*i] + cf0[n3c*(i-1)] ) ;
233 t1[nm1] = .5 * cf0[n3c*(nt-2)] ;
251 for ( i = 3; i < nt; i += 2 ) {
252 ff0[ n3f*i ] = t1[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 * t1[2*i] ;
276 g.set(nm1s2) = t1[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 ) / x[isym] ;
294 ff0[ n3f*isym ] = ( fp - fm ) / x[i] ;
298 ff0[0] = g(0) + fmoins0 ;
300 ff0[ n3f*nm1s2 ] = g(nm1s2) / x[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 ;
325 t1[0] = .5 * cf0[0] ;
326 for (i=1; i<nm1; i++) t1[i] = .5 * ( cf0[n3c*i] + cf0[n3c*(i-1)] ) ;
327 t1[nm1] = .5 * cf0[n3c*(nt-2)] ;
345 for ( i = 3; i < nt; i += 2 ) {
346 ff0[ n3f*i ] = t1[i] - c1 ;
347 som += ff0[ n3f*i ] ;
351 double fmoins0 = nm1s2 * c1 + som ;
356 for ( i = 3; i < nt; i += 2 ) {
357 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
369 for (i=1; i<nm1s2; i++ ) g.set(i) = 0.5 * t1[2*i] ;
370 g.set(nm1s2) = t1[nm1] ;
381 for ( i = 1; i < nm1s2 ; i++ ) {
385 double fp = 0.5 * ( g(i) + g(isym) ) ;
386 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
387 ff0[ n3f*i ] = ( fp + fm ) / x[isym] ;
388 ff0[ n3f*isym ] = ( fp - fm ) / x[i] ;
392 ff0[0] = g(0) + fmoins0 ;
394 ff0[ n3f*nm1s2 ] = g(nm1s2) / x[nm1s2] ;
419 while (j < borne_phi) {
426 for (k=0; k<n3c; k++) {
428 int i0 = n2n3c * j + k ;
429 double* cf0 = cf + i0 ;
432 double* ff0 = ff + i0 ;
451 for (i=2; i<nm1; i += 2 ) g.set(nm1-i/2) = - .5 * cf0[n3c*i] ;
460 g.set(0) = .5 * cf0[n3c] ;
461 for ( i = 1; i < nm1s2; i++ ) {
462 g.set(i) = .25 * ( cf0[ n3c*(2*i+1) ] - cf0[ n3c*(2*i-1) ] ) ;
464 g.set(nm1s2) = - .5 * cf0[ n3c*(nt-2) ] ;
476 for ( i = 1; i < nm1s2 ; i++ ) {
480 double fp = 0.5 * ( g(i) + g(isym) ) / sinp[i] ;
481 double fm = 0.5 * ( g(i) - g(isym) ) ;
482 ff0[ n3f*i ] = fp + fm ;
483 ff0[ n3f*isym ] = fp - fm ;
488 ff0[ n3f*nm1 ] = -2. * g(0) ;
489 ff0[ n3f*nm1s2 ] = g(nm1s2) ;
500 if ( j != borne_phi ) {
504 for (k=0; k<n3c; k++) {
506 int i0 = n2n3c * j + k ;
507 double* cf0 = cf + i0 ;
510 double* ff0 = ff + i0 ;
529 for (i=2; i<nm1; i += 2 ) g.set(nm1-i/2) = - .5 * cf0[n3c*i] ;
538 g.set(0) = .5 * cf0[n3c] ;
539 for ( i = 1; i < nm1s2; i++ ) {
540 g.set(i) = .25 * ( cf0[ n3c*(2*i+1) ] - cf0[ n3c*(2*i-1) ] ) ;
542 g.set(nm1s2) = - .5 * cf0[ n3c*(nt-2) ] ;
554 for ( i = 1; i < nm1s2 ; i++ ) {
558 double fp = 0.5 * ( g(i) + g(isym) ) / sinp[i] ;
559 double fm = 0.5 * ( g(i) - g(isym) ) ;
560 ff0[ n3f*i ] = fp + fm ;
561 ff0[ n3f*isym ] = fp - fm ;
566 ff0[ n3f*nm1 ] = -2. * g(0) ;
567 ff0[ n3f*nm1s2 ] = g(nm1s2) ;