28char cl_pvect_r_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_pois_vect_r/cl_pvect_r.C,v 1.3 2014/10/13 08:53:34 j_novak Exp $" ;
52#include "type_parite.h"
68Matrice _cl_pvect_r_pas_prevu (
const Matrice&,
int,
double,
int) ;
69Matrice _cl_pvect_r_cheb (
const Matrice&,
int,
double,
int) ;
70Matrice _cl_pvect_r_chebi (
const Matrice&,
int,
double,
int) ;
71Matrice _cl_pvect_r_chebu (
const Matrice&,
int,
double,
int) ;
72Matrice _cl_pvect_r_chebp (
const Matrice&,
int,
double,
int) ;
75Matrice _cl_pvect_r_pas_prevu (
const Matrice &source,
int l,
double echelle,
int puis) {
76 cout <<
"Combinaison lineaire pas prevu..." << endl ;
77 cout <<
"Source : " << source << endl ;
78 cout <<
"l : " << l << endl ;
79 cout <<
"dzpuis : " << puis << endl ;
80 cout <<
"Echelle : " << echelle << endl ;
91Matrice _cl_pvect_r_cheb (
const Matrice &source,
int l,
double echelle,
int) {
92 int n = source.
get_dim(0) ;assert (n == source.get_dim(1)) ;
95 const int nmax = 100 ;
96 static Matrice* tab[nmax] ;
97 static int nb_dejafait = 0 ;
98 static int l_dejafait[nmax] ;
99 static int nr_dejafait[nmax] ;
100 static double vieux_echelle = 0 ;
103 if (vieux_echelle != echelle) {
104 for (
int i=0 ; i<nb_dejafait ; i++) {
106 nr_dejafait[i] = -1 ;
110 vieux_echelle = echelle ;
116 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
117 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
122 if (nb_dejafait >= nmax) {
123 cout <<
"_cl_pvect_r_cheb : trop de matrices" << endl ;
128 l_dejafait[nb_dejafait] = l ;
129 nr_dejafait[nb_dejafait] = n ;
131 Matrice barre(source) ;
133 for (
int i=0 ; i<n-2 ; i++) {
134 for (
int j=i ; j<(n>(i+7)? i+7 : n) ; j++)
135 barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j))
137 if (i==0) dirac = 0 ;
141 for (
int i=0 ; i<n-4 ; i++)
142 for (
int j=i ; j<(n>(i+5)? i+5 : n) ; j++)
143 res.set(i, j) = barre(i, j)-barre(i+2, j) ;
144 tab[nb_dejafait] =
new Matrice(res) ;
151 return *tab[indice] ;
159Matrice _cl_pvect_r_chebp (
const Matrice &source,
int l,
double,
int) {
162 assert (n == source.get_dim(1)) ;
164 const int nmax = 100 ;
165 static Matrice* tab[nmax] ;
166 static int nb_dejafait = 0 ;
167 static int l_dejafait[nmax] ;
168 static int nr_dejafait[nmax] ;
173 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
174 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
179 if (nb_dejafait >= nmax) {
180 cout <<
"_cl_pvect_r_chebp : trop de matrices" << endl ;
185 l_dejafait[nb_dejafait] = l ;
186 nr_dejafait[nb_dejafait] = n ;
188 Matrice barre(source) ;
191 for (
int i=0 ; i<n-2 ; i++) {
192 for (
int j=0 ; j<n ; j++)
193 barre.set(i, j) = (1+dirac)*source(i, j)-source(i+2, j) ;
194 if (i==0) dirac = 0 ;
197 Matrice tilde(barre) ;
198 for (
int i=0 ; i<n-4 ; i++)
199 for (
int j=0 ; j<n ; j++)
200 tilde.set(i, j) = barre(i, j)-barre(i+2, j) ;
203 for (
int i=0 ; i<n-4 ; i++)
204 for (
int j=0 ; j<n ; j++)
205 res.set(i, j) = tilde(i, j)-tilde(i+1, j) ;
206 tab[nb_dejafait] =
new Matrice(res) ;
213 return *tab[indice] ;
221Matrice _cl_pvect_r_chebi (
const Matrice &source,
int l,
double,
int) {
223 assert (n == source.get_dim(1)) ;
226 const int nmax = 100 ;
227 static Matrice* tab[nmax] ;
228 static int nb_dejafait = 0 ;
229 static int l_dejafait[nmax] ;
230 static int nr_dejafait[nmax] ;
235 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
236 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
241 if (nb_dejafait >= nmax) {
242 cout <<
"_cl_pvect_r_chebi : trop de matrices" << endl ;
247 l_dejafait[nb_dejafait] = l ;
248 nr_dejafait[nb_dejafait] = n ;
250 Matrice barre(source) ;
252 for (
int i=0 ; i<n-2 ; i++)
253 for (
int j=0 ; j<n ; j++)
254 barre.set(i, j) = source(i, j)-source(i+2, j) ;
256 Matrice tilde(barre) ;
257 for (
int i=0 ; i<n-4 ; i++)
258 for (
int j=0 ; j<n ; j++)
259 tilde.set(i, j) = barre(i, j)-barre(i+2, j) ;
262 for (
int i=0 ; i<n-4 ; i++)
263 for (
int j=0 ; j<n ; j++)
264 res.set(i, j) = tilde(i, j)-tilde(i+1, j) ;
265 tab[nb_dejafait] =
new Matrice(res) ;
272 return *tab[indice] ;
278Matrice _cl_pvect_r_chebu (
const Matrice &source,
int l,
double,
int puis) {
280 assert (n == source.get_dim(1)) ;
282 cout <<
"_ope_pvect_r_mat_r_chebu : only the case dzpuis = 4 "
283 <<
'\n' <<
"is implemented! \n"
284 <<
"dzpuis = " << puis << endl ;
288 const int nmax = 200 ;
289 static Matrice* tab[nmax] ;
290 static int nb_dejafait = 0 ;
291 static int l_dejafait[nmax] ;
292 static int nr_dejafait[nmax] ;
297 for (
int conte=0 ; conte<nb_dejafait ; conte ++)
298 if ((l_dejafait[conte] == l) && (nr_dejafait[conte] == n))
303 if (nb_dejafait >= nmax) {
304 cout <<
"_cl_pvect_r_chebu_quatre : trop de matrices" << endl ;
309 l_dejafait[nb_dejafait] = l ;
310 nr_dejafait[nb_dejafait] = n ;
312 Matrice barre(source) ;
315 for (
int i=0 ; i<n-2 ; i++) {
316 for (
int j=0 ; j<n ; j++)
317 barre.set(i, j) = ((1+dirac)*source(i, j)-source(i+2, j)) ;
318 if (i==0) dirac = 0 ;
321 Matrice tilde(barre) ;
322 for (
int i=0 ; i<n-4 ; i++)
323 for (
int j=0 ; j<n ; j++)
324 tilde.set(i, j) = (barre(i, j)-barre(i+2, j)) ;
326 Matrice prime(tilde) ;
327 for (
int i=0 ; i<n-4 ; i++)
328 for (
int j=0 ; j<n ; j++)
329 prime.set(i, j) = (tilde(i, j)-tilde(i+1, j)) ;
332 for (
int i=0 ; i<n-4 ; i++)
333 for (
int j=0 ; j<n ; j++)
334 res.set(i, j) = (prime(i, j)-prime(i+2, j)) ;
335 tab[nb_dejafait] =
new Matrice(res) ;
342 return *tab[indice] ;
350Matrice cl_pvect_r(
const Matrice &source,
int l,
double echelle,
351 int puis,
int base_r) {
354 static Matrice (*combinaison[
MAX_BASE])(
const Matrice &, int, double, int) ;
361 combinaison[i] = _cl_pvect_r_pas_prevu ;
370 Matrice res(combinaison[base_r](source, 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