117 #include "proto_f77.h" 121 int* facto_ini(
int ) ;
122 double* trigo_ini(
int ) ;
123 double* cheb_ini(
const int) ;
124 double* chebimp_ini(
const int ) ;
127 void citcossins(
const int* deg,
const int* dimc,
double* cf,
const int* dimf,
146 cout <<
"citcossins: nt > n2f : nt = " << nt <<
" , n2f = " 152 cout <<
"citcossins: nt > n2c : nt = " << nt <<
" , n2c = " 158 cout <<
"citcossins: n1c > n1f : n1c = " << n1c <<
" , n1f = " 164 cout <<
"citcossins: n3c > n3f : n3c = " << n3c <<
" , n3f = " 175 int* facto = facto_ini(nm1) ;
176 double* trigo = trigo_ini(nm1) ;
179 double* sinp = cheb_ini(nt);
182 double* sinth = chebimp_ini(nt);
186 double* g = (
double*)( malloc( (nm1+2)*
sizeof(
double) ) ) ;
187 double* t1 = (
double*)( malloc( (nm1+2)*
sizeof(double) ) ) ;
198 int n2n3f = n2f * n3f ;
199 int n2n3c = n2c * n3c ;
214 for (k=0; k<n3c; k++) {
216 int i0 = n2n3c * j + k ;
217 double* cf0 = cf + i0 ;
220 double* ff0 = ff + i0 ;
226 for (i=2; i<nm1; i += 2 ) g[i+1] = -0.5 * cf0[ n3c*i ] ;
233 g[0] = .5 * cf0[n3c] ;
234 for ( i = 3; i < nt; i += 2 ) {
235 g[i-1] = .25 * ( cf0[ n3c*i ] - cf0[ n3c*(i-2) ] ) ;
237 g[nm1] = - .5 * cf0[ n3c*(nt-2) ] ;
243 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
248 for ( i = 1; i < nm1s2 ; i++ ) {
252 double fp = 0.5 * ( g[i] + g[isym] ) / sinp[i] ;
253 double fm = 0.5 * ( g[i] - g[isym] ) ;
254 ff0[ n3f*i ] = fp + fm ;
255 ff0[ n3f*isym ] = fp - fm ;
260 ff0[ n3f*nm1 ] = -2*g[0] ;
261 ff0[ n3f*nm1s2 ] = g[nm1s2] ;
276 for (k=0; k<n3c; k++) {
278 int i0 = n2n3c * j + k ;
279 double* cf0 = cf + i0 ;
282 double* ff0 = ff + i0 ;
288 for (i=2; i<nm1; i += 2 ) g[i+1] = -0.5 * cf0[ n3c*i ] ;
295 g[0] = .5 * cf0[n3c] ;
296 for ( i = 3; i < nt; i += 2 ) {
297 g[i-1] = .25 * ( cf0[ n3c*i ] - cf0[ n3c*(i-2) ] ) ;
299 g[nm1] = - .5 * cf0[ n3c*(nt-2) ] ;
305 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
310 for ( i = 1; i < nm1s2 ; i++ ) {
314 double fp = 0.5 * ( g[i] + g[isym] ) / sinp[i] ;
315 double fm = 0.5 * ( g[i] - g[isym] ) ;
316 ff0[ n3f*i ] = fp + fm ;
317 ff0[ n3f*isym ] = fp - fm ;
322 ff0[ n3f*nm1 ] = -2*g[0] ;
323 ff0[ n3f*nm1s2 ] = g[nm1s2] ;
355 for (k=0; k<n3c; k++) {
357 int i0 = n2n3c * j + k ;
358 double* cf0 = cf + i0 ;
361 double* ff0 = ff + i0 ;
367 double c1 = cf0[n3c] ;
371 for ( i = 3; i < nt; i += 2 ) {
372 ff0[ n3f*i ] = cf0[ n3c*i ] - c1 ;
373 som += ff0[ n3f*i ] ;
377 double fmoins0 = nm1s2 * c1 + som ;
383 for ( i = 3; i < nt; i += 2 ) {
384 g[i] = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
397 for (i=2; i<nm1; i += 2 ) g[i] = 0.5 * cf0[ n3c*i ] ;
398 g[nm1] = cf0[ n3c*nm1 ] ;
404 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
409 for ( i = 1; i < nm1s2 ; i++ ) {
413 double fp = 0.5 * ( g[i] + g[isym] ) ;
414 double fm = 0.5 * ( g[i] - g[isym] ) / sinp[i] ;
415 ff0[ n3f*i ] = fp + fm ;
416 ff0[ n3f*isym ] = fp - fm ;
420 ff0[0] = g[0] + fmoins0 ;
421 ff0[ n3f*nm1 ] = g[0] - fmoins0 ;
422 ff0[ n3f*nm1s2 ] = g[nm1s2] ;
433 if ( (j != 1) && (j != n1f-1 ) ) {
437 for (k=0; k<n3c; k++) {
439 int i0 = n2n3c * j + k ;
440 double* cf0 = cf + i0 ;
443 double* ff0 = ff + i0 ;
448 double c1 = cf0[n3c] ;
452 for ( i = 3; i < nt; i += 2 ) {
453 ff0[ n3f*i ] = cf0[ n3c*i ] - c1 ;
454 som += ff0[ n3f*i ] ;
458 double fmoins0 = nm1s2 * c1 + som ;
464 for ( i = 3; i < nt; i += 2 ) {
465 g[i] = 0.25 * ( ff0[ n3f*i ] - ff0[ n3f*(i-2) ] ) ;
478 for (i=2; i<nm1; i += 2 ) g[i] = 0.5 * cf0[ n3c*i ] ;
479 g[nm1] = cf0[ n3c*nm1 ] ;
485 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
490 for ( i = 1; i < nm1s2 ; i++ ) {
494 double fp = 0.5 * ( g[i] + g[isym] ) ;
495 double fm = 0.5 * ( g[i] - g[isym] ) / sinp[i] ;
496 ff0[ n3f*i ] = fp + fm ;
497 ff0[ n3f*isym ] = fp - fm ;
501 ff0[0] = g[0] + fmoins0 ;
502 ff0[ n3f*nm1 ] = g[0] - fmoins0 ;
503 ff0[ n3f*nm1s2 ] = g[nm1s2] ;