Mercurial > octave
diff src/DLD-FUNCTIONS/dasrt.cc @ 4628:c0121a3b9cbe
[project @ 2003-11-17 20:19:07 by jwe]
author | jwe |
---|---|
date | Mon, 17 Nov 2003 20:19:07 +0000 |
parents | 303b28a7a7e4 |
children | 12b6fbd57436 |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/dasrt.cc Mon Nov 17 03:48:04 2003 +0000 +++ b/src/DLD-FUNCTIONS/dasrt.cc Mon Nov 17 20:19:07 2003 +0000 @@ -57,32 +57,18 @@ static int call_depth = 0; static ColumnVector -dasrt_user_f (const ColumnVector& x, const ColumnVector& xprime, +dasrt_user_f (const ColumnVector& x, const ColumnVector& xdot, double t, int& ires) { ColumnVector retval; - octave_value_list args; + assert (x.capacity () == xdot.capacity ()); - int n = x.length (); + octave_value_list args; args(2) = t; - - if (n > 1) - { - args(1) = xprime; - args(0) = x; - } - else if (n == 1) - { - args(1) = xprime(0); - args(0) = x(0); - } - else - { - args(1) = Matrix (); - args(0) = Matrix (); - } + args(1) = xdot; + args(0) = x; if (dasrt_f) { @@ -121,16 +107,8 @@ octave_value_list args; - int n = x.length (); - - if (n > 1) - args(0) = x; - else if (n == 1) - args(0) = x(0); - else - args(0) = Matrix (); - args(1) = t; + args(0) = x; if (dasrt_cf) { @@ -168,38 +146,14 @@ { Matrix retval; - int nstates = x.capacity (); - - assert (nstates == xdot.capacity ()); + assert (x.capacity () == xdot.capacity ()); octave_value_list args; args(3) = cj; args(2) = t; - - if (nstates > 1) - { - Matrix m1 (nstates, 1); - Matrix m2 (nstates, 1); - for (int i = 0; i < nstates; i++) - { - m1 (i, 0) = x (i); - m2 (i, 0) = xdot (i); - } - octave_value state (m1); - octave_value deriv (m2); - args(1) = deriv; - args(0) = state; - } - else - { - double d1 = x (0); - double d2 = xdot (0); - octave_value state (d1); - octave_value deriv (d2); - args(1) = deriv; - args(0) = state; - } + args(1) = xdot; + args(0) = x; if (dasrt_j) {