24char mat_cos_legmp_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/mat_cos_legmp.C,v 1.3 2014/10/13 08:53:13 j_novak Exp $" ;
92double* mat_cos_legmp(
int np,
int nt) {
95 static double* tab[NMAX] ;
96 static int nb_dejafait = 0 ;
97 static int np_dejafait[NMAX] ;
99 static int nt_dejafait[NMAX] ;
102 int i, indice, j, j2, m, l ;
107 for ( i=0 ; i < nb_dejafait ; i++ ) {
108 if ( (np_dejafait[i] == np) && (nt_dejafait[i] == nt) ) indice = i ;
114 if ( nb_dejafait >= NMAX ) {
115 cout <<
"mat_cos_legmp: nb_dejafait >= NMAX : "
116 << nb_dejafait <<
" <-> " << NMAX << endl ;
120 indice = nb_dejafait ;
122 np_dejafait[indice] = np ;
123 nt_dejafait[indice] = nt ;
125 tab[indice] =
new double[(np/2+1)*nt*nt] ;
133 int nt2m1 = nt2 - 1 ;
141 double* yy =
new double[nt2] ;
142 double* cost =
new double[nt*nt2] ;
147 double dt = M_PI / double(nt2-1) ;
148 for (j=0; j<nt; j++) {
149 for (j2=0; j2<nt2; j2++) {
150 double theta = j2*dt ;
151 cost[nt2*j + j2] =
cos( j * theta ) ;
161 if (np == 1) m_max = 0 ;
163 for (m=0; m <= m_max ; m+=2) {
167 double* leg = legendre_norm(m, nt) ;
169 for (l=m; l<nt; l++) {
171 int parite = 1 - 2*((l-m)%2) ;
172 for (j=0; j<nt; j++) {
176 for (j2=0; j2<nt; j2++) {
177 yy[nt2m1-j2] = cost[nt2*j + j2] *
178 leg[nt2* (l-m) + 2*j2] ;
181 for (j2 = nt; j2<nt2; j2++) {
182 yy[nt2m1-j2] = cost[nt2*j + j2] *
183 parite * leg[nt2* (l-m) + 2*nt2 -2 -2*j2] ;
188 cfrcheb(deg, deg, yy, deg, yy) ;
189 tab[indice][ nt*nt* m/2 + nt*l + j] =
190 int1d_cheb(nt2, yy) ;
Cmp cos(const Cmp &)
Cosine.