23char cftcossinci_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/FFT991/cftcossinci.C,v 1.4 2014/10/15 12:48:20 j_novak Exp $" ;
135#include "proto_f77.h"
139int* facto_ini(
int ) ;
140double* trigo_ini(
int ) ;
141double* cheb_ini(
const int) ;
142double* chebimp_ini(
const int ) ;
145void cftcossinci(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
164 cout <<
"cftcossinci: nt > n2f : nt = " << nt <<
" , n2f = "
169 cout <<
"cftcossinci: nt > n2c : nt = " << nt <<
" , n2c = "
174 cout <<
"cftcossinci: n1f > n1c : n1f = " << n1f <<
" , n1c = "
179 cout <<
"cftcossinci: n3f > n3c : n3f = " << n3f <<
" , n3c = "
189 int* facto = facto_ini(nm1) ;
190 double* trigo = trigo_ini(nm1) ;
193 double* sinp = cheb_ini(nt);
196 double* x = chebimp_ini(nt);
200 double* g = (
double*)( malloc( (nm1+2)*
sizeof(
double) ) );
201 double* t1 = (
double*)( malloc( (nm1+2)*
sizeof(double) ) ) ;
212 int n2n3f = n2f * n3f ;
213 int n2n3c = n2c * n3c ;
228 for (k=0; k<n3f; k++) {
230 int i0 = n2n3f * j + k ;
231 double* ff0 = ff + i0 ;
234 double* cf0 = cf + i0 ;
240 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
249 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
253 for ( i = 1; i < nm1s2 ; i++ ) {
259 int ixsym = n3c * isym ;
261 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
263 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
268 g[0] = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
269 g[nm1s2] = cf0[ n3c*nm1s2 ];
274 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
284 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
285 cf0[n3c*nm1] = g[nm1] ;
295 for ( i = 3; i < nt; i += 2 ) {
296 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
301 double c1 = ( fmoins0 - som ) / nm1s2 ;
305 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
312 for (i=1; i<nm1; i++) {
313 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;
326 if ( (j != 1) && (j != n1f-1 ) ) {
330 for (k=0; k<n3f; k++) {
332 int i0 = n2n3f * j + k ;
333 double* ff0 = ff + i0 ;
336 double* cf0 = cf + i0 ;
342 for (i=0; i<nt-1; i++) cf0[n3c*i] = x[nm1-i] * ff0[n3f*i] ;
351 double fmoins0 = 0.5 * ( cf0[0] - cf0[ n3c*nm1 ] );
355 for ( i = 1; i < nm1s2 ; i++ ) {
361 int ixsym = n3c * isym ;
363 double fp = 0.5 * ( cf0[ix] + cf0[ixsym] ) ;
365 double fms = 0.5 * ( cf0[ix] - cf0[ixsym] ) * sinp[i] ;
370 g[0] = 0.5 * ( cf0[0] + cf0[ n3c*nm1 ] );
371 g[nm1s2] = cf0[ n3c*nm1s2 ];
376 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
386 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
387 cf0[n3c*nm1] = g[nm1] ;
397 for ( i = 3; i < nt; i += 2 ) {
398 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
403 double c1 = ( fmoins0 - som ) / nm1s2 ;
407 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;
414 for (i=1; i<nm1; i++) {
415 cf0[n3c*i] = 2 * cf0[n3c*i] - cf0[n3c*(i-1)] ;
448 for (k=0; k<n3f; k++) {
450 int i0 = n2n3f * j + k ;
451 double* ff0 = ff + i0 ;
454 double* cf0 = cf + i0 ;
463 for ( i = 1; i < nm1s2 ; i++ ) {
469 int ixsym = n3f * isym ;
471 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
473 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
478 g[0] = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
479 g[nm1s2] = ff0[ n3f*nm1s2 ] ;
484 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
494 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2. * g[i+1] ;
505 cf0[n3c] = 2.* g[0] ;
506 for ( i = 3; i < nt; i += 2 ) {
507 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + 4. * g[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 < nm1s2 ; i++ ) {
543 int ixsym = n3f * isym ;
545 double fps = 0.5 * ( ff0[ix] + ff0[ixsym] ) * sinp[i] ;
547 double fm = 0.5 * ( ff0[ix] - ff0[ixsym] ) ;
552 g[0] = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] ) ;
553 g[nm1s2] = ff0[ n3f*nm1s2 ] ;
558 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
568 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = -2. * g[i+1] ;
579 cf0[n3c] = 2.* g[0] ;
580 for ( i = 3; i < nt; i += 2 ) {
581 cf0[ n3c*i ] = cf0[ n3c*(i-2) ] + 4. * g[i-1] ;