60 #include "type_parite.h" 68 void _multx2_1d_pas_prevu(
int nr,
double* tb,
double *res) {
69 cout <<
"multx2 pas prevu..." << tb <<
" " << res << endl ;
70 cout <<
"nr : " << nr << endl ;
79 void _multx2_1d_r_chebp(
int nr,
double* tb,
double *xo) {
83 xo[0] = (2*tb[0]+tb[1])/4 ;
84 xo[1] = (2*tb[0]+2*tb[1]+tb[2])/4 ;
86 for (
int i=2 ; i<nr-1 ; i++)
87 xo[i] = (tb[i-1]+2*tb[i]+tb[i+1])/4 ;
89 xo[nr-1] = (tb[nr-2]+2*tb[nr-1])/4 ;
97 void _multx2_1d_r_chebi(
int nr,
double* tb,
double *xo){
101 xo[0] = (3*tb[0]+tb[1])/4 ;
103 for (
int i=1 ; i<nr-1 ; i++)
104 xo[i] = (tb[i-1]+2*tb[i]+tb[i+1])/4 ;
113 void _multx2_1d_r_cheb(
int nr,
double* tb,
double *xo){
117 xo[0] = (2*tb[0]+tb[2])/4 ;
118 xo[1] = (3*tb[1]+tb[3])/4 ;
119 xo[2] = (2*tb[0]+2*tb[2]+tb[4])/4 ;
121 for (
int i=3 ; i<nr-2 ; i++)
122 xo[i] = (tb[i-2]+2*tb[i]+tb[i+2])/4 ;
124 for (
int i=nr-2 ; i<nr ; i++)
125 xo[i] = (tb[i-2]+2*tb[i])/4 ;
133 void _multx2_1d_r_legp(
int nr,
double* tb,
double *xo) {
137 xo[0] = tb[0]/3. + 2.*tb[1]/15. ;
139 for (
int i=1 ; i<nr-1 ; i++)
140 xo[i] =
double(2*i*(2*i-1))*tb[i-1]/double((4*i-1)*(4*i-3))
141 + (double(4*i*i)/double((4*i-1)*(4*i+1))
142 + double((2*i+1)*(2*i+1))/double((4*i+1)*(4*i+3)))*tb[i]
143 +
double((2*i+1)*(2*i+2))*tb[i+1]/double((4*i+3)*(4*i+5)) ;
144 xo[nr-1] = double((2*nr-2)*(2*nr-3))*tb[nr-2]/double((4*nr-5)*(4*nr-7))
145 + (double(4*(nr-1)*(nr-1))/double((4*nr-5)*(4*nr-3))
146 + double((2*nr-1)*(2*nr-1))/double((4*nr-3)*(4*nr-1)))*tb[nr-1] ;
154 void _multx2_1d_r_legi(
int nr,
double* tb,
double *xo){
158 xo[0] = 0.6*tb[0] + 6.*tb[1]/35. ;
160 for (
int i=1 ; i<nr-1 ; i++)
161 xo[i] =
double(2*i*(2*i+1))*tb[i-1]/double((4*i+1)*(4*i-1))
162 + (double((2*i+1)*(2*i+1))/double((4*i+1)*(4*i+3))
163 + double((2*i+2)*(2*i+2))/double((4*i+3)*(4*i+5)) )*tb[i]
164 +
double((2*i+2)*(2*i+3))*tb[i+1]/double((4*i+7)*(4*i+5)) ;
172 void _multx2_1d_r_leg(
int nr,
double* tb,
double *xo){
176 xo[0] = tb[0]/3. + 2.*tb[2]/15. ;
177 xo[1] = 0.6*tb[1] + 6.*tb[3]/35. ;
178 for (
int i=2 ; i<nr-2 ; i++)
179 xo[i] =
double(i*(i-1))*tb[i-2]/double((2*i-1)*(2*i-3))
180 + (double(i*i)/double((2*i-1)*(2*i+1))
181 + double((i+1)*(i+1))/double((2*i+1)*(2*i+3)))*tb[i]
182 +
double((i+1)*(i+2))*tb[i+2]/double((2*i+3)*(2*i+5)) ;
183 for (
int i=nr-2 ; i<nr ; i++)
184 xo[i] =
double(i*(i-1))*tb[i-2]/double((2*i-1)*(2*i-3))
185 + (double(i*i)/double((2*i-1)*(2*i+1))
186 + double((i+1)*(i+1))/double((2*i+1)*(2*i+3)))*tb[i] ;
196 void multx2_1d(
int nr,
double **tb,
int base_r)
200 static void (*multx2_1d[
MAX_BASE])(int,
double *,
double*) ;
207 multx2_1d[i] = _multx2_1d_pas_prevu ;
213 multx2_1d[
R_LEG >>
TRA_R] = _multx2_1d_r_leg ;
218 double *result =
new double[nr] ;
219 multx2_1d[base_r](nr, *tb, result) ;
#define R_LEGP
base de Legendre paire (rare) seulement
#define R_LEGI
base de Legendre impaire (rare) seulement
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBP
base de Cheb. paire (rare) seulement
#define MAX_BASE
Nombre max. de bases differentes.
#define R_LEG
base de Legendre ordinaire (fin)
#define R_CHEB
base de Chebychev ordinaire (fin)