137 #include "proto_f77.h" 141 int* facto_ini(
int ) ;
142 double* trigo_ini(
int ) ;
143 double* cheb_ini(
const int) ;
144 double* chebimp_ini(
const int ) ;
147 void cftcossinsp(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
166 cout <<
"cftcossinsp: nt > n2f : nt = " << nt <<
" , n2f = " 172 cout <<
"cftcossinsp: nt > n2c : nt = " << nt <<
" , n2c = " 178 cout <<
"cftcossinsp: n1f > n1c : n1f = " << n1f <<
" , n1c = " 184 cout <<
"cftcossinsp: n3f > n3c : n3f = " << n3f <<
" , n3c = " 195 int* facto = facto_ini(nm1) ;
196 double* trigo = trigo_ini(nm1) ;
199 double* sinp = cheb_ini(nt);
202 double* x = chebimp_ini(nt);
206 double* g = (
double*)( malloc( (nm1+2)*
sizeof(
double) ) );
207 double* t1 = (
double*)( malloc( (nm1+2)*
sizeof(double) ) ) ;
218 int n2n3f = n2f * n3f ;
219 int n2n3c = n2c * n3c ;
234 for (k=0; k<n3f; k++) {
236 int i0 = n2n3f * j + k ;
237 double* ff0 = ff + i0 ;
240 double* cf0 = cf + i0 ;
249 for ( i = 1; i < nm1s2 ; i++ ) {
255 int ixsym = n3f * isym ;
257 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
259 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
264 g[0] = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
265 g[nm1s2] = ff0[ n3f*nm1s2 ] ;
270 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
280 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2. * g[i+1] ;
291 cf0[n3c] = 2.* g[0] ;
292 for ( i = 3; i < nt; i += 2 ) {
293 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + 4. * g[i-1] ;
304 if ( (j != 1) && (j != n1f-1 ) ) {
308 for (k=0; k<n3f; k++) {
310 int i0 = n2n3f * j + k ;
311 double* ff0 = ff + i0 ;
314 double* cf0 = cf + i0 ;
323 for ( i = 1; i < nm1s2 ; i++ ) {
329 int ixsym = n3f * isym ;
331 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
333 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
338 g[0] = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
339 g[nm1s2] = ff0[ n3f*nm1s2 ] ;
344 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
354 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2. * g[i+1] ;
365 cf0[n3c] = 2.* g[0] ;
366 for ( i = 3; i < nt; i += 2 ) {
367 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + 4. * g[i-1] ;
399 for (k=0; k<n3f; k++) {
401 int i0 = n2n3f * j + k ;
402 double* ff0 = ff + i0 ;
405 double* cf0 = cf + i0 ;
411 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
420 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
424 for ( i = 1; i < nm1s2 ; i++ ) {
430 int ixsym = n3c * isym ;
432 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
434 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
439 g[0] = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
440 g[nm1s2] = cf0[ n3c*nm1s2 ];
445 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
455 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
456 cf0[n3c*nm1] = g[nm1] ;
466 for ( i = 3; i < nt; i += 2 ) {
467 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
472 double c1 = ( fmoins0 - som ) / nm1s2 ;
476 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
483 for (i=1; i<nm1; i++) {
484 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;
500 for (k=0; k<n3f; k++) {
502 int i0 = n2n3f * j + k ;
503 double* ff0 = ff + i0 ;
506 double* cf0 = cf + i0 ;
512 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
521 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
525 for ( i = 1; i < nm1s2 ; i++ ) {
531 int ixsym = n3c * isym ;
533 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
535 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
540 g[0] = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
541 g[nm1s2] = cf0[ n3c*nm1s2 ];
546 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
556 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
557 cf0[n3c*nm1] = g[nm1] ;
567 for ( i = 3; i < nt; i += 2 ) {
568 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
573 double c1 = ( fmoins0 - som ) / nm1s2 ;
577 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
584 for (i=1; i<nm1; i++) {
585 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;