comparison src/fsolve.cc @ 2086:bfb775fb6fe8

[project @ 1996-04-25 05:55:19 by jwe]
author jwe
date Thu, 25 Apr 1996 05:55:19 +0000
parents 003570e69c7b
children 36903d507b0e
comparison
equal deleted inserted replaced
2085:7603b37325db 2086:bfb775fb6fe8
83 { 83 {
84 ColumnVector retval; 84 ColumnVector retval;
85 85
86 int n = x.capacity (); 86 int n = x.capacity ();
87 87
88 Octave_object args; 88 octave_value_list args;
89 args.resize (1); 89 args.resize (1);
90 90
91 if (n > 1) 91 if (n > 1)
92 { 92 {
93 Matrix m (n, 1); 93 Matrix m (n, 1);
94 for (int i = 0; i < n; i++) 94 for (int i = 0; i < n; i++)
95 m (i, 0) = x.elem (i); 95 m (i, 0) = x.elem (i);
96 tree_constant vars (m); 96 octave_value vars (m);
97 args(0) = vars; 97 args(0) = vars;
98 } 98 }
99 else 99 else
100 { 100 {
101 double d = x.elem (0); 101 double d = x.elem (0);
102 tree_constant vars (d); 102 octave_value vars (d);
103 args(0) = vars; 103 args(0) = vars;
104 } 104 }
105 105
106 if (fsolve_fcn) 106 if (fsolve_fcn)
107 { 107 {
108 Octave_object tmp = fsolve_fcn->eval (0, 1, args); 108 octave_value_list tmp = fsolve_fcn->eval (0, 1, args);
109 if (tmp.length () > 0 && tmp(0).is_defined ()) 109 if (tmp.length () > 0 && tmp(0).is_defined ())
110 { 110 {
111 retval = tmp(0).vector_value (); 111 retval = tmp(0).vector_value ();
112 112
113 if (error_state || retval.length () <= 0) 113 if (error_state || retval.length () <= 0)
130 \n\ 130 \n\
131 y = f (x) 131 y = f (x)
132 \n\ 132 \n\
133 where y and x are vectors.") 133 where y and x are vectors.")
134 { 134 {
135 Octave_object retval; 135 octave_value_list retval;
136 136
137 int nargin = args.length (); 137 int nargin = args.length ();
138 138
139 if (nargin != 2 || nargout > 3) 139 if (nargin != 2 || nargout > 3)
140 { 140 {
258 } 258 }
259 259
260 warning ("fsolve_options: no match for `%s'", keyword.c_str ()); 260 warning ("fsolve_options: no match for `%s'", keyword.c_str ());
261 } 261 }
262 262
263 static Octave_object 263 static octave_value_list
264 show_fsolve_option (const string& keyword) 264 show_fsolve_option (const string& keyword)
265 { 265 {
266 Octave_object retval; 266 octave_value_list retval;
267 267
268 NLEQN_OPTIONS *list = fsolve_option_table; 268 NLEQN_OPTIONS *list = fsolve_option_table;
269 269
270 while (list->keyword != 0) 270 while (list->keyword != 0)
271 { 271 {
286 "fsolve_options (KEYWORD, VALUE)\n\ 286 "fsolve_options (KEYWORD, VALUE)\n\
287 \n\ 287 \n\
288 Set or show options for fsolve. Keywords may be abbreviated\n\ 288 Set or show options for fsolve. Keywords may be abbreviated\n\
289 to the shortest match.") 289 to the shortest match.")
290 { 290 {
291 Octave_object retval; 291 octave_value_list retval;
292 292
293 int nargin = args.length (); 293 int nargin = args.length ();
294 294
295 if (nargin == 0) 295 if (nargin == 0)
296 { 296 {