Mercurial > hg > octave-lyh
comparison src/DLD-FUNCTIONS/lsode.cc @ 3959:5a848097fe4a
[project @ 2002-05-24 17:58:16 by jwe]
author | jwe |
---|---|
date | Fri, 24 May 2002 17:58:17 +0000 |
parents | 5490981096f1 |
children | 3030cb6cb559 |
comparison
equal
deleted
inserted
replaced
3958:b88e01ad515e | 3959:5a848097fe4a |
---|---|
158 } \ | 158 } \ |
159 while (0) | 159 while (0) |
160 | 160 |
161 DEFUN_DLD (lsode, args, nargout, | 161 DEFUN_DLD (lsode, args, nargout, |
162 "-*- texinfo -*-\n\ | 162 "-*- texinfo -*-\n\ |
163 @deftypefn {Loadable Function} {} lsode (@var{fcn}, @var{x0}, @var{t}, @var{t_crit})\n\ | 163 @deftypefn {Loadable Function} {[@var{x}, @var{istate}, @var{msg}]} lsode (@var{fcn}, @var{x0}, @var{t}, @var{t_crit})\n\ |
164 Return a matrix of @var{x} as a function of @var{t}, given the initial\n\ | 164 Return a matrix of @var{x} as a function of @var{t}, given the initial\n\ |
165 state of the system @var{x0}. Each row in the result matrix corresponds\n\ | 165 state of the system @var{x0}. Each row in the result matrix corresponds\n\ |
166 to one of the elements in the vector @var{t}. The first element of\n\ | 166 to one of the elements in the vector @var{t}. The first element of\n\ |
167 @var{t} corresponds to the initial state @var{x0}, so that the first row\n\ | 167 @var{t} corresponds to the initial state @var{x0}, so that the first row\n\ |
168 of the output is @var{x0}.\n\ | 168 of the output is @var{x0}.\n\ |
194 if (call_depth > 1) | 194 if (call_depth > 1) |
195 LSODE_ABORT1 ("invalid recursive call"); | 195 LSODE_ABORT1 ("invalid recursive call"); |
196 | 196 |
197 int nargin = args.length (); | 197 int nargin = args.length (); |
198 | 198 |
199 if (nargin > 2 && nargin < 5 && nargout < 2) | 199 if (nargin > 2 && nargin < 5 && nargout < 4) |
200 { | 200 { |
201 octave_value f_arg = args(0); | 201 octave_value f_arg = args(0); |
202 | 202 |
203 switch (f_arg.rows ()) | 203 switch (f_arg.rows ()) |
204 { | 204 { |
281 else | 281 else |
282 output = ode.integrate (out_times); | 282 output = ode.integrate (out_times); |
283 | 283 |
284 if (! error_state) | 284 if (! error_state) |
285 { | 285 { |
286 retval.resize (1); | 286 retval(2) = ode.error_message (); |
287 retval(0) = output; | 287 retval(1) = static_cast<double> (ode.integration_state ()); |
288 | |
289 if (ode.integration_ok ()) | |
290 retval = output; | |
291 else | |
292 { | |
293 output = Matrix (); | |
294 | |
295 if (nargout < 2) | |
296 { | |
297 std::string msg = ode.error_message (); | |
298 error ("lsode: %s", msg.c_str ()); | |
299 } | |
300 } | |
288 } | 301 } |
289 } | 302 } |
290 else | 303 else |
291 print_usage ("lsode"); | 304 print_usage ("lsode"); |
292 | 305 |