112 double* mat_cossincp_legp(
int np,
int nt) {
114 #define NMAX 30 // Nombre maximun de couples(np,nt) differents 115 static double* tab[NMAX] ;
116 static int nb_dejafait = 0 ;
117 static int np_dejafait[NMAX] ;
119 static int nt_dejafait[NMAX] ;
122 int i, indice, j, j2, m, l ;
128 for ( i=0 ; i < nb_dejafait ; i++ ) {
129 if ( (np_dejafait[i] == np) && (nt_dejafait[i] == nt) ) indice = i ;
135 if ( nb_dejafait >= NMAX ) {
136 cout <<
"mat_cossincp_legp: nb_dejafait >= NMAX : " 137 << nb_dejafait <<
" <-> " << NMAX << endl ;
141 indice = nb_dejafait ;
143 np_dejafait[indice] = np ;
144 nt_dejafait[indice] = nt ;
146 tab[indice] =
new double[(np/2+1)*nt*nt] ;
154 int nt2m1 = nt2 - 1 ;
162 double* yy =
new double[nt2] ;
163 double* cost =
new double[nt*nt2] ;
164 double* sint =
new double[nt*nt2] ;
169 double dt = M_PI / double(2*(nt2-1)) ;
170 for (j=0; j<nt; j++) {
171 for (j2=0; j2<nt2; j2++) {
172 double theta = j2*dt ;
173 cost[nt2*j + j2] =
cos( 2*j * theta ) ;
174 sint[nt2*j + j2] =
sin( (2*j+1) * theta ) ;
183 for (m=0; m < np/2+1 ; m++) {
187 double* leg = legendre_norm(m, nt) ;
192 for (l=m/2; l<nt; l++) {
196 for (j=0; j<nt; j++) {
200 for (j2=0; j2<nt2; j2++) {
201 yy[nt2m1-j2] = cost[nt2*j + j2] *
202 leg[nt2* (ll-m) + j2] ;
207 cfrchebp(deg, deg, yy, deg, yy) ;
208 tab[indice][ nt*nt* m + nt*l + j] =
209 2.*int1d_chebp(nt2, yy) ;
222 for (l=(m-1)/2; l<nt-1; l++) {
226 for (j=0; j<nt-1; j++) {
230 for (j2=0; j2<nt2; j2++) {
231 yy[nt2m1-j2] = sint[nt2*j + j2] *
232 leg[nt2* (ll-m) + j2] ;
237 cfrchebp(deg, deg, yy, deg, yy) ;
238 tab[indice][ nt*nt* m + nt*l + j] =
239 2.*int1d_chebp(nt2, yy) ;
Cmp cos(const Cmp &)
Cosine.
Cmp sin(const Cmp &)
Sine.