28char prepa_pvect_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_pois_vect_r/prepa_pvect_r.C,v 1.4 2014/10/13 08:53:34 j_novak Exp $" ;
56#include "type_parite.h"
74Matrice _nondeg_pvect_r_pas_prevu(
const Matrice &,
int ,
double,
int) ;
75Matrice _nondeg_pvect_r_cheb (
const Matrice&,
int,
double,
int) ;
76Matrice _nondeg_pvect_r_chebp (
const Matrice&,
int,
double,
int) ;
77Matrice _nondeg_pvect_r_chebi (
const Matrice&,
int,
double,
int) ;
78Matrice _nondeg_pvect_r_chebu (
const Matrice&,
int,
double,
int) ;
85Matrice _nondeg_pvect_r_pas_prevu(
const Matrice &lap,
int l,
double echelle,
int puis) {
86 cout <<
"Construction non degeneree pas prevue..." << endl ;
87 cout <<
"l : " << l << endl ;
88 cout <<
"lap : " << lap << endl ;
89 cout <<
"echelle : " << echelle << endl ;
90 cout <<
" puis : " << puis << endl ;
103Matrice _nondeg_pvect_r_cheb (
const Matrice &lap,
int l,
double echelle,
int) {
108 const int nmax = 200 ;
109 static Matrice* tab[nmax] ;
110 static int nb_dejafait = 0 ;
111 static int l_dejafait[nmax] ;
112 static int nr_dejafait[nmax] ;
113 static double vieux_echelle = 0;
116 if (vieux_echelle != echelle) {
117 for (
int i=0 ; i<nb_dejafait ; i++) {
119 nr_dejafait[i] = -1 ;
122 vieux_echelle = echelle ;
129 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
130 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
135 if (nb_dejafait >= nmax) {
136 cout <<
"_nondeg_pvect_r_cheb : trop de matrices" << endl ;
142 l_dejafait[nb_dejafait] = l ;
143 nr_dejafait[nb_dejafait] = n ;
148 Matrice res(n-2, n-2) ;
150 for (
int i=0 ; i<n-2 ; i++)
151 for (
int j=0 ; j<n-2 ; j++)
152 res.set(i, j) = lap(i, j+2) ;
156 tab[nb_dejafait] =
new Matrice(res) ;
163 return *tab[indice] ;
173Matrice _nondeg_pvect_r_chebp (
const Matrice &lap,
int l,
double,
int) {
178 const int nmax = 200 ;
179 static Matrice* tab[nmax] ;
180 static int nb_dejafait = 0 ;
181 static int l_dejafait[nmax] ;
182 static int nr_dejafait[nmax] ;
187 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
188 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
193 if (nb_dejafait >= nmax) {
194 cout <<
"_nondeg_pvect_r_chebp : trop de matrices" << endl ;
200 l_dejafait[nb_dejafait] = l ;
201 nr_dejafait[nb_dejafait] = n ;
203 assert (div(l, 2).rem == 1) ;
206 Matrice res(n-1, n-1) ;
208 for (
int i=0 ; i<n-1 ; i++)
209 for (
int j=0 ; j<n-1 ; j++)
210 res.set(i, j) = lap(i, j+1) ;
213 tab[nb_dejafait] =
new Matrice(res) ;
218 Matrice res(n-2, n-2) ;
220 for (
int i=0 ;i<n-2 ; i++)
221 for (
int j=0 ; j<n-2 ; j++)
222 res.set(i, j) = lap(i, j+2) ;
226 tab[nb_dejafait] =
new Matrice(res) ;
233 return *tab[indice] ;
243Matrice _nondeg_pvect_r_chebi (
const Matrice &lap,
int l,
double,
int) {
247 const int nmax = 200 ;
248 static Matrice* tab[nmax] ;
249 static int nb_dejafait = 0 ;
250 static int l_dejafait[nmax] ;
251 static int nr_dejafait[nmax] ;
256 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
257 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
262 if (nb_dejafait >= nmax) {
263 cout <<
"_nondeg_pvect_r_chebi : trop de matrices" << endl ;
269 l_dejafait[nb_dejafait] = l ;
270 nr_dejafait[nb_dejafait] = n ;
273 assert (div(l, 2).rem == 0) ;
277 Matrice res(n-1, n-1) ;
279 for (
int i=0 ; i<n-1 ; i++)
280 for (
int j=0 ; j<n-1 ; j++)
281 res.set(i, j) = lap(i, j+1) ;
284 tab[nb_dejafait] =
new Matrice(res) ;
289 Matrice res(n-2, n-2) ;
291 for (
int i=0 ;i<n-2 ; i++)
292 for (
int j=0 ; j<n-2 ; j++)
293 res.set(i, j) = lap(i, j+2) ;
297 tab[nb_dejafait] =
new Matrice(res) ;
304 return *tab[indice] ;
315Matrice _nondeg_pvect_r_chebu (
const Matrice &lap,
int l,
double,
int puis) {
318 cout <<
"_ope_pvect_r_mat_r_chebu : only the case dzpuis = 4 "
319 <<
'\n' <<
"is implemented! \n"
320 <<
"dzpuis = " << puis << endl ;
323 int n = lap.get_dim(0) ;
325 const int nmax = 200;
326 static Matrice* tab[nmax] ;
327 static int nb_dejafait = 0 ;
328 static int l_dejafait[nmax] ;
329 static int nr_dejafait[nmax] ;
334 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
335 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
340 if (nb_dejafait >= nmax) {
341 cout <<
"_nondeg_pvect_r_chebu : trop de matrices" << endl ;
346 l_dejafait[nb_dejafait] = l ;
347 nr_dejafait[nb_dejafait] = n ;
349 Matrice res(n-3, n-3) ;
351 for (
int i=0 ;i<n-3 ; i++)
352 for (
int j=0 ; j<n-3 ; j++)
353 res.set(i, j) = lap(i, j+3) ;
357 tab[nb_dejafait] =
new Matrice(res) ;
364 return *tab[indice] ;
373Matrice nondeg_pvect_r(
const Matrice &lap,
int l,
double echelle,
int puis,
int base_r)
377 static Matrice (*nondeg_pvect_r[
MAX_BASE])(
const Matrice&, int, double, int) ;
384 nondeg_pvect_r[i] = _nondeg_pvect_r_pas_prevu ;
387 nondeg_pvect_r[
R_CHEB >>
TRA_R] = _nondeg_pvect_r_cheb ;
388 nondeg_pvect_r[
R_CHEBU >>
TRA_R] = _nondeg_pvect_r_chebu ;
389 nondeg_pvect_r[
R_CHEBP >>
TRA_R] = _nondeg_pvect_r_chebp ;
390 nondeg_pvect_r[
R_CHEBI >>
TRA_R] = _nondeg_pvect_r_chebi ;
393 Matrice res(nondeg_pvect_r[base_r](lap, l, echelle, puis)) ;
int get_dim(int i) const
Returns the dimension of the matrix.
#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