gsl/wrk.patch

180 lines
4.7 KiB
Diff
Raw Normal View History

2013-01-16 14:03:45 +00:00
diff -up wrk/ode-initval2/msbdf.c.wrk wrk/ode-initval2/msbdf.c
2013-01-17 14:12:43 +00:00
--- wrk/ode-initval2/msbdf.c.wrk 2013-01-09 10:35:45.259960403 +0100
2013-01-17 16:13:11 +00:00
+++ wrk/ode-initval2/msbdf.c 2013-01-17 17:00:39.904038985 +0100
2013-01-17 14:56:14 +00:00
@@ -43,6 +43,8 @@
framework.
*/
+#define PD(fl) printf("%lu\n", *((unsigned long *)&(fl)))
+
#include <config.h>
#include <stdlib.h>
#include <string.h>
@@ -116,7 +118,6 @@ static void *
2013-01-17 14:12:43 +00:00
msbdf_alloc (size_t dim)
{
msbdf_state_t *state = (msbdf_state_t *) malloc (sizeof (msbdf_state_t));
-
if (state == 0)
{
GSL_ERROR_NULL ("failed to allocate space for msbdf_state", GSL_ENOMEM);
2013-01-17 14:56:14 +00:00
@@ -611,6 +612,15 @@ msbdf_calccoeffs (const size_t ord, cons
printf ("errcoeff=%.5e\n", *errcoeff);
#endif
2013-01-17 15:23:03 +00:00
+/*PD(l[0]);
2013-01-17 14:56:14 +00:00
+PD(l[1]);
+PD(*errcoeff);
+PD(*ordm1coeff);
+PD(*ordp1coeff);
+PD(*ordp2coeff);
+PD(*gamma);
+printf("\n");
2013-01-17 15:23:03 +00:00
+*/
2013-01-17 14:56:14 +00:00
return GSL_SUCCESS;
}
2013-01-17 15:52:25 +00:00
@@ -1082,7 +1092,7 @@ msbdf_apply (void *vstate, size_t dim, d
const gsl_odeiv2_system * sys)
{
/* Carries out a step by BDF linear multistep methods. */
-
2013-01-17 16:13:11 +00:00
+//PD(h);
2013-01-17 15:52:25 +00:00
msbdf_state_t *state = (msbdf_state_t *) vstate;
double *const z = state->z;
2013-01-17 15:23:03 +00:00
@@ -1466,7 +1476,10 @@ msbdf_apply (void *vstate, size_t dim, d
/* Calculate polynomial coefficients (l), error coefficient and
auxiliary coefficients
*/
-
2013-01-17 15:52:25 +00:00
+/*printf("%d\n", ord);
2013-01-17 15:24:04 +00:00
+printf("%lu\n", state->ordwait);
2013-01-17 15:23:03 +00:00
+PD(h);
2013-01-17 15:52:25 +00:00
+PD(hprev[0]);*/
2013-01-17 15:23:03 +00:00
msbdf_calccoeffs (ord, state->ordwait, h, hprev, l, &errcoeff,
&ordm1coeff, &ordp1coeff, &ordp2coeff, &gamma);
2013-01-17 14:16:32 +00:00
2013-01-16 14:03:45 +00:00
diff -up wrk/ode-initval2/test.c.wrk wrk/ode-initval2/test.c
--- wrk/ode-initval2/test.c.wrk 2013-01-09 10:48:22.051415928 +0100
2013-01-17 16:13:11 +00:00
+++ wrk/ode-initval2/test.c 2013-01-17 17:12:50.880664280 +0100
2013-01-16 14:03:45 +00:00
@@ -923,6 +923,18 @@ rhs_ringmod (double t, const double y[],
f[13] = (-y[0] + uin1 - (ri + rg1) * y[13]) / ls1;
f[14] = (-y[1] - (rc + rg1) * y[14]) / ls1;
+ /*int i;
+ printf("temp states\n");
+ for (i=0; i<15; ++i) {
+
+ printf("%lu\n", *((unsigned long *)(&(y[i]))));
+ }
+
+ printf("%lu\n", *((unsigned long *)(&(rg2))));
+ printf("%lu\n", *((unsigned long *)(&(ls2))));
+ printf("%lu\n", *((unsigned long *)(&(rg3))));
+ printf("%lu\n", *((unsigned long *)(&(ls3))));
+*/
return GSL_SUCCESS;
}
2013-01-17 12:24:50 +00:00
2013-01-17 16:13:11 +00:00
@@ -1239,6 +1251,8 @@ test_evolve_system (const gsl_odeiv2_ste
gsl_odeiv2_driver_free (d);
}
+#define PD(fl) printf("%lu\n", *((unsigned long *)&(fl)))
+
int
sys_driver (const gsl_odeiv2_step_type * T,
const gsl_odeiv2_system * sys,
@@ -1264,10 +1278,23 @@ sys_driver (const gsl_odeiv2_step_type *
2013-01-17 13:20:57 +00:00
nfe = 0;
nje = 0;
+ int poc=0;
while (t < t1)
{
2013-01-17 16:13:11 +00:00
+ printf("pred\n");
+ PD(h);
2013-01-17 13:20:57 +00:00
s = gsl_odeiv2_evolve_apply (d->e, d->c, d->s, sys, &t, t1, &h, y);
2013-01-17 14:18:50 +00:00
2013-01-17 13:20:57 +00:00
+ printf("\nkrok %d\n", ++poc);
2013-01-17 16:13:11 +00:00
+printf("po\n");
+PD(h);
2013-01-17 14:18:50 +00:00
+/* int k;
2013-01-17 13:20:57 +00:00
+ for (k=0; k<15; ++k) {
2013-01-17 13:43:43 +00:00
+ printf(" %lu\n",(*(unsigned long int *)(&(y[k]))));
2013-01-17 13:20:57 +00:00
+ }
2013-01-17 13:43:43 +00:00
+ printf(" %lu\n",(*(unsigned long int *)(&t)));
2013-01-17 14:12:43 +00:00
+*/
2013-01-17 13:20:57 +00:00
+ //printf("\n");
#ifdef DEBUG
printf ("%.5e %.5e %.5e %d\n", t, y[0], y[1],
gsl_odeiv2_step_order (d->s));
2013-01-17 16:13:11 +00:00
@@ -1959,7 +1986,7 @@ test_extreme_problems (void)
2013-01-17 13:20:57 +00:00
/* Loop over problems */
- for (p = 0; p < CONST_EXTREME_NPROB; p++)
+ for (p = 2; p < CONST_EXTREME_NPROB; p++)
{
/* Initialize */
2013-01-17 16:13:11 +00:00
@@ -2001,12 +2028,13 @@ test_extreme_problems (void)
2013-01-17 13:20:57 +00:00
/* Call each solver for the problem */
- for (i = 0; steppers[i] != 0; i++)
+ for (i = 1; steppers[i] != 0; i++)
{
+ printf("spustam driver p=%ld i=%ld\n", p, i);
int s = sys_driver (steppers[i], prob[p], start[p], end[p],
initstepsize[p], &y[sd[p] * i],
epsabs[p], epsrel[p], probname[p]);
-
+ printf("koniec drivera\n");
if (s != GSL_SUCCESS)
{
printf ("start=%.5e, initstepsize=%.5e\n", start[p],
2013-01-17 16:13:11 +00:00
@@ -2450,7 +2478,7 @@ main (void)
2013-01-17 13:20:57 +00:00
/* Basic tests for all steppers */
- for (i = 0; p[i].type != 0; i++)
+ /*for (i = 0; p[i].type != 0; i++)
{
test_stepper (p[i].type);
}
2013-01-17 16:13:11 +00:00
@@ -2469,9 +2497,9 @@ main (void)
2013-01-17 13:20:57 +00:00
test_stepsize_fail (p[i].type, p[i].h);
test_user_break (p[i].type, p[i].h);
}
-
+*/
/* Derivative test for explicit steppers */
-
+/*
explicit_stepper[0].type = gsl_odeiv2_step_rk4;
explicit_stepper[0].h = 1.0e-3;
explicit_stepper[1].type = gsl_odeiv2_step_rk2;
2013-01-17 16:13:11 +00:00
@@ -2491,16 +2519,16 @@ main (void)
2013-01-17 13:20:57 +00:00
test_stepfn (explicit_stepper[i].type);
test_stepfn2 (explicit_stepper[i].type);
}
-
+*/
/* Special tests */
- test_nonstiff_problems ();
+ // test_nonstiff_problems ();
- test_stiff_problems ();
+ // test_stiff_problems ();
test_extreme_problems ();
- test_driver ();
+ //test_driver ();
exit (gsl_test_summary ());
}