137 fftw_plan back_fft(
int, Tbl*&) ;
138 double* cheb_ini(
const int) ;
139 double* chebimp_ini(
const int ) ;
142 void citcossinsp(
const int* deg,
const int* dimc,
double* cf,
const int* dimf,
161 cout <<
"citcossinsp: nt > n2f : nt = " << nt <<
" , n2f = " 167 cout <<
"citcossinsp: nt > n2c : nt = " << nt <<
" , n2c = " 172 if ( (n1f > 1) && (n1c > n1f)) {
173 cout <<
"citcossinsp: n1c > n1f : n1c = " << n1c <<
" , n1f = " 179 cout <<
"citcossinsp: n3c > n3f : n3c = " << n3c <<
" , n3f = " 191 fftw_plan p = back_fft(nm1, pg) ;
193 double* t1 =
new double[nt] ;
196 double* sinp = cheb_ini(nt);
199 double* x = chebimp_ini(nt) ;
204 int n2n3f = n2f * n3f ;
205 int n2n3c = n2c * n3c ;
206 int borne_phi = n1f-1 ;
207 if (n1f == 1) borne_phi = 1 ;
215 while (j < borne_phi) {
222 for (k=0; k<n3c; k++) {
224 int i0 = n2n3c * j + k ;
225 double* cf0 = cf + i0 ;
228 double* ff0 = ff + i0 ;
248 for (i=2; i<nm1; i += 2 ) g.set(nm1-i/2) = - .5 * cf0[n3c*i] ;
257 g.set(0) = .5 * cf0[n3c] ;
258 for ( i = 1; i < nm1s2; i++ ) {
259 g.set(i) = .25 * ( cf0[ n3c*(2*i+1) ] - cf0[ n3c*(2*i-1) ] ) ;
261 g.set(nm1s2) = - .5 * cf0[ n3c*(nt-2) ] ;
273 for ( i = 1; i < nm1s2 ; i++ ) {
277 double fp = 0.5 * ( g(i) + g(isym) ) / sinp[i] ;
278 double fm = 0.5 * ( g(i) - g(isym) ) ;
279 ff0[ n3f*i ] = fp + fm ;
280 ff0[ n3f*isym ] = fp - fm ;
285 ff0[ n3f*nm1 ] = -2. * g(0) ;
286 ff0[ n3f*nm1s2 ] = g(nm1s2) ;
296 if ( (j != 1) && (j != borne_phi ) ) {
300 for (k=0; k<n3c; k++) {
302 int i0 = n2n3c * j + k ;
303 double* cf0 = cf + i0 ;
306 double* ff0 = ff + i0 ;
326 for (i=2; i<nm1; i += 2 ) g.set(nm1-i/2) = - .5 * cf0[n3c*i] ;
335 g.set(0) = .5 * cf0[n3c] ;
336 for ( i = 1; i < nm1s2; i++ ) {
337 g.set(i) = .25 * ( cf0[ n3c*(2*i+1) ] - cf0[ n3c*(2*i-1) ] ) ;
339 g.set(nm1s2) = - .5 * cf0[ n3c*(nt-2) ] ;
351 for ( i = 1; i < nm1s2 ; i++ ) {
355 double fp = 0.5 * ( g(i) + g(isym) ) / sinp[i] ;
356 double fm = 0.5 * ( g(i) - g(isym) ) ;
357 ff0[ n3f*i ] = fp + fm ;
358 ff0[ n3f*isym ] = fp - fm ;
363 ff0[ n3f*nm1 ] = -2. * g(0) ;
364 ff0[ n3f*nm1s2 ] = g(nm1s2) ;
388 while (j < borne_phi) {
395 for (k=0; k<n3c; k++) {
397 int i0 = n2n3c * j + k ;
398 double* cf0 = cf + i0 ;
401 double* ff0 = ff + i0 ;
406 t1[0] = .5 * cf0[0] ;
407 for (i=1; i<nm1; i++) t1[i] = .5 * ( cf0[n3c*i] + cf0[n3c*(i-1)] ) ;
408 t1[nm1] = .5 * cf0[n3c*(nt-2)] ;
426 for ( i = 3; i < nt; i += 2 ) {
427 ff0[ n3f*i ] = t1[i] - c1 ;
428 som += ff0[ n3f*i ] ;
432 double fmoins0 = nm1s2 * c1 + som ;
437 for ( i = 3; i < nt; i += 2 ) {
438 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
450 for (i=1; i<nm1s2; i++ ) g.set(i) = 0.5 * t1[2*i] ;
451 g.set(nm1s2) = t1[nm1] ;
462 for ( i = 1; i < nm1s2 ; i++ ) {
466 double fp = 0.5 * ( g(i) + g(isym) ) ;
467 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
468 ff0[ n3f*i ] = ( fp + fm ) / x[isym] ;
469 ff0[ n3f*isym ] = ( fp - fm ) / x[i] ;
473 ff0[0] = g(0) + fmoins0 ;
475 ff0[ n3f*nm1s2 ] = g(nm1s2) / x[nm1s2] ;
486 if ( j != borne_phi ) {
490 for (k=0; k<n3c; k++) {
492 int i0 = n2n3c * j + k ;
493 double* cf0 = cf + i0 ;
496 double* ff0 = ff + i0 ;
501 t1[0] = .5 * cf0[0] ;
502 for (i=1; i<nm1; i++) t1[i] = .5 * ( cf0[n3c*i] + cf0[n3c*(i-1)] ) ;
503 t1[nm1] = .5 * cf0[n3c*(nt-2)] ;
521 for ( i = 3; i < nt; i += 2 ) {
522 ff0[ n3f*i ] = t1[i] - c1 ;
523 som += ff0[ n3f*i ] ;
527 double fmoins0 = nm1s2 * c1 + som ;
532 for ( i = 3; i < nt; i += 2 ) {
533 g.set(nm1-i/2) = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
545 for (i=1; i<nm1s2; i++ ) g.set(i) = 0.5 * t1[2*i] ;
546 g.set(nm1s2) = t1[nm1] ;
557 for ( i = 1; i < nm1s2 ; i++ ) {
561 double fp = 0.5 * ( g(i) + g(isym) ) ;
562 double fm = 0.5 * ( g(i) - g(isym) ) / sinp[i] ;
563 ff0[ n3f*i ] = ( fp + fm ) / x[isym] ;
564 ff0[ n3f*isym ] = ( fp - fm ) / x[i] ;
568 ff0[0] = g(0) + fmoins0 ;
570 ff0[ n3f*nm1s2 ] = g(nm1s2) / x[nm1s2] ;