81char cftcos_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/FFT991/cftcos.C,v 1.4 2014/10/15 12:48:20 j_novak Exp $" ;
120#include "proto_f77.h"
124int* facto_ini(
int ) ;
125double* trigo_ini(
int ) ;
126double* cheb_ini(
const int) ;
129void cftcos(
const int* deg,
const int* dimf,
double* ff,
const int* dimc,
148 cout <<
"cftcos: nt > n2f : nt = " << nt <<
" , n2f = "
154 cout <<
"cftcos: nt > n2c : nt = " << nt <<
" , n2c = "
160 cout <<
"cftcos: n1f > n1c : n1f = " << n1f <<
" , n1c = "
166 cout <<
"cftcos: n3f > n3c : n3f = " << n3f <<
" , n3c = "
177 int* facto = facto_ini(nm1) ;
178 double* trigo = trigo_ini(nm1) ;
181 double* sinp = cheb_ini(nt);
185 double* g = (
double*)( malloc( (nm1+2)*
sizeof(
double) ) );
186 double* t1 = (
double*)( malloc( (nm1+2)*
sizeof(double) ) ) ;
197 int n2n3f = n2f * n3f ;
198 int n2n3c = n2c * n3c ;
206 int borne_phi = ( n1f > 1 ) ? n1f-1 : 1 ;
208 for (j=0; j< borne_phi; j++) {
212 for (k=0; k<n3f; k++) {
214 int i0 = n2n3f * j + k ;
215 double* ff0 = ff + i0 ;
218 double* cf0 = cf + i0 ;
222 double fmoins0 = 0.5 * ( ff0[0] - ff0[ n3f*nm1 ] );
226 for ( i = 1; i < nm1s2 ; i++ ) {
232 int ixsym = n3f * isym ;
234 double fp = 0.5 * ( ff0[ix] + ff0[ixsym] ) ;
236 double fms = 0.5 * ( ff0[ix] - ff0[ixsym] ) * sinp[i] ;
241 g[0] = 0.5 * ( ff0[0] + ff0[ n3f*nm1 ] );
242 g[nm1s2] = ff0[ n3f*nm1s2 ];
247 F77_fft991( g, t1, trigo, facto, &inc, &jump, &nm1, &lot, &isign) ;
256 for (i=2; i<nm1; i += 2 ) cf0[n3c*i] = 2.* g[i] ;
257 cf0[n3c*nm1] = g[nm1] ;
267 for ( i = 3; i < nt; i += 2 ) {
268 cf0[n3c*i] = cf0[n3c*(i-2)] + 4. * g[i] ;
273 double c1 = ( fmoins0 - som ) / nm1s2 ;
277 for ( i = 3; i < nt; i += 2 ) cf0[n3c*i] += c1 ;