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 cftcossinc(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
150 cout <<
"cftcossinc: nt > n2f : nt = " << nt <<
" , n2f = " 156 cout <<
"cftcossinc: nt > n2c : nt = " << nt <<
" , n2c = " 162 cout <<
"cftcossinc: n1f > n1c : n1f = " << n1f <<
" , n1c = " 168 cout <<
"cftcossinc: 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 ;
219 for (k=0; k<n3f; k++) {
221 int i0 = n2n3f * j + k ;
222 double* ff0 = ff + i0 ;
225 double* cf0 = cf + i0 ;
229 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
233 for ( i = 1; i < nm1s2 ; i++ ) {
236 int ixsym = n3f * isym ;
238 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
240 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
245 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
246 g[nm1s2] = ff0[ n3f*nm1s2 ];
251 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
260 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
261 cf0[n3c*nm1] = g[nm1] ;
271 for ( i = 3; i < nt; i += 2 ) {
272 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
277 double c1 = ( fmoins0 - som ) / nm1s2 ;
281 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
292 if ( (j != 1) && (j != n1f-1 ) ) {
296 for (k=0; k<n3f; k++) {
298 int i0 = n2n3f * j + k ;
299 double* ff0 = ff + i0 ;
302 double* cf0 = cf + i0 ;
306 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
310 for ( i = 1; i < nm1s2 ; i++ ) {
313 int ixsym = n3f * isym ;
315 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
317 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
322 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
323 g[nm1s2] = ff0[ n3f*nm1s2 ];
328 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
337 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
338 cf0[n3c*nm1] = g[nm1] ;
348 for ( i = 3; i < nt; i += 2 ) {
349 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
354 double c1 = ( fmoins0 - som ) / nm1s2 ;
358 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
389 for (k=0; k<n3f; k++) {
391 int i0 = n2n3f * j + k ;
392 double* ff0 = ff + i0 ;
395 double* cf0 = cf + i0 ;
398 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
403 for ( i = 1; i < nm1s2 ; i++ ) {
406 int ixsym = n3f * isym ;
408 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
410 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
415 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
416 g[nm1s2] = ff0[ n3f*nm1s2 ];
421 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
430 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2.* g[i+1] ;
441 for ( i = 3; i < nt; i += 2 ) {
442 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i-1] ;
457 for (k=0; k<n3f; k++) {
459 int i0 = n2n3f * j + k ;
460 double* ff0 = ff + i0 ;
463 double* cf0 = cf + i0 ;
466 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
470 for ( i = 1; i < nm1s2 ; i++ ) {
473 int ixsym = n3f * isym ;
475 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
477 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
482 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
483 g[nm1s2] = ff0[ n3f*nm1s2 ];
488 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
497 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2.* g[i+1] ;
508 for ( i = 3; i < nt; i += 2 ) {
509 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i-1] ;