Mercurial > octave-nkf
annotate src/ov-base.h @ 10651:944b78191f03
simplify octave_base_value::rows and columns
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 25 May 2010 07:41:31 +0200 |
parents | 09e244649f50 |
children | 2f0fbfa4dd23 |
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 |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10414
diff
changeset
|
5 Copyright (C) 2009, 2010 VZLU Prague |
2376 | 6 |
7 This file is part of Octave. | |
8 | |
9 Octave is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
7016 | 11 Free Software Foundation; either version 3 of the License, or (at your |
12 option) any later version. | |
2376 | 13 |
14 Octave is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
7016 | 20 along with Octave; see the file COPYING. If not, see |
21 <http://www.gnu.org/licenses/>. | |
2376 | 22 |
23 */ | |
24 | |
25 #if !defined (octave_base_value_h) | |
26 #define octave_base_value_h 1 | |
27 | |
28 #include <cstdlib> | |
29 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
30 #include <iosfwd> |
5759 | 31 #include <list> |
2376 | 32 #include <string> |
33 | |
5759 | 34 #include "Range.h" |
5828 | 35 #include "data-conv.h" |
5900 | 36 #include "mxarray.h" |
2376 | 37 #include "mx-base.h" |
38 #include "str-vec.h" | |
39 | |
40 #include "error.h" | |
8676 | 41 #include "oct-hdf5.h" |
2376 | 42 |
3351 | 43 class Cell; |
2376 | 44 class Octave_map; |
5759 | 45 class octave_value; |
2376 | 46 class octave_value_list; |
5759 | 47 class octave_stream; |
48 class octave_function; | |
49 class octave_user_function; | |
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
|
50 class 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
|
51 class octave_user_code; |
5759 | 52 class octave_fcn_handle; |
53 class octave_fcn_inline; | |
54 class octave_value_list; | |
55 class octave_lvalue; | |
2376 | 56 |
57 class tree_walker; | |
58 | |
9685 | 59 enum builtin_type_t |
60 { | |
61 btyp_double, | |
62 btyp_float, | |
63 btyp_complex, | |
64 btyp_float_complex, | |
65 btyp_int8, | |
66 btyp_int16, | |
67 btyp_int32, | |
68 btyp_int64, | |
69 btyp_uint8, | |
70 btyp_uint16, | |
71 btyp_uint32, | |
72 btyp_uint64, | |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
73 btyp_bool, |
9685 | 74 btyp_char, |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
75 btyp_struct, |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
76 btyp_cell, |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
77 btyp_func_handle, |
9743
26abff55f6fe
optimize bsxfun for common built-in operations
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
78 btyp_unknown, |
26abff55f6fe
optimize bsxfun for common built-in operations
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
79 btyp_num_types = btyp_unknown |
9685 | 80 }; |
81 | |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
82 extern OCTINTERP_API std::string |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
83 btyp_class_name [btyp_num_types]; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
84 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
85 extern OCTINTERP_API string_vector |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
86 get_builtin_classes (void); |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
87 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
88 inline bool btyp_isnumeric (builtin_type_t btyp) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
89 { return btyp <= btyp_uint64; } |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
90 |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
91 inline bool btyp_isinteger (builtin_type_t btyp) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
92 { return btyp >= btyp_int8 && btyp <= btyp_uint64; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
93 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
94 inline bool btyp_isfloat (builtin_type_t btyp) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
95 { return btyp <= btyp_float_complex; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
96 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
97 inline bool btyp_isarray (builtin_type_t btyp) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
98 { return btyp <= btyp_char; } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
99 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
100 // Compute a numeric type for a possibly mixed-type operation, using these rules: |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
101 // bool -> double |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
102 // single + double -> single |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
103 // real + complex -> complex |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
104 // integer + real -> integer |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
105 // uint + uint -> uint (the bigger one) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
106 // sint + sint -> sint (the bigger one) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
107 // |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
108 // failing otherwise. |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
109 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
110 extern OCTINTERP_API |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
111 builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y); |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9767
diff
changeset
|
112 |
9685 | 113 template <class T> |
114 struct class_to_btyp | |
115 { | |
116 static const builtin_type_t btyp = btyp_unknown; | |
117 }; | |
118 | |
119 #define DEF_CLASS_TO_BTYP(CLASS,BTYP) \ | |
120 template <> \ | |
121 struct class_to_btyp<CLASS> \ | |
122 { static const builtin_type_t btyp = BTYP; } | |
123 | |
124 DEF_CLASS_TO_BTYP (double, btyp_double); | |
125 DEF_CLASS_TO_BTYP (float, btyp_float); | |
126 DEF_CLASS_TO_BTYP (Complex, btyp_complex); | |
127 DEF_CLASS_TO_BTYP (FloatComplex, btyp_float_complex); | |
128 DEF_CLASS_TO_BTYP (octave_int8, btyp_int8); | |
129 DEF_CLASS_TO_BTYP (octave_int16, btyp_int16); | |
130 DEF_CLASS_TO_BTYP (octave_int32, btyp_int32); | |
131 DEF_CLASS_TO_BTYP (octave_int64, btyp_int64); | |
132 DEF_CLASS_TO_BTYP (octave_uint8, btyp_uint8); | |
133 DEF_CLASS_TO_BTYP (octave_uint16, btyp_uint16); | |
134 DEF_CLASS_TO_BTYP (octave_uint32, btyp_uint32); | |
135 DEF_CLASS_TO_BTYP (octave_uint64, btyp_uint64); | |
136 DEF_CLASS_TO_BTYP (bool, btyp_bool); | |
137 DEF_CLASS_TO_BTYP (char, btyp_char); | |
138 | |
5759 | 139 // T_ID is the type id of struct objects, set by register_type(). |
140 // T_NAME is the type name of struct objects. | |
7067 | 141 |
5759 | 142 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \ |
7066 | 143 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG) |
5759 | 144 |
145 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \ | |
146 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual) | |
147 | |
148 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \ | |
149 public: \ | |
150 VIRTUAL int type_id (void) const { return t_id; } \ | |
151 VIRTUAL std::string type_name (void) const { return t_name; } \ | |
152 VIRTUAL std::string class_name (void) const { return c_name; } \ | |
153 static int static_type_id (void) { return t_id; } \ | |
154 static std::string static_type_name (void) { return t_name; } \ | |
155 static std::string static_class_name (void) { return c_name; } \ | |
156 static void register_type (void); \ | |
157 \ | |
158 private: \ | |
159 static int t_id; \ | |
160 static const std::string t_name; \ | |
161 static const std::string c_name; | |
162 | |
163 | |
164 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \ | |
165 int t::t_id (-1); \ | |
166 const std::string t::t_name (n); \ | |
167 const std::string t::c_name (c); \ | |
168 void t::register_type (void) \ | |
169 { \ | |
170 t_id = octave_value_typeinfo::register_type (t::t_name, \ | |
10313 | 171 t::c_name, \ |
172 octave_value (new t ())); \ | |
5759 | 173 } |
174 | |
2477 | 175 // A base value type, so that derived types only have to redefine what |
176 // they need (if they are derived from octave_base_value instead of | |
177 // octave_value). | |
2376 | 178 |
179 class | |
6109 | 180 OCTINTERP_API |
5759 | 181 octave_base_value |
2376 | 182 { |
183 public: | |
184 | |
5759 | 185 typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&); |
186 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
187 // type conversion, including result type information |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
188 class type_conv_info |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
189 { |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
190 public: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
191 type_conv_info (type_conv_fcn f = 0, int t = -1) : _fcn (f), _type_id (t) { } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
192 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
193 operator type_conv_fcn (void) const { return _fcn; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
194 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
195 octave_base_value * operator () (const octave_base_value &v) const |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
196 { return (*_fcn) (v); } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
197 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
198 int type_id (void) const { return _type_id; } |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
199 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
200 private: |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
201 type_conv_fcn _fcn; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
202 int _type_id; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
203 }; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
204 |
5759 | 205 friend class octave_value; |
2376 | 206 |
5759 | 207 octave_base_value (void) : count (1) { } |
208 | |
9521 | 209 octave_base_value (const octave_base_value&) : count (1) { } |
2376 | 210 |
5759 | 211 virtual ~octave_base_value (void) { } |
212 | |
9521 | 213 // Unconditional clone. Always clones. |
5759 | 214 virtual octave_base_value * |
215 clone (void) const { return new octave_base_value (*this); } | |
2376 | 216 |
9521 | 217 // Empty clone. |
5759 | 218 virtual octave_base_value * |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
219 empty_clone (void) const; |
2376 | 220 |
9521 | 221 // Unique clone. Usually clones, but may be overriden to fake the |
222 // cloning when sharing copies is to be controlled from within an | |
223 // instance (see octave_class). | |
224 virtual octave_base_value * | |
225 unique_clone (void) { return clone (); } | |
226 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
227 virtual type_conv_info |
5759 | 228 numeric_conversion_function (void) const |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
229 { return type_conv_info (); } |
2410 | 230 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
231 virtual type_conv_info |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
232 numeric_demotion_function (void) const |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
233 { return type_conv_info (); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
234 |
5759 | 235 virtual octave_value squeeze (void) const; |
236 | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
237 virtual octave_value full_value (void) const; |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
238 |
5759 | 239 virtual octave_base_value *try_narrowing_conversion (void) { return 0; } |
4532 | 240 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
241 virtual void maybe_economize (void) { } |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
242 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
243 virtual Matrix size (void); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
244 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
245 virtual octave_idx_type numel (const octave_value_list&); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9182
diff
changeset
|
246 |
5759 | 247 virtual octave_value |
248 subsref (const std::string& type, | |
10313 | 249 const std::list<octave_value_list>& idx); |
3933 | 250 |
5759 | 251 virtual octave_value_list |
252 subsref (const std::string& type, | |
10313 | 253 const std::list<octave_value_list>& idx, |
254 int nargout); | |
3933 | 255 |
5759 | 256 virtual octave_value |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
257 subsref (const std::string& type, |
10313 | 258 const std::list<octave_value_list>& idx, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
259 bool auto_add); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
260 |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
261 virtual octave_value |
5885 | 262 do_index_op (const octave_value_list& idx, bool resize_ok = false); |
2974 | 263 |
5759 | 264 virtual octave_value_list |
3544 | 265 do_multi_index_op (int nargout, const octave_value_list& idx); |
2376 | 266 |
9147
5579998f8acf
Update to OOP facilities.
rtshort@bristlecone.phaselocked.com
parents:
9010
diff
changeset
|
267 virtual void assign (const std::string&, const octave_value&) { } |
5579998f8acf
Update to OOP facilities.
rtshort@bristlecone.phaselocked.com
parents:
9010
diff
changeset
|
268 |
5759 | 269 virtual octave_value |
270 subsasgn (const std::string& type, | |
10313 | 271 const std::list<octave_value_list>& idx, |
272 const octave_value& rhs); | |
2376 | 273 |
5759 | 274 virtual idx_vector index_vector (void) const; |
2376 | 275 |
10181
a668fbd32e34
improve cellfun & avoid undefined values from builtins
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
276 virtual dim_vector dims (void) const { return dim_vector (); } |
4559 | 277 |
5759 | 278 octave_idx_type rows (void) const |
279 { | |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
280 const dim_vector dv = dims (); |
5164 | 281 |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
282 return dv(0); |
5759 | 283 } |
4791 | 284 |
5759 | 285 octave_idx_type columns (void) const |
286 { | |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
287 const dim_vector dv = dims (); |
5602 | 288 |
10651
944b78191f03
simplify octave_base_value::rows and columns
Jaroslav Hajek <highegg@gmail.com>
parents:
10612
diff
changeset
|
289 return dv(1); |
5759 | 290 } |
5604 | 291 |
5759 | 292 virtual int ndims (void) const; |
4567 | 293 |
5759 | 294 virtual octave_idx_type numel (void) const { return dims ().numel (); } |
4593 | 295 |
5759 | 296 virtual octave_idx_type capacity (void) const { return numel (); } |
297 | |
298 virtual size_t byte_size (void) const { return 0; } | |
4915 | 299 |
5759 | 300 virtual octave_idx_type nnz (void) const; |
2376 | 301 |
5759 | 302 virtual octave_idx_type nzmax (void) const; |
303 | |
5900 | 304 virtual octave_idx_type nfields (void) const; |
305 | |
5759 | 306 virtual octave_value reshape (const dim_vector&) const; |
3351 | 307 |
5759 | 308 virtual octave_value permute (const Array<int>& vec, bool = false) const; |
2376 | 309 |
5759 | 310 virtual octave_value resize (const dim_vector&, bool fill = false) const; |
2376 | 311 |
5785 | 312 virtual MatrixType matrix_type (void) const; |
313 | |
314 virtual MatrixType matrix_type (const MatrixType& typ) const; | |
315 | |
5759 | 316 virtual bool is_defined (void) const { return false; } |
4505 | 317 |
5759 | 318 bool is_empty (void) const { return numel () == 0; } |
2376 | 319 |
5759 | 320 virtual bool is_cell (void) const { return false; } |
2376 | 321 |
6116 | 322 virtual bool is_cellstr (void) const { return false; } |
323 | |
5759 | 324 virtual bool is_real_scalar (void) const { return false; } |
4587 | 325 |
5759 | 326 virtual bool is_real_matrix (void) const { return false; } |
327 | |
328 virtual bool is_real_nd_array (void) const { return false; } | |
2376 | 329 |
5759 | 330 virtual bool is_complex_scalar (void) const { return false; } |
2376 | 331 |
5759 | 332 virtual bool is_complex_matrix (void) const { return false; } |
333 | |
5881 | 334 virtual bool is_bool_scalar (void) const { return false; } |
335 | |
5759 | 336 virtual bool is_bool_matrix (void) const { return false; } |
5279 | 337 |
5759 | 338 virtual bool is_char_matrix (void) const { return false; } |
2376 | 339 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
340 virtual bool is_diag_matrix (void) const { return false; } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
341 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
342 virtual bool is_perm_matrix (void) const { return false; } |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
343 |
5759 | 344 virtual bool is_string (void) const { return false; } |
2376 | 345 |
5759 | 346 virtual bool is_sq_string (void) const { return false; } |
4643 | 347 |
5759 | 348 virtual bool is_range (void) const { return false; } |
3977 | 349 |
5759 | 350 virtual bool is_map (void) const { return false; } |
351 | |
7336 | 352 virtual bool is_object (void) const { return false; } |
353 | |
5759 | 354 virtual bool is_cs_list (void) const { return false; } |
2376 | 355 |
5759 | 356 virtual bool is_magic_colon (void) const { return false; } |
2376 | 357 |
5759 | 358 virtual bool is_all_va_args (void) const { return false; } |
2376 | 359 |
5759 | 360 virtual octave_value all (int = 0) const; |
361 | |
362 virtual octave_value any (int = 0) const; | |
2376 | 363 |
9685 | 364 virtual builtin_type_t builtin_type (void) const { return btyp_unknown; } |
365 | |
5895 | 366 virtual bool is_double_type (void) const { return false; } |
367 | |
368 virtual bool is_single_type (void) const { return false; } | |
369 | |
7576 | 370 virtual bool is_float_type (void) const { return false; } |
371 | |
5895 | 372 virtual bool is_int8_type (void) const { return false; } |
373 | |
374 virtual bool is_int16_type (void) const { return false; } | |
375 | |
376 virtual bool is_int32_type (void) const { return false; } | |
377 | |
378 virtual bool is_int64_type (void) const { return false; } | |
379 | |
380 virtual bool is_uint8_type (void) const { return false; } | |
381 | |
382 virtual bool is_uint16_type (void) const { return false; } | |
383 | |
384 virtual bool is_uint32_type (void) const { return false; } | |
385 | |
386 virtual bool is_uint64_type (void) const { return false; } | |
387 | |
5759 | 388 virtual bool is_bool_type (void) const { return false; } |
3209 | 389 |
6223 | 390 virtual bool is_integer_type (void) const { return false; } |
391 | |
5759 | 392 virtual bool is_real_type (void) const { return false; } |
2376 | 393 |
5759 | 394 virtual bool is_complex_type (void) const { return false; } |
2376 | 395 |
396 // Would be nice to get rid of the next four functions: | |
397 | |
5759 | 398 virtual bool is_scalar_type (void) const { return false; } |
2376 | 399 |
5759 | 400 virtual bool is_matrix_type (void) const { return false; } |
2376 | 401 |
5759 | 402 virtual bool is_numeric_type (void) const { return false; } |
2376 | 403 |
5759 | 404 virtual bool is_sparse_type (void) const { return false; } |
5631 | 405 |
5759 | 406 virtual bool is_true (void) const { return false; } |
407 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
408 virtual bool is_null_value (void) const { return false; } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
409 |
5759 | 410 virtual bool is_constant (void) const { return false; } |
2376 | 411 |
5759 | 412 virtual bool is_function_handle (void) const { return false; } |
2376 | 413 |
5759 | 414 virtual bool is_inline_function (void) const { return false; } |
2974 | 415 |
5759 | 416 virtual bool is_function (void) const { return false; } |
4954 | 417 |
7336 | 418 virtual bool is_user_script (void) const { return false; } |
419 | |
420 virtual bool is_user_function (void) const { return false; } | |
421 | |
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
|
422 virtual bool is_user_code (void) const { return false; } |
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
|
423 |
5759 | 424 virtual bool is_builtin_function (void) const { return false; } |
2974 | 425 |
5759 | 426 virtual bool is_dld_function (void) const { return false; } |
3325 | 427 |
5864 | 428 virtual bool is_mex_function (void) const { return false; } |
429 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
430 virtual void erase_subfunctions (void) { } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7789
diff
changeset
|
431 |
5759 | 432 virtual short int short_value (bool = false, bool = false) const; |
4254 | 433 |
5759 | 434 virtual unsigned short int ushort_value (bool = false, bool = false) const; |
4254 | 435 |
5759 | 436 virtual int int_value (bool = false, bool = false) const; |
3202 | 437 |
5759 | 438 virtual unsigned int uint_value (bool = false, bool = false) const; |
4254 | 439 |
5759 | 440 virtual int nint_value (bool = false) const; |
3202 | 441 |
5759 | 442 virtual long int long_value (bool = false, bool = false) const; |
4254 | 443 |
5759 | 444 virtual unsigned long int ulong_value (bool = false, bool = false) const; |
4254 | 445 |
5759 | 446 virtual double double_value (bool = false) const; |
2376 | 447 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
448 virtual float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
449 |
5759 | 450 virtual double scalar_value (bool frc_str_conv = false) const |
3145 | 451 { return double_value (frc_str_conv); } |
2376 | 452 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
453 virtual float float_scalar_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
454 { return float_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
455 |
5759 | 456 virtual Cell cell_value (void) const; |
3351 | 457 |
5759 | 458 virtual Matrix matrix_value (bool = false) const; |
3145 | 459 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
460 virtual FloatMatrix float_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
461 |
5759 | 462 virtual NDArray array_value (bool = false) const; |
4505 | 463 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
464 virtual FloatNDArray float_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
465 |
5759 | 466 virtual Complex complex_value (bool = false) const; |
2376 | 467 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
468 virtual FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
469 |
5759 | 470 virtual ComplexMatrix complex_matrix_value (bool = false) const; |
2376 | 471 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
472 virtual FloatComplexMatrix float_complex_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
473 |
5759 | 474 virtual ComplexNDArray complex_array_value (bool = false) const; |
4550 | 475 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
476 virtual FloatComplexNDArray float_complex_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
477 |
5943 | 478 virtual bool bool_value (bool = false) const; |
4550 | 479 |
5943 | 480 virtual boolMatrix bool_matrix_value (bool = false) const; |
4550 | 481 |
5943 | 482 virtual boolNDArray bool_array_value (bool = false) const; |
4550 | 483 |
5759 | 484 virtual charMatrix char_matrix_value (bool force = false) const; |
485 | |
486 virtual charNDArray char_array_value (bool = false) const; | |
2376 | 487 |
5759 | 488 virtual SparseMatrix sparse_matrix_value (bool = false) const; |
4550 | 489 |
5759 | 490 virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164 | 491 |
5759 | 492 virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const; |
5164 | 493 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
494 virtual DiagMatrix diag_matrix_value (bool = false) const; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
495 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
496 virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
497 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
498 virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
499 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
500 virtual FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
501 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
502 virtual PermMatrix perm_matrix_value (void) const; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
503 |
5759 | 504 virtual octave_int8 int8_scalar_value (void) const; |
5164 | 505 |
5759 | 506 virtual octave_int16 int16_scalar_value (void) const; |
4910 | 507 |
5759 | 508 virtual octave_int32 int32_scalar_value (void) const; |
509 | |
510 virtual octave_int64 int64_scalar_value (void) const; | |
4910 | 511 |
5759 | 512 virtual octave_uint8 uint8_scalar_value (void) const; |
4910 | 513 |
5759 | 514 virtual octave_uint16 uint16_scalar_value (void) const; |
4910 | 515 |
5759 | 516 virtual octave_uint32 uint32_scalar_value (void) const; |
4910 | 517 |
5759 | 518 virtual octave_uint64 uint64_scalar_value (void) const; |
4910 | 519 |
5759 | 520 virtual int8NDArray int8_array_value (void) const; |
4910 | 521 |
5759 | 522 virtual int16NDArray int16_array_value (void) const; |
4910 | 523 |
5759 | 524 virtual int32NDArray int32_array_value (void) const; |
4906 | 525 |
5759 | 526 virtual int64NDArray int64_array_value (void) const; |
4906 | 527 |
5759 | 528 virtual uint8NDArray uint8_array_value (void) const; |
4906 | 529 |
5759 | 530 virtual uint16NDArray uint16_array_value (void) const; |
4906 | 531 |
5759 | 532 virtual uint32NDArray uint32_array_value (void) const; |
4906 | 533 |
5759 | 534 virtual uint64NDArray uint64_array_value (void) const; |
4906 | 535 |
5759 | 536 virtual string_vector all_strings (bool pad = false) const; |
4906 | 537 |
5759 | 538 virtual std::string string_value (bool force = false) const; |
4906 | 539 |
8732 | 540 virtual Array<std::string> cellstr_value (void) const; |
541 | |
5759 | 542 virtual Range range_value (void) const; |
2376 | 543 |
5759 | 544 virtual Octave_map map_value (void) const; |
2376 | 545 |
5759 | 546 virtual string_vector map_keys (void) const; |
2376 | 547 |
9151 | 548 virtual size_t nparents (void) const; |
549 | |
550 virtual std::list<std::string> parent_class_name_list (void) const; | |
551 | |
552 virtual string_vector parent_class_names (void) const; | |
9010
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
553 |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
554 virtual octave_base_value *find_parent_class (const std::string&) |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
555 { return 0; } |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
556 |
9767
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
557 virtual octave_base_value *unique_parent_class (const std::string&) |
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
558 { return 0; } |
0df32e0b2074
fix base class field assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
9743
diff
changeset
|
559 |
5759 | 560 virtual octave_function *function_value (bool silent = false); |
3933 | 561 |
5759 | 562 virtual octave_user_function *user_function_value (bool silent = false); |
4645 | 563 |
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
|
564 virtual octave_user_script *user_script_value (bool silent = false); |
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
|
565 |
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
|
566 virtual octave_user_code *user_code_value (bool silent = false); |
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
|
567 |
5759 | 568 virtual octave_fcn_handle *fcn_handle_value (bool silent = false); |
4643 | 569 |
5759 | 570 virtual octave_fcn_inline *fcn_inline_value (bool silent = false); |
2974 | 571 |
5759 | 572 virtual octave_value_list list_value (void) const; |
4343 | 573 |
5759 | 574 virtual octave_value convert_to_str (bool pad = false, bool force = false, |
10313 | 575 char type = '\'') const; |
5759 | 576 virtual octave_value |
577 convert_to_str_internal (bool pad, bool force, char type) const; | |
4933 | 578 |
5759 | 579 virtual void convert_to_row_or_column_vector (void); |
2882 | 580 |
5759 | 581 virtual bool print_as_scalar (void) const { return false; } |
2376 | 582 |
5759 | 583 virtual void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2376 | 584 |
5759 | 585 virtual void |
586 print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |
4604 | 587 |
5759 | 588 virtual bool |
589 print_name_tag (std::ostream& os, const std::string& name) const; | |
2901 | 590 |
5759 | 591 virtual void |
592 print_with_name (std::ostream& output_buf, const std::string& name, | |
10313 | 593 bool print_padding = true); |
2376 | 594 |
5759 | 595 virtual void print_info (std::ostream& os, const std::string& prefix) const; |
3933 | 596 |
6974 | 597 virtual bool save_ascii (std::ostream& os); |
4687 | 598 |
5759 | 599 virtual bool load_ascii (std::istream& is); |
4687 | 600 |
5759 | 601 virtual bool save_binary (std::ostream& os, bool& save_as_floats); |
4687 | 602 |
5759 | 603 virtual bool load_binary (std::istream& is, bool swap, |
10313 | 604 oct_mach_info::float_format fmt); |
4687 | 605 |
606 #if defined (HAVE_HDF5) | |
5759 | 607 virtual bool |
608 save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
4687 | 609 |
5759 | 610 virtual bool |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9835
diff
changeset
|
611 load_hdf5 (hid_t loc_id, const char *name); |
4687 | 612 #endif |
613 | |
5759 | 614 virtual int |
615 write (octave_stream& os, int block_size, | |
10313 | 616 oct_data_conv::data_type output_type, int skip, |
617 oct_mach_info::float_format flt_fmt) const; | |
5759 | 618 |
5900 | 619 virtual void *mex_get_data (void) const { return 0; } |
620 | |
621 virtual octave_idx_type *mex_get_ir (void) const { return 0; } | |
622 | |
623 virtual octave_idx_type *mex_get_jc (void) const { return 0; } | |
624 | |
625 virtual mxArray *as_mxArray (void) const; | |
626 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
627 virtual octave_value diag (octave_idx_type k = 0) const; |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
628 |
7433 | 629 virtual octave_value sort (octave_idx_type dim = 0, |
10313 | 630 sortmode mode = ASCENDING) const; |
7433 | 631 virtual octave_value sort (Array<octave_idx_type> &sidx, |
10313 | 632 octave_idx_type dim = 0, |
633 sortmode mode = ASCENDING) const; | |
7433 | 634 |
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
|
635 virtual sortmode is_sorted (sortmode mode = UNSORTED) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
636 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
637 virtual Array<octave_idx_type> |
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
638 sort_rows_idx (sortmode mode = ASCENDING) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
639 |
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
|
640 virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const; |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
641 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
642 virtual void lock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
643 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
644 virtual void unlock (void); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
645 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
646 virtual bool islocked (void) const { return false; } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
647 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
648 virtual void dump (std::ostream& os) const; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
649 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
650 // Standard mappers. Register new ones here. |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
651 enum unary_mapper_t |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
652 { |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
653 umap_abs, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
654 umap_acos, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
655 umap_acosh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
656 umap_angle, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
657 umap_arg, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
658 umap_asin, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
659 umap_asinh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
660 umap_atan, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
661 umap_atanh, |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
662 umap_cbrt, |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
663 umap_ceil, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
664 umap_conj, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
665 umap_cos, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
666 umap_cosh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
667 umap_erf, |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
668 umap_erfinv, |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
669 umap_erfc, |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
670 umap_erfcx, |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
671 umap_exp, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
672 umap_expm1, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
673 umap_finite, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
674 umap_fix, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
675 umap_floor, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
676 umap_gamma, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
677 umap_imag, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
678 umap_isinf, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
679 umap_isna, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
680 umap_isnan, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
681 umap_lgamma, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
682 umap_log, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
683 umap_log2, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
684 umap_log10, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
685 umap_log1p, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
686 umap_real, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
687 umap_round, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
688 umap_roundb, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
689 umap_signum, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
690 umap_sin, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
691 umap_sinh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
692 umap_sqrt, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
693 umap_tan, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
694 umap_tanh, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
695 umap_xisalnum, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
696 umap_xisalpha, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
697 umap_xisascii, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
698 umap_xiscntrl, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
699 umap_xisdigit, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
700 umap_xisgraph, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
701 umap_xislower, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
702 umap_xisprint, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
703 umap_xispunct, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
704 umap_xisspace, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
705 umap_xisupper, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
706 umap_xisxdigit, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
707 umap_xtoascii, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
708 umap_xtolower, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
709 umap_xtoupper, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
710 umap_unknown, |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
711 num_unary_mappers = umap_unknown |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
712 }; |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
713 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
714 virtual octave_value map (unary_mapper_t) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
715 |
5759 | 716 protected: |
717 | |
718 // This should only be called for derived types. | |
719 | |
720 octave_value numeric_assign (const std::string& type, | |
10313 | 721 const std::list<octave_value_list>& idx, |
722 const octave_value& rhs); | |
5759 | 723 |
724 void reset_indent_level (void) const | |
725 { curr_print_indent_level = 0; } | |
726 | |
727 void increment_indent_level (void) const | |
728 { curr_print_indent_level += 2; } | |
729 | |
730 void decrement_indent_level (void) const | |
731 { curr_print_indent_level -= 2; } | |
732 | |
733 int current_print_indent_level (void) const | |
734 { return curr_print_indent_level; } | |
735 | |
736 void indent (std::ostream& os) const; | |
737 | |
738 void newline (std::ostream& os) const; | |
739 | |
740 void reset (void) const; | |
741 | |
742 // A reference count. | |
9521 | 743 // NOTE: the declaration is octave_idx_type because with 64-bit indexing, |
744 // it is well possible to have more than MAX_INT copies of a single value | |
745 // (think of an empty cell array with >2G elements). | |
746 octave_idx_type count; | |
4944 | 747 |
2376 | 748 private: |
749 | |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
750 static const char *get_umap_name (unary_mapper_t); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
751 |
5759 | 752 static int curr_print_indent_level; |
753 static bool beginning_of_line; | |
754 | |
755 DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA | |
2376 | 756 }; |
757 | |
7193 | 758 // TRUE means to perform automatic sparse to real mutation if there |
759 // is memory to be saved | |
10612
09e244649f50
Export symbol Vsparse_auto_mutate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10544
diff
changeset
|
760 extern OCTINTERP_API bool Vsparse_auto_mutate; |
7193 | 761 |
2376 | 762 #endif |