141 #include "proto_f77.h" 145 int* facto_ini(
int ) ;
146 double* trigo_ini(
int ) ;
147 double* cheb_ini(
const int) ;
148 double* chebimp_ini(
const int ) ;
151 void cftcossincp(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
170 cout <<
"cftcossincp: nt > n2f : nt = " << nt <<
" , n2f = " 176 cout <<
"cftcossincp: nt > n2c : nt = " << nt <<
" , n2c = " 182 cout <<
"cftcossincp: n1f > n1c : n1f = " << n1f <<
" , n1c = " 188 cout <<
"cftcossincp: n3f > n3c : n3f = " << n3f <<
" , n3c = " 199 int* facto = facto_ini(nm1) ;
200 double* trigo = trigo_ini(nm1) ;
203 double* sinp = cheb_ini(nt);
206 double* sinth = chebimp_ini(nt);
210 double* g = (
double*)( malloc( (nm1+2)*
sizeof(
double) ) );
211 double* t1 = (
double*)( malloc( (nm1+2)*
sizeof(double) ) ) ;
222 int n2n3f = n2f * n3f ;
223 int n2n3c = n2c * n3c ;
238 for (k=0; k<n3f; k++) {
240 int i0 = n2n3f * j + k ;
241 double* ff0 = ff + i0 ;
244 double* cf0 = cf + i0 ;
252 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
256 for ( i = 1; i < nm1s2 ; i++ ) {
262 int ixsym = n3f * isym ;
264 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
266 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
271 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
272 g[nm1s2] = ff0[ n3f*nm1s2 ];
277 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
286 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
287 cf0[n3c*nm1] = g[nm1] ;
297 for ( i = 3; i < nt; i += 2 ) {
298 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
303 double c1 = ( fmoins0 - som ) / nm1s2 ;
307 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
318 if ( (j != 1) && (j != n1f-1 ) ) {
321 for (k=0; k<n3f; k++) {
323 int i0 = n2n3f * j + k ;
324 double* ff0 = ff + i0 ;
327 double* cf0 = cf + i0 ;
335 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
339 for ( i = 1; i < nm1s2 ; i++ ) {
345 int ixsym = n3f * isym ;
347 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
349 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
354 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
355 g[nm1s2] = ff0[ n3f*nm1s2 ];
360 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
369 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
370 cf0[n3c*nm1] = g[nm1] ;
380 for ( i = 3; i < nt; i += 2 ) {
381 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
386 double c1 = ( fmoins0 - som ) / nm1s2 ;
390 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
421 for (k=0; k<n3f; k++) {
423 int i0 = n2n3f * j + k ;
424 double* ff0 = ff + i0 ;
427 double* cf0 = cf + i0 ;
436 for (i=1; i<nt; i++) cf0[n3c*i] = sinth[i] * ff0[n3f*i] ;
444 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
448 for ( i = 1; i < nm1s2 ; i++ ) {
454 int ixsym = n3c * isym ;
456 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
458 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
463 g[0] = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
464 g[nm1s2] = cf0[ n3c*nm1s2 ];
469 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
478 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
479 cf0[n3c*nm1] = g[nm1] ;
489 for ( i = 3; i < nt; i += 2 ) {
490 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
495 double c1 = ( fmoins0 - som ) / nm1s2 ;
499 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
505 for (i=1; i<nm1; i++) {
506 cf0[n3c*i] = 2 * cf0[n3c*i] + cf0[n3c*(i-1)] ;
522 for (k=0; k<n3f; k++) {
524 int i0 = n2n3f * j + k ;
525 double* ff0 = ff + i0 ;
528 double* cf0 = cf + i0 ;
537 for (i=1; i<nt; i++) cf0[n3c*i] = sinth[i] * ff0[n3f*i] ;
545 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
549 for ( i = 1; i < nm1s2 ; i++ ) {
555 int ixsym = n3c * isym ;
557 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
559 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
564 g[0] = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
565 g[nm1s2] = cf0[ n3c*nm1s2 ];
570 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
579 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
580 cf0[n3c*nm1] = g[nm1] ;
590 for ( i = 3; i < nt; i += 2 ) {
591 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
596 double c1 = ( fmoins0 - som ) / nm1s2 ;
600 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
606 for (i=1; i<nm1; i++) {
607 cf0[n3c*i] = 2 * cf0[n3c*i] + cf0[n3c*(i-1)] ;