74 #include "type_parite.h" 93 void _d2sdx2_1d_pas_prevu(
int nr,
double* tb,
double *xo) {
94 cout <<
"d2sdx2 pas prevu..." << endl ;
95 cout <<
"Nombre de points : " << nr << endl ;
96 cout <<
"Valeurs : " << tb <<
" " << xo <<endl ;
105 void _d2sdx2_1d_r_chebu(
int nr,
double* tb,
double *xo)
108 static double* cx1 = 0x0 ;
109 static double* cx2 = 0x0 ;
110 static double* cx3 = 0x0 ;
111 static int nr_pre = 0 ;
116 if (cx1 != 0x0)
delete [] cx1 ;
117 if (cx2 != 0x0)
delete [] cx2 ;
118 if (cx3 != 0x0)
delete [] cx3 ;
119 cx1 =
new double [nr] ;
120 cx2 =
new double [nr] ;
121 cx3 =
new double [nr] ;
122 for (
int i=0 ; i<nr ; i++) {
123 cx1[i] = (i+2)*(i+2)*(i+2) ;
132 som1 = (nr-1)*(nr-1)*(nr-1) * tb[nr-1] ;
133 som2 = (nr-1) * tb[nr-1] ;
134 xo[nr-3] = som1 - (nr-3)*(nr-3)*som2 ;
135 for (
int i = nr-5 ; i >= 0 ; i -= 2 ) {
136 som1 += cx1[i] * tb[i+2] ;
137 som2 += cx2[i] * tb[i+2] ;
138 xo[i] = som1 - cx3[i] * som2 ;
142 som1 = (nr-2)*(nr-2)*(nr-2) * tb[nr-2] ;
143 som2 = (nr-2) * tb[nr-2] ;
144 xo[nr-4] = som1 - (nr-4)*(nr-4)*som2 ;
145 for (
int i = nr-6 ; i >= 0 ; i -= 2 ) {
146 som1 += cx1[i] * tb[i+2] ;
147 som2 += cx2[i] * tb[i+2] ;
148 xo[i] = som1 - cx3[i] * som2 ;
158 void _d2sdx2_1d_r_cheb(
int nr,
double* tb,
double *xo)
162 static double* cx1 = 0x0 ;
163 static double* cx2 = 0x0 ;
164 static double* cx3 = 0x0 ;
165 static int nr_pre = 0 ;
170 if (cx1 != 0x0)
delete [] cx1 ;
171 if (cx2 != 0x0)
delete [] cx2 ;
172 if (cx3 != 0x0)
delete [] cx3 ;
173 cx1 =
new double [nr] ;
174 cx2 =
new double [nr] ;
175 cx3 =
new double [nr] ;
176 for (
int i=0 ; i<nr ; i++) {
177 cx1[i] = (i+2)*(i+2)*(i+2) ;
186 som1 = (nr-1)*(nr-1)*(nr-1) * tb[nr-1] ;
187 som2 = (nr-1) * tb[nr-1] ;
188 xo[nr-3] = som1 - (nr-3)*(nr-3)*som2 ;
189 for (
int i = nr-5 ; i >= 0 ; i -= 2 ) {
190 som1 += cx1[i] * tb[i+2] ;
191 som2 += cx2[i] * tb[i+2] ;
192 xo[i] = som1 - cx3[i] * som2 ;
195 som1 = (nr-2)*(nr-2)*(nr-2) * tb[nr-2] ;
196 som2 = (nr-2) * tb[nr-2] ;
197 xo[nr-4] = som1 - (nr-4)*(nr-4)*som2 ;
198 for (
int i = nr-6 ; i >= 0 ; i -= 2 ) {
199 som1 += cx1[i] * tb[i+2] ;
200 som2 += cx2[i] * tb[i+2] ;
201 xo[i] = som1 - cx3[i] * som2 ;
211 void _d2sdx2_1d_r_jaco02(
int nr,
double* tb,
double *xo)
215 for (
int i = 0 ; i<nr ; i++) {
225 void _d2sdx2_1d_r_chebp(
int nr,
double* tb,
double *xo)
228 static double* cx1 = 0x0 ;
229 static double* cx2 = 0x0 ;
230 static double* cx3 = 0x0 ;
231 static int nr_pre = 0 ;
236 if (cx1 != 0x0)
delete [] cx1 ;
237 if (cx2 != 0x0)
delete [] cx2 ;
238 if (cx3 != 0x0)
delete [] cx3 ;
239 cx1 =
new double [nr] ;
240 cx2 =
new double [nr] ;
241 cx3 =
new double [nr] ;
242 for (
int i=0 ; i<nr ; i++) {
243 cx1[i] = 8*(i+1)*(i+1)*(i+1) ;
252 som1 = 8*(nr-1)*(nr-1)*(nr-1) * tb[nr-1] ;
253 som2 = 2*(nr-1) * tb[nr-1] ;
254 xo[nr-2] = som1 - 4*(nr-2)*(nr-2)*som2 ;
256 for (
int i = nr-3 ; i >= 0 ; i-- ) {
257 som1 += cx1[i] * tb[i+1] ;
258 som2 += cx2[i] * tb[i+1] ;
259 xo[i] = som1 - cx3[i] * som2 ;
268 void _d2sdx2_1d_r_chebi(
int nr,
double* tb,
double *xo)
271 static double* cx1 = 0x0 ;
272 static double* cx2 = 0x0 ;
273 static double* cx3 = 0x0 ;
274 static int nr_pre = 0 ;
280 if (cx1 != 0x0)
delete [] cx1 ;
281 if (cx2 != 0x0)
delete [] cx2 ;
282 if (cx3 != 0x0)
delete [] cx3 ;
283 cx1 =
new double [nr] ;
284 cx2 =
new double [nr] ;
285 cx3 =
new double [nr] ;
286 for (
int i=0 ; i<nr ; i++) {
287 cx1[i] = (2*i+3)*(2*i+3)*(2*i+3) ;
289 cx3[i] = (2*i+1)*(2*i+1) ;
297 som1 = (2*nr-1)*(2*nr-1)*(2*nr-1) * tb[nr-1] ;
298 som2 = (2*nr-1) * tb[nr-1] ;
299 xo[nr-2] = som1 - (2*nr-3)*(2*nr-3)*som2 ;
300 for (
int i = nr-3 ; i >= 0 ; i-- ) {
301 som1 += cx1[i] * tb[i+1] ;
302 som2 += cx2[i] * tb[i+1] ;
303 xo[i] = som1 - cx3[i] * som2 ;
312 void _d2sdx2_1d_r_leg(
int nr,
double* tb,
double *xo)
316 static double* cx1 = 0x0 ;
317 static double* cx2 = 0x0 ;
318 static double* cx3 = 0x0 ;
319 static int nr_pre = 0 ;
324 if (cx1 != 0x0)
delete [] cx1 ;
325 if (cx2 != 0x0)
delete [] cx2 ;
326 if (cx3 != 0x0)
delete [] cx3 ;
327 cx1 =
new double [nr] ;
328 cx2 =
new double [nr] ;
329 cx3 =
new double [nr] ;
330 for (
int i=0 ; i<nr ; i++) {
331 cx1[i] = (i+2)*(i+3) ;
333 cx3[i] = double(i) + 0.5 ;
340 som1 = (nr-1)* nr * tb[nr-1] ;
343 xo[nr-3] = (double(nr) - 2.5) * (som1 - (nr-3)*(nr-2)*som2) ;
344 for (
int i = nr-5 ; i >= 0 ; i -= 2 ) {
345 som1 += cx1[i] * tb[i+2] ;
347 xo[i] = cx3[i]*(som1 - cx2[i] * som2) ;
349 if (nr > 1) xo[nr-2] = 0 ;
351 som1 = (nr-2)*(nr-1) * tb[nr-2] ;
353 xo[nr-4] = (double(nr) - 3.5) * (som1 - (nr-4)*(nr-3)*som2) ;
355 for (
int i = nr-6 ; i >= 0 ; i -= 2 ) {
356 som1 += cx1[i] * tb[i+2] ;
358 xo[i] = cx3[i]*(som1 - cx2[i] * som2) ;
367 void _d2sdx2_1d_r_legp(
int nr,
double* tb,
double *xo)
370 static double* cx1 = 0x0 ;
371 static double* cx2 = 0x0 ;
372 static double* cx3 = 0x0 ;
373 static int nr_pre = 0 ;
378 if (cx1 != 0x0)
delete [] cx1 ;
379 if (cx2 != 0x0)
delete [] cx2 ;
380 if (cx3 != 0x0)
delete [] cx3 ;
381 cx1 =
new double [nr] ;
382 cx2 =
new double [nr] ;
383 cx3 =
new double [nr] ;
384 for (
int i=0 ; i<nr ; i++) {
385 cx1[i] = (2*i+2)*(2*i+3) ;
386 cx2[i] = 2*i*2*(i+1) ;
387 cx3[i] = double(2*i)+ 0.5 ;
394 som1 = (2*nr-2)*(2*nr-1)* tb[nr-1] ;
397 xo[nr-2] = (double(2*nr) - 1.5)*(som1 - 2*(nr-2)*(2*nr-1)*som2) ;
398 for (
int i = nr-3 ; i >= 0 ; i-- ) {
399 som1 += cx1[i] * tb[i+1] ;
401 xo[i] = cx3[i]*(som1 - cx2[i]*som2) ;
409 void _d2sdx2_1d_r_legi(
int nr,
double* tb,
double *xo)
412 static double* cx1 = 0x0 ;
413 static double* cx2 = 0x0 ;
414 static double* cx3 = 0x0 ;
415 static int nr_pre = 0 ;
421 if (cx1 != 0x0)
delete [] cx1 ;
422 if (cx2 != 0x0)
delete [] cx2 ;
423 if (cx3 != 0x0)
delete [] cx3 ;
424 cx1 =
new double [nr] ;
425 cx2 =
new double [nr] ;
426 cx3 =
new double [nr] ;
427 for (
int i=0 ; i<nr ; i++) {
428 cx1[i] = (2*i+3)*(2*i+4) ;
429 cx2[i] = (2*i+1)*(2*i+2) ;
430 cx3[i] = double(2*i) + 1.5 ;
438 som1 = (2*nr-1)*(2*nr) * tb[nr-1] ;
441 xo[nr-2] = (double(nr) - 1.5)*(som1 - (2*nr-3)*(2*nr-2)*som2) ;
442 for (
int i = nr-3 ; i >= 0 ; i-- ) {
443 som1 += cx1[i] * tb[i+1] ;
445 xo[i] = cx3[i]*(som1 - cx2[i] * som2) ;
455 void d2sdx2_1d(
int nr,
double** tb,
int base_r)
459 static void (*d2sdx2_1d[
MAX_BASE])(int,
double*,
double *) ;
466 d2sdx2_1d[i] = _d2sdx2_1d_pas_prevu ;
473 d2sdx2_1d[
R_LEG >>
TRA_R] = _d2sdx2_1d_r_leg ;
479 double *result =
new double[nr] ;
481 d2sdx2_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 R_JACO02
base de Jacobi(0,2) ordinaire (finjac)
#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 R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#define MAX_BASE
Nombre max. de bases differentes.
#define R_LEG
base de Legendre ordinaire (fin)
#define R_CHEB
base de Chebychev ordinaire (fin)