121 #include "proto_f77.h" 125 int* facto_ini(
int ) ;
126 double* trigo_ini(
int ) ;
127 double* cheb_ini(
const int) ;
128 double* chebimp_ini(
const int ) ;
131 void cftcossins(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
150 cout <<
"cftcossins: nt > n2f : nt = " << nt <<
" , n2f = " 156 cout <<
"cftcossins: nt > n2c : nt = " << nt <<
" , n2c = " 162 cout <<
"cftcossins: n1f > n1c : n1f = " << n1f <<
" , n1c = " 168 cout <<
"cftcossins: n3f > n3c : n3f = " << n3f <<
" , n3c = " 179 int* facto = facto_ini(nm1) ;
180 double* trigo = trigo_ini(nm1) ;
183 double* sinp = cheb_ini(nt);
186 double* x = chebimp_ini(nt);
190 double* g = (
double*)( malloc( (nm1+2)*
sizeof(
double) ) );
191 double* t1 = (
double*)( malloc( (nm1+2)*
sizeof(double) ) ) ;
202 int n2n3f = n2f * n3f ;
203 int n2n3c = n2c * n3c ;
218 for (k=0; k<n3f; k++) {
220 int i0 = n2n3f * j + k ;
221 double* ff0 = ff + i0 ;
224 double* cf0 = cf + i0 ;
227 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
232 for ( i = 1; i < nm1s2 ; i++ ) {
235 int ixsym = n3f * isym ;
237 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
239 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
244 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
245 g[nm1s2] = ff0[ n3f*nm1s2 ];
250 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
259 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2.* g[i+1] ;
270 for ( i = 3; i < nt; i += 2 ) {
271 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i-1] ;
286 for (k=0; k<n3f; k++) {
288 int i0 = n2n3f * j + k ;
289 double* ff0 = ff + i0 ;
292 double* cf0 = cf + i0 ;
295 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
299 for ( i = 1; i < nm1s2 ; i++ ) {
302 int ixsym = n3f * isym ;
304 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
306 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
311 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
312 g[nm1s2] = ff0[ n3f*nm1s2 ];
317 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
326 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2.* g[i+1] ;
337 for ( i = 3; i < nt; i += 2 ) {
338 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i-1] ;
372 for (k=0; k<n3f; k++) {
374 int i0 = n2n3f * j + k ;
375 double* ff0 = ff + i0 ;
378 double* cf0 = cf + i0 ;
382 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
386 for ( i = 1; i < nm1s2 ; i++ ) {
389 int ixsym = n3f * isym ;
391 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
393 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
398 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
399 g[nm1s2] = ff0[ n3f*nm1s2 ];
404 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
413 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
414 cf0[n3c*nm1] = g[nm1] ;
424 for ( i = 3; i < nt; i += 2 ) {
425 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
430 double c1 = ( fmoins0 - som ) / nm1s2 ;
434 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
445 if ( (j != 1) && (j != n1f-1 ) ) {
449 for (k=0; k<n3f; k++) {
451 int i0 = n2n3f * j + k ;
452 double* ff0 = ff + i0 ;
455 double* cf0 = cf + i0 ;
459 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
463 for ( i = 1; i < nm1s2 ; i++ ) {
466 int ixsym = n3f * isym ;
468 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
470 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
475 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
476 g[nm1s2] = ff0[ n3f*nm1s2 ];
481 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
490 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
491 cf0[n3c*nm1] = g[nm1] ;
501 for ( i = 3; i < nt; i += 2 ) {
502 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
507 double c1 = ( fmoins0 - som ) / nm1s2 ;
511 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;