Mercurial > octave
annotate libinterp/corefcn/dasrt.cc @ 20703:85e5efae848a
eliminate more uses of error_state
* ov.h, ov.cc: Provide more value extractors that handle error messages.
* besselj.cc, daspk.cc, dasrt.cc, dassl.cc, file-io.cc, graphics.cc,
matrix_type.cc, ordschur.cc, utils.cc, __eigs__.cc,
__magick_read__.cc: Eliminate more uses of error_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Nov 2015 12:07:38 -0500 |
parents | 5f04bfc7c17a |
children | 7b608fadc663 |
rev | line source |
---|---|
3990 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
3 Copyright (C) 2002-2015 John W. Eaton |
3990 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3990 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3990 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
4052 | 27 #include <iostream> |
3990 | 28 #include <string> |
29 | |
30 #include "DASRT.h" | |
31 #include "lo-mappers.h" | |
32 | |
15039
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14854
diff
changeset
|
33 #include "defun.h" |
3990 | 34 #include "error.h" |
35 #include "gripes.h" | |
36 #include "oct-obj.h" | |
37 #include "ov-fcn.h" | |
5729 | 38 #include "ov-cell.h" |
3990 | 39 #include "pager.h" |
40 #include "parse.h" | |
41 #include "unwind-prot.h" | |
42 #include "utils.h" | |
43 #include "variables.h" | |
44 | |
3998 | 45 #include "DASRT-opts.cc" |
46 | |
4115 | 47 // Global pointers for user defined function required by dasrt. |
3990 | 48 static octave_function *dasrt_f; |
49 static octave_function *dasrt_j; | |
50 static octave_function *dasrt_cf; | |
51 | |
4140 | 52 // Have we warned about imaginary values returned from user function? |
53 static bool warned_fcn_imaginary = false; | |
54 static bool warned_jac_imaginary = false; | |
55 static bool warned_cf_imaginary = false; | |
56 | |
3990 | 57 // Is this a recursive call? |
58 static int call_depth = 0; | |
59 | |
60 static ColumnVector | |
4628 | 61 dasrt_user_f (const ColumnVector& x, const ColumnVector& xdot, |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
62 double t, octave_idx_type&) |
3990 | 63 { |
64 ColumnVector retval; | |
65 | |
20229
5dfaaaae784f
Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents:
19697
diff
changeset
|
66 assert (x.numel () == xdot.numel ()); |
3990 | 67 |
4628 | 68 octave_value_list args; |
3990 | 69 |
3993 | 70 args(2) = t; |
4628 | 71 args(1) = xdot; |
72 args(0) = x; | |
3990 | 73 |
74 if (dasrt_f) | |
75 { | |
76 octave_value_list tmp = dasrt_f->do_multi_index_op (1, args); | |
77 | |
78 if (tmp.length () > 0 && tmp(0).is_defined ()) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
79 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
80 if (! warned_fcn_imaginary && tmp(0).is_complex_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
81 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
82 warning ("dasrt: ignoring imaginary part returned from user-supplied function"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
83 warned_fcn_imaginary = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
84 } |
4140 | 85 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
86 retval = tmp(0).vector_value (); |
3990 | 87 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
88 if (retval.numel () == 0) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
89 gripe_user_supplied_eval ("dasrt"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
90 } |
3990 | 91 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
92 gripe_user_supplied_eval ("dasrt"); |
3990 | 93 } |
94 | |
95 return retval; | |
96 } | |
97 | |
98 static ColumnVector | |
99 dasrt_user_cf (const ColumnVector& x, double t) | |
100 { | |
101 ColumnVector retval; | |
102 | |
103 octave_value_list args; | |
104 | |
105 args(1) = t; | |
4628 | 106 args(0) = x; |
3990 | 107 |
108 if (dasrt_cf) | |
109 { | |
110 octave_value_list tmp = dasrt_cf->do_multi_index_op (1, args); | |
111 | |
112 if (tmp.length () > 0 && tmp(0).is_defined ()) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
113 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
114 if (! warned_cf_imaginary && tmp(0).is_complex_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
115 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
116 warning ("dasrt: ignoring imaginary part returned from user-supplied constraint function"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
117 warned_cf_imaginary = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
118 } |
4140 | 119 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
120 retval = tmp(0).vector_value (); |
3990 | 121 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
122 if (retval.numel () == 0) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
123 gripe_user_supplied_eval ("dasrt"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
124 } |
3990 | 125 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
126 gripe_user_supplied_eval ("dasrt"); |
3990 | 127 } |
128 | |
129 return retval; | |
130 } | |
131 | |
132 static Matrix | |
3993 | 133 dasrt_user_j (const ColumnVector& x, const ColumnVector& xdot, |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
134 double t, double cj) |
3990 | 135 { |
136 Matrix retval; | |
137 | |
20229
5dfaaaae784f
Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents:
19697
diff
changeset
|
138 assert (x.numel () == xdot.numel ()); |
3990 | 139 |
3993 | 140 octave_value_list args; |
141 | |
142 args(3) = cj; | |
143 args(2) = t; | |
4628 | 144 args(1) = xdot; |
145 args(0) = x; | |
3990 | 146 |
3993 | 147 if (dasrt_j) |
148 { | |
149 octave_value_list tmp = dasrt_j->do_multi_index_op (1, args); | |
3990 | 150 |
3993 | 151 int tlen = tmp.length (); |
152 if (tlen > 0 && tmp(0).is_defined ()) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
153 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
154 if (! warned_jac_imaginary && tmp(0).is_complex_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
155 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
156 warning ("dasrt: ignoring imaginary part returned from user-supplied jacobian function"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
157 warned_jac_imaginary = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
158 } |
4140 | 159 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
160 retval = tmp(0).matrix_value (); |
3990 | 161 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
162 if (retval.numel () == 0) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
163 gripe_user_supplied_eval ("dasrt"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
164 } |
3990 | 165 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
166 gripe_user_supplied_eval ("dasrt"); |
3990 | 167 } |
168 | |
169 return retval; | |
170 } | |
171 | |
172 #define DASRT_ABORT \ | |
10066
2cd940306a06
make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
173 return retval |
3990 | 174 |
175 #define DASRT_ABORT1(msg) \ | |
176 do \ | |
177 { \ | |
20428
7ac907da9fba
Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
178 error ("dasrt: " msg); \ |
3990 | 179 DASRT_ABORT; \ |
180 } \ | |
181 while (0) | |
182 | |
183 #define DASRT_ABORT2(fmt, arg) \ | |
184 do \ | |
185 { \ | |
20428
7ac907da9fba
Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
186 error ("dasrt: " fmt, arg); \ |
3990 | 187 DASRT_ABORT; \ |
188 } \ | |
189 while (0) | |
190 | |
15039
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14854
diff
changeset
|
191 DEFUN (dasrt, args, nargout, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
192 "-*- texinfo -*-\n\ |
15039
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14854
diff
changeset
|
193 @deftypefn {Built-in Function} {[@var{x}, @var{xdot}, @var{t_out}, @var{istat}, @var{msg}] =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t})\n\ |
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14854
diff
changeset
|
194 @deftypefnx {Built-in Function} {@dots{} =} dasrt (@var{fcn}, @var{g}, @var{x_0}, @var{xdot_0}, @var{t})\n\ |
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14854
diff
changeset
|
195 @deftypefnx {Built-in Function} {@dots{} =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\ |
e753177cde93
maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents:
14854
diff
changeset
|
196 @deftypefnx {Built-in Function} {@dots{} =} dasrt (@var{fcn}, @var{g}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\ |
4115 | 197 Solve the set of differential-algebraic equations\n\ |
198 @tex\n\ | |
4852 | 199 $$ 0 = f (x, \\dot{x}, t) $$\n\ |
4115 | 200 with\n\ |
201 $$ x(t_0) = x_0, \\dot{x}(t_0) = \\dot{x}_0 $$\n\ | |
202 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
7017
diff
changeset
|
203 @ifnottex\n\ |
3990 | 204 \n\ |
205 @example\n\ | |
4852 | 206 0 = f (x, xdot, t)\n\ |
4115 | 207 @end example\n\ |
208 \n\ | |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
209 @noindent\n\ |
4115 | 210 with\n\ |
211 \n\ | |
212 @example\n\ | |
213 x(t_0) = x_0, xdot(t_0) = xdot_0\n\ | |
3990 | 214 @end example\n\ |
215 \n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
7017
diff
changeset
|
216 @end ifnottex\n\ |
4115 | 217 with functional stopping criteria (root solving).\n\ |
218 \n\ | |
219 The solution is returned in the matrices @var{x} and @var{xdot},\n\ | |
220 with each row in the result matrices corresponding to one of the\n\ | |
221 elements in the vector @var{t_out}. The first element of @var{t}\n\ | |
222 should be @math{t_0} and correspond to the initial state of the\n\ | |
223 system @var{x_0} and its derivative @var{xdot_0}, so that the first\n\ | |
224 row of the output @var{x} is @var{x_0} and the first row\n\ | |
225 of the output @var{xdot} is @var{xdot_0}.\n\ | |
226 \n\ | |
227 The vector @var{t} provides an upper limit on the length of the\n\ | |
228 integration. If the stopping condition is met, the vector\n\ | |
229 @var{t_out} will be shorter than @var{t}, and the final element of\n\ | |
230 @var{t_out} will be the point at which the stopping condition was met,\n\ | |
231 and may not correspond to any element of the vector @var{t}.\n\ | |
232 \n\ | |
8787 | 233 The first argument, @var{fcn}, is a string, inline, or function handle\n\ |
234 that names the function @math{f} to call to compute the vector of\n\ | |
235 residuals for the set of equations. It must have the form\n\ | |
3990 | 236 \n\ |
237 @example\n\ | |
4115 | 238 @var{res} = f (@var{x}, @var{xdot}, @var{t})\n\ |
3990 | 239 @end example\n\ |
240 \n\ | |
241 @noindent\n\ | |
4115 | 242 in which @var{x}, @var{xdot}, and @var{res} are vectors, and @var{t} is a\n\ |
243 scalar.\n\ | |
244 \n\ | |
8787 | 245 If @var{fcn} is a two-element string array or a two-element cell array\n\ |
9067
8970b4b10e9f
Cleanup documentation for quad.texi and diffeq.texi
Rik <rdrider0-list@yahoo.com>
parents:
9064
diff
changeset
|
246 of strings, inline functions, or function handles, the first element names\n\ |
8787 | 247 the function @math{f} described above, and the second element names a\n\ |
248 function to compute the modified Jacobian\n\ | |
3990 | 249 \n\ |
4115 | 250 @tex\n\ |
251 $$\n\ | |
252 J = {\\partial f \\over \\partial x}\n\ | |
253 + c {\\partial f \\over \\partial \\dot{x}}\n\ | |
254 $$\n\ | |
255 @end tex\n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
7017
diff
changeset
|
256 @ifnottex\n\ |
3990 | 257 \n\ |
4115 | 258 @example\n\ |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
259 @group\n\ |
4115 | 260 df df\n\ |
261 jac = -- + c ------\n\ | |
262 dx d xdot\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
263 @end group\n\ |
4115 | 264 @end example\n\ |
265 \n\ | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
7017
diff
changeset
|
266 @end ifnottex\n\ |
4115 | 267 \n\ |
268 The modified Jacobian function must have the form\n\ | |
269 \n\ | |
270 @example\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
271 @group\n\ |
3990 | 272 \n\ |
4115 | 273 @var{jac} = j (@var{x}, @var{xdot}, @var{t}, @var{c})\n\ |
274 \n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
275 @end group\n\ |
4115 | 276 @end example\n\ |
3990 | 277 \n\ |
4115 | 278 The optional second argument names a function that defines the\n\ |
279 constraint functions whose roots are desired during the integration.\n\ | |
280 This function must have the form\n\ | |
3990 | 281 \n\ |
4115 | 282 @example\n\ |
283 @var{g_out} = g (@var{x}, @var{t})\n\ | |
284 @end example\n\ | |
3990 | 285 \n\ |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10840
diff
changeset
|
286 @noindent\n\ |
4115 | 287 and return a vector of the constraint function values.\n\ |
10840 | 288 If the value of any of the constraint functions changes sign, @sc{dasrt}\n\ |
4115 | 289 will attempt to stop the integration at the point of the sign change.\n\ |
290 \n\ | |
291 If the name of the constraint function is omitted, @code{dasrt} solves\n\ | |
4852 | 292 the same problem as @code{daspk} or @code{dassl}.\n\ |
3990 | 293 \n\ |
4115 | 294 Note that because of numerical errors in the constraint functions\n\ |
10840 | 295 due to round-off and integration error, @sc{dasrt} may return false\n\ |
4115 | 296 roots, or return the same root at two or more nearly equal values of\n\ |
297 @var{T}. If such false roots are suspected, the user should consider\n\ | |
298 smaller error tolerances or higher precision in the evaluation of the\n\ | |
299 constraint functions.\n\ | |
3990 | 300 \n\ |
4115 | 301 If a root of some constraint function defines the end of the problem,\n\ |
10840 | 302 the input to @sc{dasrt} should nevertheless allow integration to a\n\ |
303 point slightly past that root, so that @sc{dasrt} can locate the root\n\ | |
4115 | 304 by interpolation.\n\ |
3990 | 305 \n\ |
4115 | 306 The third and fourth arguments to @code{dasrt} specify the initial\n\ |
307 condition of the states and their derivatives, and the fourth argument\n\ | |
308 specifies a vector of output times at which the solution is desired,\n\ | |
309 including the time corresponding to the initial condition.\n\ | |
310 \n\ | |
311 The set of initial states and derivatives are not strictly required to\n\ | |
10840 | 312 be consistent. In practice, however, @sc{dassl} is not very good at\n\ |
4115 | 313 determining a consistent set for you, so it is best if you ensure that\n\ |
314 the initial values result in the function evaluating to zero.\n\ | |
3990 | 315 \n\ |
4115 | 316 The sixth argument is optional, and may be used to specify a set of\n\ |
317 times that the DAE solver should not integrate past. It is useful for\n\ | |
318 avoiding difficulties with singularities and points where there is a\n\ | |
319 discontinuity in the derivative.\n\ | |
3990 | 320 \n\ |
4115 | 321 After a successful computation, the value of @var{istate} will be\n\ |
10840 | 322 greater than zero (consistent with the Fortran version of @sc{dassl}).\n\ |
4115 | 323 \n\ |
324 If the computation is not successful, the value of @var{istate} will be\n\ | |
325 less than zero and @var{msg} will contain additional information.\n\ | |
3990 | 326 \n\ |
327 You can use the function @code{dasrt_options} to set optional\n\ | |
328 parameters for @code{dasrt}.\n\ | |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
329 @seealso{dasrt_options, daspk, dasrt, lsode}\n\ |
5642 | 330 @end deftypefn") |
3990 | 331 { |
332 octave_value_list retval; | |
333 | |
4140 | 334 warned_fcn_imaginary = false; |
335 warned_jac_imaginary = false; | |
336 warned_cf_imaginary = false; | |
337 | |
10066
2cd940306a06
make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
338 unwind_protect frame; |
3990 | 339 |
10066
2cd940306a06
make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents:
9377
diff
changeset
|
340 frame.protect_var (call_depth); |
3990 | 341 call_depth++; |
342 | |
343 if (call_depth > 1) | |
344 DASRT_ABORT1 ("invalid recursive call"); | |
345 | |
346 int argp = 0; | |
347 | |
348 int nargin = args.length (); | |
349 | |
350 if (nargin < 4 || nargin > 6) | |
351 { | |
5823 | 352 print_usage (); |
3990 | 353 return retval; |
354 } | |
355 | |
5729 | 356 std::string fcn_name, fname, jac_name, jname; |
3990 | 357 dasrt_f = 0; |
358 dasrt_j = 0; | |
359 dasrt_cf = 0; | |
360 | |
361 // Check all the arguments. Are they the right animals? | |
362 | |
363 // Here's where I take care of f and j in one shot: | |
364 | |
365 octave_value f_arg = args(0); | |
366 | |
5729 | 367 if (f_arg.is_cell ()) |
3990 | 368 { |
5729 | 369 Cell c = f_arg.cell_value (); |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20229
diff
changeset
|
370 if (c.numel () == 1) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
371 f_arg = c(0); |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20229
diff
changeset
|
372 else if (c.numel () == 2) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
373 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
374 if (c(0).is_function_handle () || c(0).is_inline_function ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
375 dasrt_f = c(0).function_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
376 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
377 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
378 fcn_name = unique_symbol_name ("__dasrt_fcn__"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
379 fname = "function y = "; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
380 fname.append (fcn_name); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
381 fname.append (" (x, xdot, t) y = "); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
382 dasrt_f = extract_function (c(0), "dasrt", fcn_name, fname, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
383 "; endfunction"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
384 } |
5729 | 385 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
386 if (dasrt_f) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
387 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
388 if (c(1).is_function_handle () || c(1).is_inline_function ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
389 dasrt_j = c(1).function_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
390 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
391 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
392 jac_name = unique_symbol_name ("__dasrt_jac__"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
393 jname = "function jac = "; |
14854
5ae9f0f77635
maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents:
14846
diff
changeset
|
394 jname.append (jac_name); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
395 jname.append (" (x, xdot, t, cj) jac = "); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
396 dasrt_j = extract_function (c(1), "dasrt", jac_name, jname, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
397 "; endfunction"); |
5729 | 398 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
399 if (!dasrt_j) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
400 { |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
401 if (fcn_name.length ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
402 clear_function (fcn_name); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
403 dasrt_f = 0; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
404 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
405 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
406 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
407 } |
5729 | 408 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
409 DASRT_ABORT1 ("incorrect number of elements in cell array"); |
5729 | 410 } |
411 | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
412 if (!dasrt_f && ! f_arg.is_cell ()) |
5729 | 413 { |
414 if (f_arg.is_function_handle () || f_arg.is_inline_function ()) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
415 dasrt_f = f_arg.function_value (); |
5729 | 416 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
417 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
418 switch (f_arg.rows ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
419 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
420 case 1: |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
421 fcn_name = unique_symbol_name ("__dasrt_fcn__"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
422 fname = "function y = "; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
423 fname.append (fcn_name); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
424 fname.append (" (x, xdot, t) y = "); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
425 dasrt_f = extract_function (f_arg, "dasrt", fcn_name, fname, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
426 "; endfunction"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
427 break; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
428 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
429 case 2: |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
430 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
431 string_vector tmp = args(0).all_strings (); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
432 |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
433 fcn_name = unique_symbol_name ("__dasrt_fcn__"); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
434 fname = "function y = "; |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
435 fname.append (fcn_name); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
436 fname.append (" (x, xdot, t) y = "); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
437 dasrt_f = extract_function (tmp(0), "dasrt", fcn_name, |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
438 fname, "; endfunction"); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
439 |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
440 if (dasrt_f) |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
441 { |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
442 jac_name = unique_symbol_name ("__dasrt_jac__"); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
443 jname = "function jac = "; |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
444 jname.append (jac_name); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
445 jname.append (" (x, xdot, t, cj) jac = "); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
446 dasrt_j = extract_function (tmp(1), "dasrt", jac_name, |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
447 jname, "; endfunction"); |
5729 | 448 |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
449 if (! dasrt_j) |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
450 dasrt_f = 0; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
451 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
452 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
453 break; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
454 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
455 default: |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
456 DASRT_ABORT1 |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
457 ("first arg should be a string or 2-element string array"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
458 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
459 } |
3990 | 460 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
461 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
462 if (! dasrt_f) |
3990 | 463 DASRT_ABORT; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
464 |
3990 | 465 DAERTFunc func (dasrt_user_f); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
466 |
3990 | 467 argp++; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
468 |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
469 if (args(1).is_function_handle () || args(1).is_inline_function ()) |
5729 | 470 { |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
471 dasrt_cf = args(1).function_value (); |
5729 | 472 |
473 if (! dasrt_cf) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
474 DASRT_ABORT1 ("expecting function name as argument 2"); |
5729 | 475 |
476 argp++; | |
477 | |
478 func.set_constraint_function (dasrt_user_cf); | |
479 } | |
480 else if (args(1).is_string ()) | |
3990 | 481 { |
482 dasrt_cf = is_valid_function (args(1), "dasrt", true); | |
483 if (! dasrt_cf) | |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
484 DASRT_ABORT1 ("expecting function name as argument 2"); |
3990 | 485 |
486 argp++; | |
487 | |
488 func.set_constraint_function (dasrt_user_cf); | |
489 } | |
490 | |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
491 ColumnVector state = args(argp).xvector_value ("expecting state vector as argument %d", ++argp); |
3990 | 492 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
493 ColumnVector stateprime = args(argp).xvector_value ("expecting time derivative of state vector as argument %d", argp); |
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
494 argp++; |
3990 | 495 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
496 ColumnVector out_times = args(argp).xvector_value ("expecting output time vector as %s argument %d", argp); |
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
497 argp++; |
3990 | 498 |
3994 | 499 double tzero = out_times (0); |
3990 | 500 |
501 ColumnVector crit_times; | |
502 | |
503 bool crit_times_set = false; | |
504 | |
505 if (argp < nargin) | |
506 { | |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
507 crit_times = args(argp).xvector_value ("expecting critical time vector as argument %d", argp); |
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
508 argp++; |
3990 | 509 |
510 crit_times_set = true; | |
511 } | |
512 | |
513 if (dasrt_j) | |
514 func.set_jacobian_function (dasrt_user_j); | |
515 | |
516 DASRT_result output; | |
517 | |
3992 | 518 DASRT dae = DASRT (state, stateprime, tzero, func); |
3990 | 519 |
4122 | 520 dae.set_options (dasrt_opts); |
3990 | 521 |
522 if (crit_times_set) | |
523 output = dae.integrate (out_times, crit_times); | |
524 else | |
525 output = dae.integrate (out_times); | |
526 | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
527 if (fcn_name.length ()) |
5729 | 528 clear_function (fcn_name); |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
529 if (jac_name.length ()) |
5729 | 530 clear_function (jac_name); |
531 | |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
532 std::string msg = dae.error_message (); |
3997 | 533 |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
534 retval(4) = msg; |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
535 retval(3) = static_cast<double> (dae.integration_state ()); |
3997 | 536 |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
537 if (dae.integration_ok ()) |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
538 { |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
539 retval(2) = output.times (); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
540 retval(1) = output.deriv (); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
541 retval(0) = output.state (); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
542 } |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
543 else |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
544 { |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
545 retval(2) = Matrix (); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
546 retval(1) = Matrix (); |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
547 retval(0) = Matrix (); |
3997 | 548 |
20557
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
549 if (nargout < 4) |
b10432a40432
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
550 error ("dasrt: %s", msg.c_str ()); |
3990 | 551 } |
552 | |
553 return retval; | |
554 } |