1.5 to 1.6 ODE Init Val GSL_EBADFUNC
Tuomo Keskitalo
Tuomo.Keskitalo@iki.fi
Wed Apr 6 17:15:00 GMT 2005
Hello,
On Fri, Apr 01, 2005 at 07:36:30PM +0100, Brian Gough wrote:
> Kevin H. Hobbs writes:
> > Adjusting the derivatives may not be the right thing to do, but
> > shouldn't my error code make it all the way back out?
>
> Yes, the current code is inconsistent there. I think it gets
> propagated in some places but not others. I've made a note in the
> BUGS file.
This seems to be due to a misunderstanding of mine, sorry. I've
attached a patch for GSL-1.6 that should fix this problem in
GSL ode-initval.
Regards,
Tuomo
-- Tuomo.Keskitalo@iki.fi
-- http://www.iki.fi/tkeskita
-------------- next part --------------
diff -u gsl-1.6/ode-initval/bsimp.c gsl-1.6-odefixed/ode-initval/bsimp.c
--- gsl-1.6/ode-initval/bsimp.c 2004-12-02 23:54:19.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/bsimp.c 2005-04-06 18:32:49.000000000 +0300
@@ -283,7 +283,7 @@
if (status)
{
- return GSL_EBADFUNC;
+ return status;
}
for (n_inter = 1; n_inter < n_step; n_inter++)
@@ -315,7 +315,7 @@
if (status)
{
- return GSL_EBADFUNC;
+ return status;
}
}
@@ -435,7 +435,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -445,7 +445,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -466,16 +466,11 @@
y_extrap_sequence,
sys);
- if (status == GSL_EBADFUNC)
- {
- return GSL_EBADFUNC;
- }
-
if (status == GSL_EFAILED)
{
/* If the local step fails, set the error to infinity in
order to force a reduction in the step size */
-
+
for (i = 0; i < dim; i++)
{
yerr[i] = GSL_POSINF;
@@ -483,7 +478,12 @@
break;
}
-
+
+ else if (status != GSL_SUCCESS)
+ {
+ return status;
+ }
+
x[k] = x_k;
poly_extrap (d, x, k, x_k, y_extrap_sequence, y, yerr, extrap_work, dim);
@@ -499,7 +499,7 @@
{
DBL_MEMCPY (y, y_save, dim);
DBL_MEMCPY (yerr, yerr_save, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/evolve.c gsl-1.6-odefixed/ode-initval/evolve.c
--- gsl-1.6/ode-initval/evolve.c 2004-12-02 23:54:19.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/evolve.c 2005-04-06 18:13:59.000000000 +0300
@@ -147,7 +147,7 @@
if (status)
{
- return GSL_EBADFUNC;
+ return status;
}
}
diff -u gsl-1.6/ode-initval/gear1.c gsl-1.6-odefixed/ode-initval/gear1.c
--- gsl-1.6/ode-initval/gear1.c 2004-12-24 15:59:01.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/gear1.c 2005-04-06 18:14:40.000000000 +0300
@@ -130,7 +130,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
for (i=0; i<dim; i++)
diff -u gsl-1.6/ode-initval/gear2.c gsl-1.6-odefixed/ode-initval/gear2.c
--- gsl-1.6/ode-initval/gear2.c 2004-12-24 15:59:01.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/gear2.c 2005-04-06 18:41:37.000000000 +0300
@@ -155,7 +155,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
for (i = 0; i < dim; i++)
@@ -274,7 +274,7 @@
{
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
Only in gsl-1.6-odefixed/ode-initval: Makefile
diff -u gsl-1.6/ode-initval/rkck.c gsl-1.6-odefixed/ode-initval/rkck.c
--- gsl-1.6/ode-initval/rkck.c 2004-12-02 23:54:19.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rkck.c 2005-04-06 18:16:04.000000000 +0300
@@ -213,7 +213,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -226,7 +226,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -239,7 +239,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -252,7 +252,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -267,7 +267,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -282,7 +282,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -302,7 +302,7 @@
{
/* Restore initial values */
DBL_MEMCPY (y, y0, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rkf45.c gsl-1.6-odefixed/ode-initval/rkf45.c
--- gsl-1.6/ode-initval/rkf45.c 2004-12-02 23:54:19.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rkf45.c 2005-04-06 18:17:11.000000000 +0300
@@ -213,7 +213,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -226,7 +226,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -239,7 +239,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -252,7 +252,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -267,7 +267,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -282,7 +282,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -303,7 +303,7 @@
/* Restore initial values */
DBL_MEMCPY (y, y0, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rk2.c gsl-1.6-odefixed/ode-initval/rk2.c
--- gsl-1.6/ode-initval/rk2.c 2004-12-02 23:54:19.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rk2.c 2005-04-06 18:17:51.000000000 +0300
@@ -127,7 +127,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -144,7 +144,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -162,7 +162,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -190,7 +190,7 @@
/* Restore original values */
DBL_MEMCPY (y, ytmp, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rk2imp.c gsl-1.6-odefixed/ode-initval/rk2imp.c
--- gsl-1.6/ode-initval/rk2imp.c 2004-12-24 15:59:01.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rk2imp.c 2005-04-06 18:18:45.000000000 +0300
@@ -152,7 +152,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
}
@@ -206,7 +206,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -247,7 +247,7 @@
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -274,7 +274,7 @@
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rk2simp.c gsl-1.6-odefixed/ode-initval/rk2simp.c
--- gsl-1.6/ode-initval/rk2simp.c 2004-12-24 15:59:01.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rk2simp.c 2005-04-06 18:20:53.000000000 +0300
@@ -191,7 +191,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
gsl_matrix_scale (&J.matrix, -h / 2.0);
@@ -212,7 +212,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
/* Calculate Y1 = y0 + h/2 * ((1-h/2 * df/dy)^-1) ytmp */
@@ -235,7 +235,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
for (i = 0; i < dim; i++)
@@ -314,7 +314,7 @@
{
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rk4.c gsl-1.6-odefixed/ode-initval/rk4.c
--- gsl-1.6/ode-initval/rk4.c 2004-12-24 15:59:01.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rk4.c 2005-04-06 18:21:22.000000000 +0300
@@ -144,7 +144,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -160,7 +160,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -176,7 +176,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -221,7 +221,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -267,7 +267,7 @@
{
/* Restore original values */
DBL_MEMCPY (y, y0, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -297,7 +297,7 @@
{
/* Restore original values */
DBL_MEMCPY (y, k1, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rk4imp.c gsl-1.6-odefixed/ode-initval/rk4imp.c
--- gsl-1.6/ode-initval/rk4imp.c 2004-12-24 15:59:01.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rk4imp.c 2005-04-06 18:22:23.000000000 +0300
@@ -191,7 +191,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
{
@@ -200,7 +200,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
}
@@ -253,7 +253,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -268,7 +268,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -281,7 +281,7 @@
{
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -294,7 +294,7 @@
{
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -307,7 +307,7 @@
{
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -320,7 +320,7 @@
if (s != GSL_SUCCESS) {
/* Restore original y vector */
DBL_MEMCPY (y, y0_orig, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
diff -u gsl-1.6/ode-initval/rk8pd.c gsl-1.6-odefixed/ode-initval/rk8pd.c
--- gsl-1.6/ode-initval/rk8pd.c 2004-12-02 23:54:19.000000000 +0200
+++ gsl-1.6-odefixed/ode-initval/rk8pd.c 2005-04-06 18:23:52.000000000 +0300
@@ -264,7 +264,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -277,7 +277,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -290,7 +290,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -303,7 +303,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -316,7 +316,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -329,7 +329,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -344,7 +344,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -359,7 +359,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -374,7 +374,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -390,7 +390,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -406,7 +406,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -422,7 +422,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -439,7 +439,7 @@
if (s != GSL_SUCCESS)
{
- return GSL_EBADFUNC;
+ return s;
}
}
@@ -463,7 +463,7 @@
{
/* Restore initial values */
DBL_MEMCPY (y, y0, dim);
- return GSL_EBADFUNC;
+ return s;
}
}
More information about the Gsl-discuss
mailing list