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