Mercurial > hg > octave-lyh
annotate src/ov-base.cc @ 9521:e08d72bb988e
simplify cloning
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 13 Aug 2009 11:52:07 +0200 |
parents | 67fc970dad7d |
children | 34d6f005db4b |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
8920 | 4 2006, 2007, 2008, 2009 John W. Eaton |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2376 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
4254 | 28 #include <climits> |
29 | |
3503 | 30 #include <iostream> |
2901 | 31 |
2376 | 32 #include "lo-ieee.h" |
4732 | 33 #include "lo-mappers.h" |
2376 | 34 |
5759 | 35 #include "defun.h" |
2376 | 36 #include "gripes.h" |
37 #include "oct-map.h" | |
2974 | 38 #include "oct-obj.h" |
2979 | 39 #include "oct-lvalue.h" |
3340 | 40 #include "oct-stream.h" |
2376 | 41 #include "ops.h" |
42 #include "ov-base.h" | |
3928 | 43 #include "ov-cell.h" |
44 #include "ov-ch-mat.h" | |
2376 | 45 #include "ov-complex.h" |
46 #include "ov-cx-mat.h" | |
3928 | 47 #include "ov-list.h" |
48 #include "ov-range.h" | |
49 #include "ov-re-mat.h" | |
50 #include "ov-scalar.h" | |
2376 | 51 #include "ov-str-mat.h" |
4343 | 52 #include "ov-fcn-handle.h" |
5759 | 53 #include "parse.h" |
54 #include "utils.h" | |
2948 | 55 #include "variables.h" |
2376 | 56 |
4612 | 57 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, |
58 "<unknown type>", "unknown"); | |
2376 | 59 |
7193 | 60 // TRUE means to perform automatic sparse to real mutation if there |
61 // is memory to be saved | |
62 bool Vsparse_auto_mutate = false; | |
63 | |
2376 | 64 octave_value |
4532 | 65 octave_base_value::squeeze (void) const |
66 { | |
67 std::string nm = type_name (); | |
68 error ("squeeze: invalid operation for %s type", nm.c_str ()); | |
69 return octave_value (); | |
70 } | |
71 | |
72 octave_value | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
73 octave_base_value::full_value (void) const |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
74 { |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
75 gripe_wrong_type_arg ("full: invalid operation for %s type", type_name ()); |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
76 return octave_value (); |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
77 } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
78 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
79 Matrix |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
80 octave_base_value::size (void) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
81 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
82 const dim_vector dv = dims (); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
83 Matrix mdv (1, dv.length ()); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
84 for (octave_idx_type i = 0; i < dv.length (); i++) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
85 mdv(i) = dv(i); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
86 return mdv; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
87 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
88 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
89 octave_idx_type |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
90 octave_base_value::numel (const octave_value_list& idx) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
91 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
92 octave_idx_type retval; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
93 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
94 octave_idx_type len = idx.length (); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
95 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
96 if (len == 0) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
97 retval = numel (); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
98 else |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
99 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
100 const dim_vector dv = dims ().redim (len); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
101 retval = 1; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
102 for (octave_idx_type i = 0; i < len; i++) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
103 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
104 if (idx(i).is_magic_colon ()) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
105 retval *= dv(i); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
106 else |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
107 retval *= idx(i).numel (); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
108 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
109 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
110 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
111 return retval; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
112 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
113 |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
114 octave_value |
4247 | 115 octave_base_value::subsref (const std::string&, |
4219 | 116 const std::list<octave_value_list>&) |
3933 | 117 { |
118 std::string nm = type_name (); | |
119 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
120 return octave_value (); | |
121 } | |
122 | |
123 octave_value_list | |
4247 | 124 octave_base_value::subsref (const std::string&, |
4219 | 125 const std::list<octave_value_list>&, int) |
3933 | 126 { |
127 std::string nm = type_name (); | |
128 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
129 return octave_value (); | |
130 } | |
131 | |
132 octave_value | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
133 octave_base_value::subsref (const std::string& type, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
134 const std::list<octave_value_list>& idx, |
8677
095ae5e0a831
eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
135 bool /* auto_add */) |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
136 { |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
137 // This way we may get a more meaningful error message. |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
138 return subsref (type, idx); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
139 } |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
140 |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
141 octave_value |
5885 | 142 octave_base_value::do_index_op (const octave_value_list&, bool) |
2974 | 143 { |
3523 | 144 std::string nm = type_name (); |
2974 | 145 error ("can't perform indexing operations for %s type", nm.c_str ()); |
146 return octave_value (); | |
147 } | |
148 | |
149 octave_value_list | |
3544 | 150 octave_base_value::do_multi_index_op (int, const octave_value_list&) |
2376 | 151 { |
3523 | 152 std::string nm = type_name (); |
2376 | 153 error ("can't perform indexing operations for %s type", nm.c_str ()); |
154 return octave_value (); | |
155 } | |
156 | |
157 idx_vector | |
158 octave_base_value::index_vector (void) const | |
159 { | |
3523 | 160 std::string nm = type_name (); |
2376 | 161 error ("%s type invalid as index value", nm.c_str ()); |
162 return idx_vector (); | |
163 } | |
164 | |
5759 | 165 int |
166 octave_base_value::ndims (void) const | |
167 { | |
168 dim_vector dv = dims (); | |
169 | |
170 int n_dims = dv.length (); | |
171 | |
172 // Remove trailing singleton dimensions. | |
173 | |
174 for (int i = n_dims; i > 2; i--) | |
175 { | |
176 if (dv(i-1) == 1) | |
177 n_dims--; | |
178 else | |
179 break; | |
180 } | |
181 | |
182 // The result is always >= 2. | |
183 | |
184 if (n_dims < 2) | |
185 n_dims = 2; | |
186 | |
187 return n_dims; | |
188 } | |
189 | |
2376 | 190 octave_value |
4247 | 191 octave_base_value::subsasgn (const std::string& type, |
4219 | 192 const std::list<octave_value_list>& idx, |
3933 | 193 const octave_value& rhs) |
2376 | 194 { |
3933 | 195 octave_value retval; |
2376 | 196 |
3933 | 197 if (is_defined ()) |
198 { | |
4139 | 199 if (is_numeric_type ()) |
200 { | |
201 switch (type[0]) | |
202 { | |
203 case '(': | |
204 { | |
205 if (type.length () == 1) | |
206 retval = numeric_assign (type, idx, rhs); | |
4436 | 207 else if (is_empty ()) |
208 { | |
209 // Allow conversion of empty matrix to some other | |
210 // type in cases like | |
211 // | |
212 // x = []; x(i).f = rhs | |
213 | |
214 octave_value tmp = octave_value::empty_conv (type, rhs); | |
215 | |
216 retval = tmp.subsasgn (type, idx, rhs); | |
217 } | |
4139 | 218 else |
219 { | |
220 std::string nm = type_name (); | |
221 error ("in indexed assignment of %s, last rhs index must be ()", | |
222 nm.c_str ()); | |
223 } | |
224 } | |
225 break; | |
226 | |
227 case '{': | |
228 case '.': | |
229 { | |
230 std::string nm = type_name (); | |
231 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); | |
232 } | |
233 break; | |
234 | |
235 default: | |
236 panic_impossible (); | |
237 } | |
238 } | |
239 else | |
240 { | |
241 std::string nm = type_name (); | |
242 error ("can't perform indexed assignment for %s type", nm.c_str ()); | |
243 } | |
3933 | 244 } |
245 else | |
246 { | |
247 // Create new object of appropriate type for given index and rhs | |
248 // types and then call subsasgn again for that object. | |
249 | |
250 octave_value tmp = octave_value::empty_conv (type, rhs); | |
251 | |
252 retval = tmp.subsasgn (type, idx, rhs); | |
253 } | |
254 | |
255 return retval; | |
2376 | 256 } |
257 | |
5602 | 258 octave_idx_type |
259 octave_base_value::nnz (void) const | |
260 { | |
261 gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ()); | |
262 return -1; | |
263 } | |
264 | |
5604 | 265 octave_idx_type |
266 octave_base_value::nzmax (void) const | |
267 { | |
268 gripe_wrong_type_arg ("octave_base_value::nzmax ()", type_name ()); | |
269 return -1; | |
270 } | |
271 | |
5900 | 272 octave_idx_type |
273 octave_base_value::nfields (void) const | |
274 { | |
275 gripe_wrong_type_arg ("octave_base_value::nfields ()", type_name ()); | |
276 return -1; | |
277 } | |
278 | |
2376 | 279 octave_value |
4567 | 280 octave_base_value::reshape (const dim_vector&) const |
281 { | |
282 gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ()); | |
283 return octave_value (); | |
284 } | |
285 | |
286 octave_value | |
4593 | 287 octave_base_value::permute (const Array<int>&, bool) const |
288 { | |
289 gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ()); | |
290 return octave_value (); | |
291 } | |
292 | |
293 octave_value | |
5731 | 294 octave_base_value::resize (const dim_vector&, bool) const |
4915 | 295 { |
296 gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ()); | |
297 return octave_value (); | |
298 } | |
299 | |
5785 | 300 MatrixType |
301 octave_base_value::matrix_type (void) const | |
302 { | |
303 gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); | |
304 return MatrixType (); | |
305 } | |
306 | |
307 MatrixType | |
308 octave_base_value::matrix_type (const MatrixType&) const | |
309 { | |
310 gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); | |
311 return MatrixType (); | |
312 } | |
313 | |
4915 | 314 octave_value |
5759 | 315 octave_base_value::all (int) const |
316 { | |
317 return 0.0; | |
318 } | |
319 | |
320 octave_value | |
321 octave_base_value::any (int) const | |
322 { | |
323 return 0.0; | |
324 } | |
325 | |
326 octave_value | |
327 octave_base_value::convert_to_str (bool pad, bool force, char type) const | |
328 { | |
329 octave_value retval = convert_to_str_internal (pad, force, type); | |
330 | |
5781 | 331 if (! force && is_numeric_type ()) |
332 gripe_implicit_conversion ("Octave:num-to-str", | |
333 type_name (), retval.type_name ()); | |
5759 | 334 |
335 return retval; | |
336 } | |
337 | |
338 octave_value | |
5279 | 339 octave_base_value::convert_to_str_internal (bool, bool, char) const |
2376 | 340 { |
4452 | 341 gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()", |
2376 | 342 type_name ()); |
343 return octave_value (); | |
344 } | |
345 | |
346 void | |
347 octave_base_value::convert_to_row_or_column_vector (void) | |
348 { | |
349 gripe_wrong_type_arg | |
350 ("octave_base_value::convert_to_row_or_column_vector ()", | |
351 type_name ()); | |
352 } | |
353 | |
354 void | |
3523 | 355 octave_base_value::print (std::ostream&, bool) const |
2376 | 356 { |
3195 | 357 gripe_wrong_type_arg ("octave_base_value::print ()", type_name ()); |
2376 | 358 } |
359 | |
2901 | 360 void |
3523 | 361 octave_base_value::print_raw (std::ostream&, bool) const |
2901 | 362 { |
3195 | 363 gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ()); |
2901 | 364 } |
365 | |
366 bool | |
3523 | 367 octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const |
2901 | 368 { |
4604 | 369 bool retval = false; |
370 | |
2901 | 371 indent (os); |
4604 | 372 |
373 if (print_as_scalar ()) | |
374 os << name << " = "; | |
375 else | |
376 { | |
377 os << name << " ="; | |
378 newline (os); | |
379 newline (os); | |
380 retval = true; | |
381 } | |
382 | |
383 return retval; | |
2901 | 384 } |
385 | |
3933 | 386 void |
5759 | 387 octave_base_value::print_with_name (std::ostream& output_buf, |
388 const std::string& name, | |
9521 | 389 bool print_padding) |
5759 | 390 { |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
391 bool pad_after = print_name_tag (output_buf, name); |
5759 | 392 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
393 print (output_buf); |
5759 | 394 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
395 if (print_padding && pad_after) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
396 newline (output_buf); |
5759 | 397 } |
398 | |
399 void | |
3933 | 400 octave_base_value::print_info (std::ostream& os, |
4661 | 401 const std::string& /* prefix */) const |
3933 | 402 { |
403 os << "no info for type: " << type_name () << "\n"; | |
404 } | |
405 | |
4254 | 406 #define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \ |
407 T \ | |
408 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \ | |
409 { \ | |
410 T retval = 0; \ | |
411 \ | |
412 double d = double_value (frc_str_conv); \ | |
413 \ | |
414 if (! error_state) \ | |
415 { \ | |
416 if (require_int && D_NINT (d) != d) \ | |
417 error ("conversion of %g to " #T " value failed", d); \ | |
5054 | 418 else if (d < MIN_LIMIT) \ |
419 retval = MIN_LIMIT; \ | |
420 else if (d > MAX_LIMIT) \ | |
421 retval = MAX_LIMIT; \ | |
4254 | 422 else \ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
423 retval = static_cast<T> (::fix (d)); \ |
4254 | 424 } \ |
425 else \ | |
426 gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \ | |
427 type_name ()); \ | |
428 \ | |
429 return retval; \ | |
430 } | |
3202 | 431 |
4254 | 432 INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX) |
433 INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX) | |
3202 | 434 |
4254 | 435 INT_CONV_METHOD (int, int, INT_MIN, INT_MAX) |
436 INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX) | |
3202 | 437 |
4254 | 438 INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX) |
439 INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX) | |
3202 | 440 |
441 int | |
442 octave_base_value::nint_value (bool frc_str_conv) const | |
443 { | |
444 int retval = 0; | |
445 | |
446 double d = double_value (frc_str_conv); | |
447 | |
448 if (! error_state) | |
449 { | |
450 if (xisnan (d)) | |
451 { | |
452 error ("conversion of NaN to integer value failed"); | |
453 return retval; | |
454 } | |
455 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
456 retval = static_cast<int> (::fix (d)); |
3202 | 457 } |
458 else | |
459 gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ()); | |
460 | |
461 return retval; | |
462 } | |
463 | |
2376 | 464 double |
465 octave_base_value::double_value (bool) const | |
466 { | |
4102 | 467 double retval = lo_ieee_nan_value (); |
2376 | 468 gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ()); |
469 return retval; | |
470 } | |
471 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
472 float |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
473 octave_base_value::float_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
474 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
475 float retval = lo_ieee_float_nan_value (); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
476 gripe_wrong_type_arg ("octave_base_value::float_value ()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
477 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
478 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
479 |
3351 | 480 Cell |
3539 | 481 octave_base_value::cell_value () const |
3351 | 482 { |
483 Cell retval; | |
484 gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ()); | |
485 return retval; | |
486 } | |
487 | |
2376 | 488 Matrix |
489 octave_base_value::matrix_value (bool) const | |
490 { | |
491 Matrix retval; | |
492 gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ()); | |
493 return retval; | |
494 } | |
495 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
496 FloatMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
497 octave_base_value::float_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
498 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
499 FloatMatrix retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
500 gripe_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
501 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
502 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
503 |
4507 | 504 NDArray |
4550 | 505 octave_base_value::array_value (bool) const |
4505 | 506 { |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
507 FloatNDArray retval; |
4550 | 508 gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ()); |
4505 | 509 return retval; |
510 } | |
511 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
512 FloatNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
513 octave_base_value::float_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
514 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
515 FloatNDArray retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
516 gripe_wrong_type_arg ("octave_base_value::float_array_value()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
517 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
518 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
519 |
2376 | 520 Complex |
521 octave_base_value::complex_value (bool) const | |
522 { | |
4102 | 523 double tmp = lo_ieee_nan_value (); |
524 Complex retval (tmp, tmp); | |
2376 | 525 gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ()); |
526 return retval; | |
527 } | |
528 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
529 FloatComplex |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
530 octave_base_value::float_complex_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
531 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
532 float tmp = lo_ieee_float_nan_value (); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
533 FloatComplex retval (tmp, tmp); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
534 gripe_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
535 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
536 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
537 |
2376 | 538 ComplexMatrix |
539 octave_base_value::complex_matrix_value (bool) const | |
540 { | |
541 ComplexMatrix retval; | |
542 gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()", | |
543 type_name ()); | |
544 return retval; | |
545 } | |
546 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
547 FloatComplexMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
548 octave_base_value::float_complex_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
549 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
550 FloatComplexMatrix retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
551 gripe_wrong_type_arg ("octave_base_value::float_complex_matrix_value()", |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
552 type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
553 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
554 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
555 |
4550 | 556 ComplexNDArray |
557 octave_base_value::complex_array_value (bool) const | |
558 { | |
559 ComplexNDArray retval; | |
560 gripe_wrong_type_arg ("octave_base_value::complex_array_value()", | |
561 type_name ()); | |
562 return retval; | |
563 } | |
564 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
565 FloatComplexNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
566 octave_base_value::float_complex_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
567 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
568 FloatComplexNDArray retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
569 gripe_wrong_type_arg ("octave_base_value::float_complex_array_value()", |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
570 type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
571 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
572 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
573 |
4550 | 574 bool |
5943 | 575 octave_base_value::bool_value (bool) const |
4550 | 576 { |
577 bool retval = false; | |
578 gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); | |
579 return retval; | |
580 } | |
581 | |
582 boolMatrix | |
5943 | 583 octave_base_value::bool_matrix_value (bool) const |
4550 | 584 { |
585 boolMatrix retval; | |
586 gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", | |
587 type_name ()); | |
588 return retval; | |
589 } | |
590 | |
591 boolNDArray | |
5943 | 592 octave_base_value::bool_array_value (bool) const |
4550 | 593 { |
594 boolNDArray retval; | |
595 gripe_wrong_type_arg ("octave_base_value::bool_array_value()", | |
596 type_name ()); | |
597 return retval; | |
598 } | |
599 | |
2376 | 600 charMatrix |
4741 | 601 octave_base_value::char_matrix_value (bool force) const |
2376 | 602 { |
603 charMatrix retval; | |
4257 | 604 |
4741 | 605 octave_value tmp = convert_to_str (false, force); |
4257 | 606 |
4452 | 607 if (! error_state) |
608 retval = tmp.char_matrix_value (); | |
609 | |
2376 | 610 return retval; |
611 } | |
612 | |
4550 | 613 charNDArray |
614 octave_base_value::char_array_value (bool) const | |
615 { | |
616 charNDArray retval; | |
617 gripe_wrong_type_arg ("octave_base_value::char_array_value()", | |
618 type_name ()); | |
619 return retval; | |
620 } | |
621 | |
5164 | 622 SparseMatrix |
623 octave_base_value::sparse_matrix_value (bool) const | |
624 { | |
625 SparseMatrix retval; | |
626 gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); | |
627 return retval; | |
628 } | |
629 | |
630 SparseComplexMatrix | |
631 octave_base_value::sparse_complex_matrix_value (bool) const | |
632 { | |
633 SparseComplexMatrix retval; | |
634 gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ()); | |
635 return retval; | |
636 } | |
637 | |
638 SparseBoolMatrix | |
639 octave_base_value::sparse_bool_matrix_value (bool) const | |
640 { | |
641 SparseBoolMatrix retval; | |
642 gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ()); | |
643 return retval; | |
644 } | |
645 | |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
646 DiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
647 octave_base_value::diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
648 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
649 DiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
650 gripe_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
651 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
652 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
653 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
654 FloatDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
655 octave_base_value::float_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
656 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
657 FloatDiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
658 gripe_wrong_type_arg ("octave_base_value::float_diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
659 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
660 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
661 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
662 ComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
663 octave_base_value::complex_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
664 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
665 ComplexDiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
666 gripe_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
667 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
668 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
669 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
670 FloatComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
671 octave_base_value::float_complex_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
672 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
673 FloatComplexDiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
674 gripe_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
675 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
676 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
677 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
678 PermMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
679 octave_base_value::perm_matrix_value (void) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
680 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
681 PermMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
682 gripe_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
683 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
684 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
685 |
4910 | 686 octave_int8 |
687 octave_base_value::int8_scalar_value (void) const | |
688 { | |
689 octave_int8 retval; | |
690 gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()", | |
691 type_name ()); | |
692 return retval; | |
693 } | |
694 | |
695 octave_int16 | |
696 octave_base_value::int16_scalar_value (void) const | |
697 { | |
698 octave_int16 retval; | |
699 gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()", | |
700 type_name ()); | |
701 return retval; | |
702 } | |
703 | |
704 octave_int32 | |
705 octave_base_value::int32_scalar_value (void) const | |
706 { | |
707 octave_int32 retval; | |
708 gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()", | |
709 type_name ()); | |
710 return retval; | |
711 } | |
712 | |
713 octave_int64 | |
714 octave_base_value::int64_scalar_value (void) const | |
715 { | |
716 octave_int64 retval; | |
717 gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()", | |
718 type_name ()); | |
719 return retval; | |
720 } | |
721 | |
722 octave_uint8 | |
723 octave_base_value::uint8_scalar_value (void) const | |
724 { | |
725 octave_uint8 retval; | |
726 gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()", | |
727 type_name ()); | |
728 return retval; | |
729 } | |
730 | |
731 octave_uint16 | |
732 octave_base_value::uint16_scalar_value (void) const | |
733 { | |
734 octave_uint16 retval; | |
735 gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()", | |
736 type_name ()); | |
737 return retval; | |
738 } | |
739 | |
740 octave_uint32 | |
741 octave_base_value::uint32_scalar_value (void) const | |
742 { | |
743 octave_uint32 retval; | |
744 gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()", | |
745 type_name ()); | |
746 return retval; | |
747 } | |
748 | |
749 octave_uint64 | |
750 octave_base_value::uint64_scalar_value (void) const | |
751 { | |
752 octave_uint64 retval; | |
753 gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()", | |
754 type_name ()); | |
755 return retval; | |
756 } | |
757 | |
4906 | 758 int8NDArray |
759 octave_base_value::int8_array_value (void) const | |
760 { | |
761 int8NDArray retval; | |
762 gripe_wrong_type_arg ("octave_base_value::int8_array_value()", | |
763 type_name ()); | |
4910 | 764 return retval; |
4906 | 765 } |
766 | |
767 int16NDArray | |
768 octave_base_value::int16_array_value (void) const | |
769 { | |
770 int16NDArray retval; | |
771 gripe_wrong_type_arg ("octave_base_value::int16_array_value()", | |
772 type_name ()); | |
4910 | 773 return retval; |
4906 | 774 } |
775 | |
776 int32NDArray | |
777 octave_base_value::int32_array_value (void) const | |
778 { | |
779 int32NDArray retval; | |
780 gripe_wrong_type_arg ("octave_base_value::int32_array_value()", | |
781 type_name ()); | |
4910 | 782 return retval; |
4906 | 783 } |
784 | |
785 int64NDArray | |
786 octave_base_value::int64_array_value (void) const | |
787 { | |
788 int64NDArray retval; | |
789 gripe_wrong_type_arg ("octave_base_value::int64_array_value()", | |
790 type_name ()); | |
4910 | 791 return retval; |
4906 | 792 } |
793 | |
794 uint8NDArray | |
795 octave_base_value::uint8_array_value (void) const | |
796 { | |
797 uint8NDArray retval; | |
798 gripe_wrong_type_arg ("octave_base_value::uint8_array_value()", | |
799 type_name ()); | |
4910 | 800 return retval; |
4906 | 801 } |
802 | |
803 uint16NDArray | |
804 octave_base_value::uint16_array_value (void) const | |
805 { | |
806 uint16NDArray retval; | |
807 gripe_wrong_type_arg ("octave_base_value::uint16_array_value()", | |
808 type_name ()); | |
4910 | 809 return retval; |
4906 | 810 } |
811 | |
812 uint32NDArray | |
813 octave_base_value::uint32_array_value (void) const | |
814 { | |
815 uint32NDArray retval; | |
816 gripe_wrong_type_arg ("octave_base_value::uint32_array_value()", | |
817 type_name ()); | |
4910 | 818 return retval; |
4906 | 819 } |
820 | |
821 uint64NDArray | |
822 octave_base_value::uint64_array_value (void) const | |
823 { | |
824 uint64NDArray retval; | |
825 gripe_wrong_type_arg ("octave_base_value::uint64_array_value()", | |
826 type_name ()); | |
4910 | 827 return retval; |
4906 | 828 } |
829 | |
2493 | 830 string_vector |
5715 | 831 octave_base_value::all_strings (bool pad) const |
2376 | 832 { |
2493 | 833 string_vector retval; |
4257 | 834 |
5715 | 835 octave_value tmp = convert_to_str (pad, true); |
4257 | 836 |
4452 | 837 if (! error_state) |
838 retval = tmp.all_strings (); | |
4257 | 839 |
2376 | 840 return retval; |
841 } | |
842 | |
3536 | 843 std::string |
4457 | 844 octave_base_value::string_value (bool force) const |
2376 | 845 { |
3523 | 846 std::string retval; |
4257 | 847 |
4457 | 848 octave_value tmp = convert_to_str (force); |
4257 | 849 |
4452 | 850 if (! error_state) |
851 retval = tmp.string_value (); | |
4257 | 852 |
2376 | 853 return retval; |
854 } | |
855 | |
8732 | 856 Array<std::string> |
857 octave_base_value::cellstr_value (void) const | |
858 { | |
859 Array<std::string> retval; | |
860 gripe_wrong_type_arg ("octave_base_value::cellstry_value()", | |
861 type_name ()); | |
862 return retval; | |
863 } | |
864 | |
2376 | 865 Range |
866 octave_base_value::range_value (void) const | |
867 { | |
868 Range retval; | |
869 gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ()); | |
870 return retval; | |
871 } | |
872 | |
873 Octave_map | |
874 octave_base_value::map_value (void) const | |
875 { | |
876 Octave_map retval; | |
877 gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ()); | |
878 return retval; | |
879 } | |
880 | |
3933 | 881 string_vector |
882 octave_base_value::map_keys (void) const | |
883 { | |
884 string_vector retval; | |
885 gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); | |
886 return retval; | |
887 } | |
888 | |
9151 | 889 size_t |
890 octave_base_value::nparents (void) const | |
891 { | |
892 size_t retval = 0; | |
893 gripe_wrong_type_arg ("octave_base_value::nparents()", type_name ()); | |
894 return retval; | |
895 } | |
896 | |
897 std::list<std::string> | |
898 octave_base_value::parent_class_name_list (void) const | |
899 { | |
900 std::list<std::string> retval; | |
901 gripe_wrong_type_arg ("octave_base_value::parent_class_name_list()", | |
902 type_name ()); | |
903 return retval; | |
904 } | |
905 | |
906 string_vector | |
907 octave_base_value::parent_class_names (void) const | |
908 { | |
909 string_vector retval; | |
910 gripe_wrong_type_arg ("octave_base_value::parent_class_names()", | |
911 type_name ()); | |
912 return retval; | |
913 } | |
914 | |
2974 | 915 octave_function * |
916 octave_base_value::function_value (bool silent) | |
917 { | |
918 octave_function *retval = 0; | |
919 | |
920 if (! silent) | |
921 gripe_wrong_type_arg ("octave_base_value::function_value()", | |
922 type_name ()); | |
923 return retval; | |
924 } | |
925 | |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
926 const octave_function * |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
927 octave_base_value::function_value (bool silent) const |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
928 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
929 const octave_function *retval = 0; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
930 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
931 if (! silent) |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
932 gripe_wrong_type_arg ("octave_base_value::function_value()", |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
933 type_name ()); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
934 return retval; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
935 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
936 |
4700 | 937 octave_user_function * |
938 octave_base_value::user_function_value (bool silent) | |
939 { | |
940 octave_user_function *retval = 0; | |
941 | |
942 if (! silent) | |
943 gripe_wrong_type_arg ("octave_base_value::user_function_value()", | |
944 type_name ()); | |
945 return retval; | |
946 } | |
947 | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
948 octave_user_script * |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
949 octave_base_value::user_script_value (bool silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
950 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
951 octave_user_script *retval = 0; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
952 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
953 if (! silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
954 gripe_wrong_type_arg ("octave_base_value::user_script_value()", |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
955 type_name ()); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
956 return retval; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
957 } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
958 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
959 octave_user_code * |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
960 octave_base_value::user_code_value (bool silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
961 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
962 octave_user_code *retval = 0; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
963 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
964 if (! silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
965 gripe_wrong_type_arg ("octave_base_value::user_code_value()", |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
966 type_name ()); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
967 return retval; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
968 } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
969 |
4346 | 970 octave_fcn_handle * |
4343 | 971 octave_base_value::fcn_handle_value (bool silent) |
972 { | |
4346 | 973 octave_fcn_handle *retval = 0; |
4343 | 974 |
975 if (! silent) | |
976 gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()", | |
977 type_name ()); | |
978 return retval; | |
979 } | |
980 | |
4933 | 981 octave_fcn_inline * |
982 octave_base_value::fcn_inline_value (bool silent) | |
983 { | |
984 octave_fcn_inline *retval = 0; | |
985 | |
986 if (! silent) | |
987 gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()", | |
988 type_name ()); | |
989 return retval; | |
990 } | |
991 | |
2882 | 992 octave_value_list |
993 octave_base_value::list_value (void) const | |
994 { | |
995 octave_value_list retval; | |
996 gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ()); | |
997 return retval; | |
998 } | |
999 | |
4687 | 1000 bool |
6974 | 1001 octave_base_value::save_ascii (std::ostream&) |
4687 | 1002 { |
1003 gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); | |
1004 return false; | |
1005 } | |
1006 | |
1007 bool | |
1008 octave_base_value::load_ascii (std::istream&) | |
1009 { | |
1010 gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); | |
1011 return false; | |
1012 } | |
1013 | |
1014 bool | |
1015 octave_base_value::save_binary (std::ostream&, bool&) | |
1016 { | |
1017 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); | |
1018 return false; | |
1019 } | |
1020 | |
1021 bool | |
1022 octave_base_value::load_binary (std::istream&, bool, | |
1023 oct_mach_info::float_format) | |
1024 { | |
1025 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); | |
1026 return false; | |
1027 } | |
1028 | |
1029 #if defined (HAVE_HDF5) | |
4944 | 1030 |
4687 | 1031 bool |
1032 octave_base_value::save_hdf5 (hid_t, const char *, bool) | |
1033 { | |
1034 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); | |
1035 | |
1036 return false; | |
1037 } | |
1038 | |
1039 bool | |
1040 octave_base_value::load_hdf5 (hid_t, const char *, bool) | |
1041 { | |
1042 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); | |
1043 | |
1044 return false; | |
1045 } | |
4944 | 1046 |
4687 | 1047 #endif |
1048 | |
4944 | 1049 int |
1050 octave_base_value::write (octave_stream&, int, oct_data_conv::data_type, | |
1051 int, oct_mach_info::float_format) const | |
1052 { | |
1053 gripe_wrong_type_arg ("octave_base_value::write()", type_name ()); | |
1054 | |
1055 return false; | |
1056 } | |
1057 | |
5900 | 1058 mxArray * |
1059 octave_base_value::as_mxArray (void) const | |
1060 { | |
1061 gripe_wrong_type_arg ("octave_base_value::as_mxArray ()", type_name ()); | |
1062 | |
1063 return 0; | |
1064 } | |
1065 | |
7433 | 1066 octave_value |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1067 octave_base_value::diag (octave_idx_type) const |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1068 { |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1069 gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ()); |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1070 |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1071 return octave_value(); |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1072 } |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1073 |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1074 octave_value |
7433 | 1075 octave_base_value::sort (octave_idx_type, sortmode) const |
1076 { | |
1077 gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); | |
1078 | |
1079 return octave_value(); | |
1080 } | |
1081 | |
1082 octave_value | |
1083 octave_base_value::sort (Array<octave_idx_type> &, | |
1084 octave_idx_type, sortmode) const | |
1085 { | |
1086 gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); | |
1087 | |
1088 return octave_value(); | |
1089 } | |
1090 | |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1091 sortmode |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1092 octave_base_value::is_sorted (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1093 { |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1094 gripe_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1095 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1096 return UNSORTED; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1097 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1098 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1099 Array<octave_idx_type> |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1100 octave_base_value::sort_rows_idx (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1101 { |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1102 gripe_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1103 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1104 return Array<octave_idx_type> (); |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1105 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1106 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1107 sortmode |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1108 octave_base_value::is_sorted_rows (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1109 { |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1110 gripe_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1111 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1112 return UNSORTED; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1113 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1114 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1115 #define UNDEFINED_MAPPER(F) \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1116 octave_value \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1117 octave_base_value::F (void) const \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1118 { \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1119 gripe_wrong_type_arg ("octave_base_value::" #F " ()", type_name ()); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1120 return octave_value (); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1121 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1122 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1123 UNDEFINED_MAPPER (abs) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1124 UNDEFINED_MAPPER (acos) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1125 UNDEFINED_MAPPER (acosh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1126 UNDEFINED_MAPPER (angle) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1127 UNDEFINED_MAPPER (arg) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1128 UNDEFINED_MAPPER (asin) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1129 UNDEFINED_MAPPER (asinh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1130 UNDEFINED_MAPPER (atan) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1131 UNDEFINED_MAPPER (atanh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1132 UNDEFINED_MAPPER (ceil) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1133 UNDEFINED_MAPPER (conj) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1134 UNDEFINED_MAPPER (cos) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1135 UNDEFINED_MAPPER (cosh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1136 UNDEFINED_MAPPER (erf) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1137 UNDEFINED_MAPPER (erfc) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1138 UNDEFINED_MAPPER (exp) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1139 UNDEFINED_MAPPER (expm1) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1140 UNDEFINED_MAPPER (finite) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1141 UNDEFINED_MAPPER (fix) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1142 UNDEFINED_MAPPER (floor) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1143 UNDEFINED_MAPPER (gamma) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1144 UNDEFINED_MAPPER (imag) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1145 UNDEFINED_MAPPER (isinf) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1146 UNDEFINED_MAPPER (isna) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1147 UNDEFINED_MAPPER (isnan) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1148 UNDEFINED_MAPPER (lgamma) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1149 UNDEFINED_MAPPER (log) |
7740 | 1150 UNDEFINED_MAPPER (log2) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1151 UNDEFINED_MAPPER (log10) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1152 UNDEFINED_MAPPER (log1p) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1153 UNDEFINED_MAPPER (real) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1154 UNDEFINED_MAPPER (round) |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
1155 UNDEFINED_MAPPER (roundb) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1156 UNDEFINED_MAPPER (signum) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1157 UNDEFINED_MAPPER (sin) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1158 UNDEFINED_MAPPER (sinh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1159 UNDEFINED_MAPPER (sqrt) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1160 UNDEFINED_MAPPER (tan) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1161 UNDEFINED_MAPPER (tanh) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1162 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1163 // String mapper functions, convert to a string |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1164 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1165 #define STRING_MAPPER(F) \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1166 octave_value \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1167 octave_base_value::F (void) const \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1168 { \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1169 octave_value tmp = octave_value (char_array_value (true), true); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1170 return error_state ? octave_value () : octave_value (tmp.F ()); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1171 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1172 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1173 STRING_MAPPER (xisalnum) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1174 STRING_MAPPER (xisalpha) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1175 STRING_MAPPER (xisascii) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1176 STRING_MAPPER (xiscntrl) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1177 STRING_MAPPER (xisdigit) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1178 STRING_MAPPER (xisgraph) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1179 STRING_MAPPER (xislower) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1180 STRING_MAPPER (xisprint) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1181 STRING_MAPPER (xispunct) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1182 STRING_MAPPER (xisspace) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1183 STRING_MAPPER (xisupper) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1184 STRING_MAPPER (xisxdigit) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1185 STRING_MAPPER (xtoascii) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1186 STRING_MAPPER (xtolower) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1187 STRING_MAPPER (xtoupper) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1188 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1189 void |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1190 octave_base_value::lock (void) |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1191 { |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1192 gripe_wrong_type_arg ("octave_base_value::lock ()", type_name ()); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1193 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1194 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1195 void |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1196 octave_base_value::unlock (void) |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1197 { |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1198 gripe_wrong_type_arg ("octave_base_value::unlock ()", type_name ()); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1199 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1200 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1201 void |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1202 octave_base_value::dump (std::ostream& os) const |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1203 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1204 dim_vector dv = this->dims (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1205 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1206 os << "class: " << this->class_name () |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1207 << " type: " << this->type_name () |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1208 << " dims: " << dv.str (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1209 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1210 |
5759 | 1211 static void |
1212 gripe_indexed_assignment (const std::string& tn1, const std::string& tn2) | |
1213 { | |
1214 error ("assignment of `%s' to indexed `%s' not implemented", | |
1215 tn2.c_str (), tn1.c_str ()); | |
1216 } | |
1217 | |
1218 static void | |
1219 gripe_assign_conversion_failed (const std::string& tn1, | |
1220 const std::string& tn2) | |
1221 { | |
1222 error ("type conversion for assignment of `%s' to indexed `%s' failed", | |
1223 tn2.c_str (), tn1.c_str ()); | |
1224 } | |
1225 | |
1226 static void | |
1227 gripe_no_conversion (const std::string& on, const std::string& tn1, | |
1228 const std::string& tn2) | |
1229 { | |
1230 error ("operator %s: no conversion for assignment of `%s' to indexed `%s'", | |
1231 on.c_str (), tn2.c_str (), tn1.c_str ()); | |
1232 } | |
1233 | |
1234 octave_value | |
1235 octave_base_value::numeric_assign (const std::string& type, | |
1236 const std::list<octave_value_list>& idx, | |
1237 const octave_value& rhs) | |
1238 { | |
1239 octave_value retval; | |
1240 | |
9286
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1241 if (idx.front ().empty ()) |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1242 { |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1243 error ("missing index in indexed assignment"); |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1244 return retval; |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1245 } |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1246 |
5759 | 1247 int t_lhs = type_id (); |
1248 int t_rhs = rhs.type_id (); | |
1249 | |
1250 octave_value_typeinfo::assign_op_fcn f | |
1251 = octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, | |
1252 t_lhs, t_rhs); | |
1253 | |
1254 bool done = false; | |
1255 | |
1256 if (f) | |
1257 { | |
1258 f (*this, idx.front (), rhs.get_rep ()); | |
1259 | |
1260 done = (! error_state); | |
1261 } | |
1262 | |
1263 if (done) | |
1264 { | |
1265 count++; | |
1266 retval = octave_value (this); | |
1267 } | |
1268 else | |
1269 { | |
1270 int t_result | |
1271 = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs); | |
1272 | |
1273 if (t_result >= 0) | |
1274 { | |
1275 octave_base_value::type_conv_fcn cf | |
1276 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result); | |
1277 | |
1278 if (cf) | |
1279 { | |
5874 | 1280 octave_base_value *tmp = cf (*this); |
5759 | 1281 |
1282 if (tmp) | |
1283 { | |
5874 | 1284 octave_value val (tmp); |
1285 | |
1286 retval = val.subsasgn (type, idx, rhs); | |
5759 | 1287 |
1288 done = (! error_state); | |
1289 } | |
1290 else | |
1291 gripe_assign_conversion_failed (type_name (), | |
1292 rhs.type_name ()); | |
1293 } | |
1294 else | |
1295 gripe_indexed_assignment (type_name (), rhs.type_name ()); | |
1296 } | |
1297 | |
1298 if (! (done || error_state)) | |
1299 { | |
1300 octave_value tmp_rhs; | |
1301 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1302 octave_base_value::type_conv_info cf_rhs |
5759 | 1303 = rhs.numeric_conversion_function (); |
1304 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1305 octave_base_value::type_conv_info cf_this |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1306 = numeric_conversion_function (); |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1307 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1308 // Try biased (one-sided) conversions first. |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1309 if (cf_rhs.type_id () >= 0 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1310 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1311 t_lhs, cf_rhs.type_id ()) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1312 || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1313 cf_rhs.type_id ()) >= 0)) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1314 cf_this = 0; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1315 else if (cf_this.type_id () >= 0 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1316 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1317 cf_this.type_id (), t_rhs) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1318 || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (), |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1319 t_rhs) >= 0)) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1320 cf_rhs = 0; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1321 |
5759 | 1322 if (cf_rhs) |
1323 { | |
1324 octave_base_value *tmp = cf_rhs (rhs.get_rep ()); | |
1325 | |
1326 if (tmp) | |
1327 tmp_rhs = octave_value (tmp); | |
1328 else | |
1329 { | |
1330 gripe_assign_conversion_failed (type_name (), | |
1331 rhs.type_name ()); | |
1332 return octave_value (); | |
1333 } | |
1334 } | |
1335 else | |
1336 tmp_rhs = rhs; | |
1337 | |
5897 | 1338 count++; |
1339 octave_value tmp_lhs = octave_value (this); | |
5759 | 1340 |
1341 if (cf_this) | |
1342 { | |
1343 octave_base_value *tmp = cf_this (*this); | |
1344 | |
1345 if (tmp) | |
5897 | 1346 tmp_lhs = octave_value (tmp); |
5759 | 1347 else |
1348 { | |
1349 gripe_assign_conversion_failed (type_name (), | |
1350 rhs.type_name ()); | |
1351 return octave_value (); | |
1352 } | |
1353 } | |
1354 | |
1355 if (cf_this || cf_rhs) | |
1356 { | |
5897 | 1357 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs); |
5759 | 1358 |
1359 done = (! error_state); | |
1360 } | |
1361 else | |
1362 gripe_no_conversion (octave_value::assign_op_as_string (octave_value::op_asn_eq), | |
1363 type_name (), rhs.type_name ()); | |
1364 } | |
1365 } | |
1366 | |
1367 // The assignment may have converted to a type that is wider than | |
1368 // necessary. | |
1369 | |
1370 retval.maybe_mutate (); | |
1371 | |
1372 return retval; | |
1373 } | |
1374 | |
1375 // Current indentation. | |
1376 int octave_base_value::curr_print_indent_level = 0; | |
1377 | |
1378 // TRUE means we are at the beginning of a line. | |
1379 bool octave_base_value::beginning_of_line = true; | |
1380 | |
1381 // Each print() function should call this before printing anything. | |
1382 // | |
1383 // This doesn't need to be fast, but isn't there a better way? | |
1384 | |
1385 void | |
1386 octave_base_value::indent (std::ostream& os) const | |
1387 { | |
1388 assert (curr_print_indent_level >= 0); | |
1389 | |
1390 if (beginning_of_line) | |
1391 { | |
5775 | 1392 // FIXME -- do we need this? |
5759 | 1393 // os << prefix; |
1394 | |
1395 for (int i = 0; i < curr_print_indent_level; i++) | |
1396 os << " "; | |
1397 | |
1398 beginning_of_line = false; | |
1399 } | |
1400 } | |
1401 | |
1402 // All print() functions should use this to print new lines. | |
1403 | |
1404 void | |
1405 octave_base_value::newline (std::ostream& os) const | |
1406 { | |
1407 os << "\n"; | |
1408 | |
1409 beginning_of_line = true; | |
1410 } | |
1411 | |
1412 // For ressetting print state. | |
1413 | |
1414 void | |
1415 octave_base_value::reset (void) const | |
1416 { | |
1417 beginning_of_line = true; | |
1418 curr_print_indent_level = 0; | |
1419 } | |
1420 | |
3203 | 1421 CONVDECLX (matrix_conv) |
2376 | 1422 { |
1423 return new octave_matrix (); | |
1424 } | |
1425 | |
3203 | 1426 CONVDECLX (complex_matrix_conv) |
2376 | 1427 { |
1428 return new octave_complex_matrix (); | |
1429 } | |
1430 | |
3203 | 1431 CONVDECLX (string_conv) |
2376 | 1432 { |
1433 return new octave_char_matrix_str (); | |
1434 } | |
1435 | |
3928 | 1436 CONVDECLX (cell_conv) |
1437 { | |
1438 return new octave_cell (); | |
1439 } | |
1440 | |
2376 | 1441 void |
1442 install_base_type_conversions (void) | |
1443 { | |
1444 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix); | |
1445 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix); | |
1446 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix); | |
1447 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix); | |
1448 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix); | |
1449 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str); | |
3928 | 1450 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell); |
2376 | 1451 |
1452 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv); | |
1453 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv); | |
1454 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv); | |
3928 | 1455 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv); |
2376 | 1456 } |
1457 | |
7193 | 1458 DEFUN (sparse_auto_mutate, args, nargout, |
1459 "-*- texinfo -*-\n\ | |
1460 @deftypefn {Built-in Function} {@var{val} =} sparse_auto_mutate ()\n\ | |
1461 @deftypefnx {Built-in Function} {@var{old_val} =} sparse_auto_mutate (@var{new_val})\n\ | |
1462 Query or set the internal variable that controls whether Octave will\n\ | |
1463 automatically mutate sparse matrices to real matrices to save memory.\n\ | |
1464 For example,\n\ | |
1465 \n\ | |
1466 @example\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
1467 @group\n\ |
7193 | 1468 s = speye(3);\n\ |
1469 sparse_auto_mutate (false)\n\ | |
1470 s (:, 1) = 1;\n\ | |
1471 typeinfo (s)\n\ | |
1472 @result{} sparse matrix\n\ | |
1473 sparse_auto_mutate (true)\n\ | |
1474 s (1, :) = 1;\n\ | |
1475 typeinfo (s)\n\ | |
1476 @result{} matrix\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
1477 @end group\n\ |
7193 | 1478 @end example\n\ |
1479 @end deftypefn") | |
1480 { | |
1481 return SET_INTERNAL_VARIABLE (sparse_auto_mutate); | |
1482 } | |
1483 | |
2376 | 1484 /* |
1485 ;;; Local Variables: *** | |
1486 ;;; mode: C++ *** | |
1487 ;;; End: *** | |
1488 */ |