110 double* mat_cossinci_legi(
int np,
int nt) {
112 #define NMAX 30 // Nombre maximun de couples(np,nt) differents 113 static double* tab[NMAX] ;
114 static int nb_dejafait = 0 ;
115 static int np_dejafait[NMAX] ;
117 static int nt_dejafait[NMAX] ;
120 int i, indice, j, j2, m, l ;
126 for ( i=0 ; i < nb_dejafait ; i++ ) {
127 if ( (np_dejafait[i] == np) && (nt_dejafait[i] == nt) ) indice = i ;
133 if ( nb_dejafait >= NMAX ) {
134 cout <<
"mat_cossinci_legi: nb_dejafait >= NMAX : " 135 << nb_dejafait <<
" <-> " << NMAX << endl ;
139 indice = nb_dejafait ;
141 np_dejafait[indice] = np ;
142 nt_dejafait[indice] = nt ;
144 tab[indice] =
new double[(np/2+1)*nt*nt] ;
152 int nt2m1 = nt2 - 1 ;
160 double* yy =
new double[nt2] ;
161 double* cost =
new double[nt*nt2] ;
162 double* sint =
new double[nt*nt2] ;
167 double dt = M_PI / double(2*(nt2-1)) ;
168 for (j=0; j<nt-1; j++) {
169 for (j2=0; j2<nt2; j2++) {
170 double theta = j2*dt ;
171 cost[nt2*j + j2] =
cos( (2*j+1) * theta ) ;
172 sint[nt2*j + j2] =
sin( 2*j * theta ) ;
181 for (m=0; m < np/2+1 ; m++) {
185 double* leg = legendre_norm(m, nt) ;
190 for (l=m/2; l<nt-1; l++) {
194 for (j=0; j<nt-1; j++) {
198 for (j2=0; j2<nt2; j2++) {
199 yy[nt2m1-j2] = cost[nt2*j + j2] *
200 leg[nt2* (ll-m) + j2] ;
205 cfrchebp(deg, deg, yy, deg, yy) ;
206 tab[indice][ nt*nt* m + nt*l + j] =
207 2.*int1d_chebp(nt2, yy) ;
220 for (l=(m+1)/2; l<nt-1; l++) {
224 for (j=0; j<nt-1; j++) {
228 for (j2=0; j2<nt2; j2++) {
229 yy[nt2m1-j2] = sint[nt2*j + j2] *
230 leg[nt2* (ll-m) + j2] ;
235 cfrchebp(deg, deg, yy, deg, yy) ;
236 tab[indice][ nt*nt* m + nt*l + j] =
237 2.*int1d_chebp(nt2, yy) ;
Cmp cos(const Cmp &)
Cosine.
Cmp sin(const Cmp &)
Sine.