28char sh_ptens_rr_C[] =
"$Heade$" ;
54#include "type_parite.h"
78Tbl _sh_ptens_rr_pas_prevu (
int,
int,
double) ;
79Tbl _sh_ptens_rr_cheb (
int,
int,
double) ;
80Tbl _sh_ptens_rr_chebp (
int,
int,
double) ;
81Tbl _sh_ptens_rr_chebi (
int,
int,
double) ;
82Tbl _sh_ptens_rr_chebu (
int,
int,
double) ;
87Tbl _sh_ptens_rr_pas_prevu (
int n,
int l,
double echelle) {
89 cout <<
" Solution homogene pas prevue ..... : "<< endl ;
90 cout <<
" N : " << n << endl ;
91 cout <<
" l : " << l << endl ;
92 cout <<
" echelle : " << echelle << endl ;
104Tbl _sh_ptens_rr_cheb (
int n,
int l,
double echelle) {
106 const int nmax = 200 ;
107 static Tbl* tab[nmax] ;
108 static int nb_dejafait = 0 ;
109 static int l_dejafait[nmax] ;
110 static int nr_dejafait[nmax] ;
111 static double vieux_echelle = 0;
114 if (vieux_echelle != echelle) {
115 for (
int i=0 ; i<nb_dejafait ; i++) {
117 nr_dejafait[i] = -1 ;
121 vieux_echelle = echelle ;
127 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
128 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
133 if (nb_dejafait >= nmax) {
134 cout <<
"_sh_ptens_rr_cheb : trop de Tbl" << endl ;
140 l_dejafait[nb_dejafait] = l ;
141 nr_dejafait[nb_dejafait] = n ;
145 double* coloc =
new double[n] ;
147 int * deg =
new int[3] ;
157 for (
int i=1 ; i<n ; i++)
161 for (
int i=0 ; i<n ; i++)
162 coloc[i] =
pow(echelle-
cos(M_PI*i/(n-1)),
double(l-2)) ;
164 cfrcheb(deg, deg, coloc, deg, coloc) ;
165 for (
int i=0 ; i<n ;i++)
166 res.set(0, i) = coloc[i] ;
172 for (
int i=0 ; i<n ; i++)
173 coloc[i] = 1/
pow(echelle-
cos(M_PI*i/(n-1)),
double(l+3)) ;
175 cfrcheb(deg, deg, coloc, deg, coloc) ;
176 for (
int i=0 ; i<n ;i++)
177 res.set(1, i) = coloc[i] ;
181 tab[nb_dejafait] =
new Tbl(res) ;
186 else return *tab[indice] ;
193Tbl _sh_ptens_rr_chebp (
int n,
int l,
double) {
195 const int nmax = 200 ;
196 static Tbl* tab[nmax] ;
197 static int nb_dejafait = 0 ;
198 static int l_dejafait[nmax] ;
199 static int nr_dejafait[nmax] ;
204 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
205 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
210 if (nb_dejafait >= nmax) {
211 cout <<
"_sh_ptens_rr_chebp : trop de Tbl" << endl ;
217 l_dejafait[nb_dejafait] = l ;
218 nr_dejafait[nb_dejafait] = n ;
222 double* coloc =
new double[n] ;
224 int * deg =
new int[3] ;
229 assert (l % 2 == 0) ;
232 for (
int i=1 ; i<n ; i++)
236 for (
int i=0 ; i<n ; i++)
237 coloc[i] =
pow(
sin(M_PI*i/2/(n-1)),
double(l-2)) ;
239 cfrchebp(deg, deg, coloc, deg, coloc) ;
240 for (
int i=0 ; i<n ;i++)
241 res.set(i) = coloc[i] ;
246 tab[nb_dejafait] =
new Tbl(res) ;
251 else return *tab[indice] ;
259Tbl _sh_ptens_rr_chebi (
int n,
int l,
double) {
261 const int nmax = 200 ;
262 static Tbl* tab[nmax] ;
263 static int nb_dejafait = 0 ;
264 static int l_dejafait[nmax] ;
265 static int nr_dejafait[nmax] ;
270 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
271 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
276 if (nb_dejafait >= nmax) {
277 cout <<
"_sh_ptens_rr_chebi : trop de Tbl" << endl ;
283 l_dejafait[nb_dejafait] = l ;
284 nr_dejafait[nb_dejafait] = n ;
291 double* coloc =
new double[n] ;
293 int * deg =
new int[3] ;
298 for (
int i=0 ; i<n ; i++)
299 coloc[i] =
pow(
sin(M_PI*i/2/(n-1)),
double(l-2)) ;
301 cfrchebi(deg, deg, coloc, deg, coloc) ;
302 for (
int i=0 ; i<n ;i++)
303 res.set(i) = coloc[i] ;
308 tab[nb_dejafait] =
new Tbl(res) ;
313 else return *tab[indice] ;
322Tbl _sh_ptens_rr_chebu (
int n,
int l,
double) {
324 const int nmax = 200 ;
325 static Tbl* tab[nmax] ;
326 static int nb_dejafait = 0 ;
327 static int l_dejafait[nmax] ;
328 static int nr_dejafait[nmax] ;
333 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
334 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
339 if (nb_dejafait >= nmax) {
340 cout <<
"_sh_ptens_rr_chebu : trop de Tbl" << endl ;
346 l_dejafait[nb_dejafait] = l ;
347 nr_dejafait[nb_dejafait] = n ;
351 double* coloc =
new double[n] ;
353 int * deg =
new int[3] ;
358 for (
int i=0 ; i<n ; i++)
359 coloc[i] =
pow(-1-
cos(M_PI*i/(n-1)),
double(l+3)) ;
361 cfrcheb(deg, deg, coloc, deg, coloc) ;
362 for (
int i=0 ; i<n ;i++)
363 res.set(i) = coloc[i] ;
367 tab[nb_dejafait] =
new Tbl(res) ;
372 else return *tab[indice] ;
383Tbl sh_ptens_rr(
int n,
int l,
double echelle,
int base_r) {
386 static Tbl (*sh_ptens_rr[
MAX_BASE])(int, int, double) ;
393 sh_ptens_rr[i] = _sh_ptens_rr_pas_prevu ;
404 Tbl res(sh_ptens_rr[base_r](n, l, echelle)) ;
Cmp sin(const Cmp &)
Sine.
Cmp pow(const Cmp &, int)
Power .
Cmp cos(const Cmp &)
Cosine.
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
#define R_CHEB
base de Chebychev ordinaire (fin)
#define R_CHEBP
base de Cheb. paire (rare) seulement