Mercurial > hg > octave-lyh
annotate src/ov.h @ 14846:460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Example: func() => func ()
* dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc,
funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h,
CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc,
CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc,
Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h,
SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc,
SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h,
SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc,
dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc,
dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc,
fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc,
fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc,
file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h,
lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc,
oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c,
sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc,
tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m,
what.m, getarchdir.m, install.m, installed_packages.m, repackage.m,
unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m,
plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m,
__marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m,
trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc,
__dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc,
bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc,
dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc,
lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc,
regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc,
op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc,
op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc,
op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc,
op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc,
op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc,
op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc,
op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc,
data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc,
graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h,
ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h,
oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc,
ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc,
ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc,
ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc,
ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc,
pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc,
toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m,
getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m,
getStash.m, myStash.m, fntests.m: Use Octave coding convention for
cuddled parenthis in function calls with empty argument lists.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 08 Jul 2012 11:28:50 -0700 |
parents | cb85e836d035 |
children |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
11523 | 4 Copyright (C) 2009-2010 VZLU Prague |
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 #if !defined (octave_value_h) | |
25 #define octave_value_h 1 | |
26 | |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
2376 | 30 #include <string> |
4219 | 31 #include <list> |
2376 | 32 |
33 #include "Range.h" | |
5828 | 34 #include "data-conv.h" |
2376 | 35 #include "idx-vector.h" |
5828 | 36 #include "mach-info.h" |
5900 | 37 #include "mxarray.h" |
2376 | 38 #include "mx-base.h" |
2477 | 39 #include "oct-alloc.h" |
4254 | 40 #include "oct-time.h" |
2942 | 41 #include "str-vec.h" |
42 | |
8676 | 43 #include "oct-hdf5.h" |
7433 | 44 #include "oct-sort.h" |
45 | |
3351 | 46 class Cell; |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
47 class octave_map; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
48 class octave_scalar_map; |
2376 | 49 class Octave_map; |
2903 | 50 class octave_stream; |
2974 | 51 class octave_function; |
4700 | 52 class octave_user_function; |
4342 | 53 class octave_fcn_handle; |
4933 | 54 class octave_fcn_inline; |
2376 | 55 class octave_value_list; |
2979 | 56 class octave_lvalue; |
2376 | 57 |
5759 | 58 #include "ov-base.h" |
2376 | 59 |
5759 | 60 // Constants. |
2376 | 61 |
2427 | 62 class octave_value; |
63 | |
2376 | 64 class |
6109 | 65 OCTINTERP_API |
2974 | 66 octave_value |
2376 | 67 { |
68 public: | |
69 | |
3203 | 70 enum unary_op |
71 { | |
6518 | 72 op_not, // not |
73 op_uplus, // uplus | |
74 op_uminus, // uminus | |
75 op_transpose, // transpose | |
76 op_hermitian, // ctranspose | |
3525 | 77 op_incr, |
78 op_decr, | |
3203 | 79 num_unary_ops, |
80 unknown_unary_op | |
81 }; | |
82 | |
2376 | 83 enum binary_op |
84 { | |
6518 | 85 op_add, // plus |
86 op_sub, // minus | |
87 op_mul, // mtimes | |
88 op_div, // mrdivide | |
89 op_pow, // mpower | |
90 op_ldiv, // mldivide | |
3525 | 91 op_lshift, |
92 op_rshift, | |
6518 | 93 op_lt, // lt |
94 op_le, // le | |
95 op_eq, // eq | |
96 op_ge, // ge | |
97 op_gt, // gt | |
98 op_ne, // ne | |
99 op_el_mul, // times | |
100 op_el_div, // rdivide | |
101 op_el_pow, // power | |
102 op_el_ldiv, // ldivide | |
103 op_el_and, // and | |
104 op_el_or, // or | |
3525 | 105 op_struct_ref, |
2376 | 106 num_binary_ops, |
107 unknown_binary_op | |
108 }; | |
109 | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
110 enum compound_binary_op |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
111 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
112 // ** compound operations ** |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
113 op_trans_mul, |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
114 op_mul_trans, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
115 op_herm_mul, |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
116 op_mul_herm, |
9661
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9657
diff
changeset
|
117 op_trans_ldiv, |
afcf852256d2
optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
9657
diff
changeset
|
118 op_herm_ldiv, |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
119 op_el_not_and, |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
120 op_el_not_or, |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
121 op_el_and_not, |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
122 op_el_or_not, |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
123 num_compound_binary_ops, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
124 unknown_compound_binary_op |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
125 }; |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
126 |
2880 | 127 enum assign_op |
128 { | |
3525 | 129 op_asn_eq, |
130 op_add_eq, | |
131 op_sub_eq, | |
132 op_mul_eq, | |
133 op_div_eq, | |
134 op_ldiv_eq, | |
4018 | 135 op_pow_eq, |
3525 | 136 op_lshift_eq, |
137 op_rshift_eq, | |
138 op_el_mul_eq, | |
139 op_el_div_eq, | |
140 op_el_ldiv_eq, | |
4018 | 141 op_el_pow_eq, |
3525 | 142 op_el_and_eq, |
143 op_el_or_eq, | |
2880 | 144 num_assign_ops, |
145 unknown_assign_op | |
146 }; | |
147 | |
9607
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9521
diff
changeset
|
148 static assign_op binary_op_to_assign_op (binary_op); |
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9521
diff
changeset
|
149 |
3523 | 150 static std::string unary_op_as_string (unary_op); |
7336 | 151 static std::string unary_op_fcn_name (unary_op); |
3203 | 152 |
3523 | 153 static std::string binary_op_as_string (binary_op); |
7336 | 154 static std::string binary_op_fcn_name (binary_op); |
2376 | 155 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
156 static std::string binary_op_fcn_name (compound_binary_op); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
157 |
3523 | 158 static std::string assign_op_as_string (assign_op); |
2880 | 159 |
3933 | 160 static octave_value empty_conv (const std::string& type, |
10313 | 161 const octave_value& rhs = octave_value ()); |
3933 | 162 |
2376 | 163 enum magic_colon { magic_colon_t }; |
164 | |
8992
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
165 octave_value (void) |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
166 { |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
167 static octave_base_value nil_rep; |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
168 rep = &nil_rep; |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
169 rep->count++; |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
170 } |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
171 |
4254 | 172 octave_value (short int i); |
173 octave_value (unsigned short int i); | |
4233 | 174 octave_value (int i); |
4254 | 175 octave_value (unsigned int i); |
176 octave_value (long int i); | |
177 octave_value (unsigned long int i); | |
4353 | 178 |
5775 | 179 // FIXME -- these are kluges. They turn into doubles |
4353 | 180 // internally, which will break for very large values. We just use |
181 // them to store things like 64-bit ino_t, etc, and hope that those | |
182 // values are never actually larger than can be represented exactly | |
183 // in a double. | |
184 | |
185 #if defined (HAVE_LONG_LONG_INT) | |
186 octave_value (long long int i); | |
187 #endif | |
4356 | 188 #if defined (HAVE_UNSIGNED_LONG_LONG_INT) |
4353 | 189 octave_value (unsigned long long int i); |
190 #endif | |
191 | |
4254 | 192 octave_value (octave_time t); |
2376 | 193 octave_value (double d); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
194 octave_value (float d); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
195 octave_value (const Array<octave_value>& a, bool is_cs_list = false); |
4532 | 196 octave_value (const Cell& c, bool is_cs_list = false); |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
197 octave_value (const Matrix& m, const MatrixType& t = MatrixType ()); |
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
198 octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ()); |
4513 | 199 octave_value (const NDArray& nda); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
200 octave_value (const FloatNDArray& nda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
201 octave_value (const Array<double>& m); |
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
202 octave_value (const Array<float>& m); |
2376 | 203 octave_value (const DiagMatrix& d); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
204 octave_value (const FloatDiagMatrix& d); |
3418 | 205 octave_value (const RowVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
206 octave_value (const FloatRowVector& v); |
3418 | 207 octave_value (const ColumnVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
208 octave_value (const FloatColumnVector& v); |
2376 | 209 octave_value (const Complex& C); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
210 octave_value (const FloatComplex& C); |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
211 octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType ()); |
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
212 octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType ()); |
4513 | 213 octave_value (const ComplexNDArray& cnda); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
214 octave_value (const FloatComplexNDArray& cnda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
215 octave_value (const Array<Complex>& m); |
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
216 octave_value (const Array<FloatComplex>& m); |
2376 | 217 octave_value (const ComplexDiagMatrix& d); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
218 octave_value (const FloatComplexDiagMatrix& d); |
3418 | 219 octave_value (const ComplexRowVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
220 octave_value (const FloatComplexRowVector& v); |
3418 | 221 octave_value (const ComplexColumnVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
222 octave_value (const FloatComplexColumnVector& v); |
8960
93f18f166aba
remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8950
diff
changeset
|
223 octave_value (const PermMatrix& p); |
2825 | 224 octave_value (bool b); |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
225 octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType ()); |
4513 | 226 octave_value (const boolNDArray& bnda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
227 octave_value (const Array<bool>& bnda); |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
228 octave_value (char c, char type = '\''); |
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
229 octave_value (const char *s, char type = '\''); |
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
230 octave_value (const std::string& s, char type = '\''); |
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
231 octave_value (const string_vector& s, char type = '\''); |
10313 | 232 octave_value (const charMatrix& chm, char type = '\''); |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
233 octave_value (const charNDArray& chnda, char type = '\''); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
234 octave_value (const Array<char>& chnda, char type = '\''); |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
235 octave_value (const charMatrix& chm, bool is_string, |
10313 | 236 char type = '\'') GCC_ATTR_DEPRECATED; |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
237 octave_value (const charNDArray& chnda, bool is_string, |
10313 | 238 char type = '\'') GCC_ATTR_DEPRECATED; |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
239 octave_value (const Array<char>& chnda, bool is_string, |
10313 | 240 char type = '\'') GCC_ATTR_DEPRECATED; |
5785 | 241 octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ()); |
6863 | 242 octave_value (const Sparse<double>& m, const MatrixType& t = MatrixType ()); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
243 octave_value (const SparseComplexMatrix& m, |
10313 | 244 const MatrixType& t = MatrixType ()); |
6863 | 245 octave_value (const Sparse<Complex>& m, const MatrixType& t = MatrixType ()); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
246 octave_value (const SparseBoolMatrix& bm, |
10313 | 247 const MatrixType& t = MatrixType ()); |
7433 | 248 octave_value (const Sparse<bool>& m, const MatrixType& t = MatrixType ()); |
4901 | 249 octave_value (const octave_int8& i); |
4910 | 250 octave_value (const octave_int16& i); |
251 octave_value (const octave_int32& i); | |
252 octave_value (const octave_int64& i); | |
4901 | 253 octave_value (const octave_uint8& i); |
254 octave_value (const octave_uint16& i); | |
255 octave_value (const octave_uint32& i); | |
256 octave_value (const octave_uint64& i); | |
257 octave_value (const int8NDArray& inda); | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
258 octave_value (const Array<octave_int8>& inda); |
4910 | 259 octave_value (const int16NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
260 octave_value (const Array<octave_int16>& inda); |
4910 | 261 octave_value (const int32NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
262 octave_value (const Array<octave_int32>& inda); |
4910 | 263 octave_value (const int64NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
264 octave_value (const Array<octave_int64>& inda); |
4901 | 265 octave_value (const uint8NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
266 octave_value (const Array<octave_uint8>& inda); |
4901 | 267 octave_value (const uint16NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
268 octave_value (const Array<octave_uint16>& inda); |
4901 | 269 octave_value (const uint32NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
270 octave_value (const Array<octave_uint32>& inda); |
4901 | 271 octave_value (const uint64NDArray& inda); |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9728
diff
changeset
|
272 octave_value (const Array<octave_uint64>& inda); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
273 octave_value (const Array<octave_idx_type>& inda, |
9351
e2344f4af0cb
autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents:
9329
diff
changeset
|
274 bool zero_based = false, bool cache_index = false); |
9725 | 275 octave_value (const Array<std::string>& cellstr); |
10325
8b3cfc1288e2
implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
276 octave_value (const idx_vector& idx, bool lazy = true); |
2376 | 277 octave_value (double base, double limit, double inc); |
278 octave_value (const Range& r); | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
279 octave_value (const octave_map& m); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
280 octave_value (const octave_scalar_map& m); |
2376 | 281 octave_value (const Octave_map& m); |
13294
7dce7e110511
make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents:
13241
diff
changeset
|
282 octave_value (const Octave_map& m, const std::string& id, |
13874
c1b754d93572
copy parent class info when performing operations on class objects
John W. Eaton <jwe@octave.org>
parents:
13736
diff
changeset
|
283 const std::list<std::string>& plist); |
10293 | 284 octave_value (const octave_value_list& m, bool = false); |
2376 | 285 octave_value (octave_value::magic_colon); |
286 | |
9728
70925b11ba46
again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents:
9725
diff
changeset
|
287 octave_value (octave_base_value *new_rep, bool borrow = false); |
70925b11ba46
again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents:
9725
diff
changeset
|
288 octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED; |
2376 | 289 |
290 // Copy constructor. | |
291 | |
292 octave_value (const octave_value& a) | |
293 { | |
294 rep = a.rep; | |
295 rep->count++; | |
296 } | |
297 | |
3933 | 298 // This should only be called for derived types. |
299 | |
5759 | 300 octave_base_value *clone (void) const; |
3933 | 301 |
5759 | 302 octave_base_value *empty_clone (void) const |
3933 | 303 { return rep->empty_clone (); } |
304 | |
2376 | 305 // Delete the representation of this constant if the count drops to |
306 // zero. | |
307 | |
6338 | 308 ~octave_value (void) |
309 { | |
310 if (--rep->count == 0) | |
311 delete rep; | |
312 } | |
2376 | 313 |
314 void make_unique (void) | |
315 { | |
316 if (rep->count > 1) | |
10313 | 317 { |
14445 | 318 octave_base_value *r = rep->unique_clone (); |
13985
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
319 |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
320 if (--rep->count == 0) |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
321 delete rep; |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
322 |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
323 rep = r; |
10313 | 324 } |
2376 | 325 } |
326 | |
8546
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
327 // This uniquifies the value if it is referenced by more than a certain |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
328 // number of shallow copies. This is useful for optimizations where we |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
329 // know a certain copy, typically within a cell array, to be obsolete. |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
330 void make_unique (int obsolete_copies) |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
331 { |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
332 if (rep->count > obsolete_copies + 1) |
10313 | 333 { |
13985
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
334 octave_base_value *r = rep->unique_clone (); |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
335 |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
336 if (--rep->count == 0) |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
337 delete rep; |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
338 |
43cc49c7abd1
Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13874
diff
changeset
|
339 rep = r; |
10313 | 340 } |
8546
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
341 } |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
342 |
2376 | 343 // Simple assignment. |
344 | |
345 octave_value& operator = (const octave_value& a) | |
346 { | |
347 if (rep != a.rep) | |
10313 | 348 { |
349 if (--rep->count == 0) | |
350 delete rep; | |
2376 | 351 |
10313 | 352 rep = a.rep; |
353 rep->count++; | |
354 } | |
2376 | 355 |
356 return *this; | |
357 } | |
358 | |
9703
9a5598cf899d
octave_value::get_count: return octave_idx_type, not int
John W. Eaton <jwe@octave.org>
parents:
9689
diff
changeset
|
359 octave_idx_type get_count (void) const { return rep->count; } |
3239 | 360 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
361 octave_base_value::type_conv_info numeric_conversion_function (void) const |
2376 | 362 { return rep->numeric_conversion_function (); } |
363 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
364 octave_base_value::type_conv_info numeric_demotion_function (void) const |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
365 { return rep->numeric_demotion_function (); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
366 |
2409 | 367 void maybe_mutate (void); |
368 | |
5759 | 369 octave_value squeeze (void) const |
4532 | 370 { return rep->squeeze (); } |
371 | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
372 // The result of full(). |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
373 octave_value full_value (void) const |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
374 { return rep->full_value (); } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
375 |
5759 | 376 octave_base_value *try_narrowing_conversion (void) |
2410 | 377 { return rep->try_narrowing_conversion (); } |
2409 | 378 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
379 // Close to dims (), but can be overloaded for classes. |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
380 Matrix size (void) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
381 { return rep->size (); } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
382 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
383 octave_idx_type numel (const octave_value_list& idx) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
384 { return rep->numel (idx); } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
385 |
4271 | 386 octave_value single_subsref (const std::string& type, |
10313 | 387 const octave_value_list& idx); |
4271 | 388 |
5759 | 389 octave_value subsref (const std::string& type, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
390 const std::list<octave_value_list>& idx) |
3933 | 391 { return rep->subsref (type, idx); } |
392 | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
393 octave_value subsref (const std::string& type, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
394 const std::list<octave_value_list>& idx, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
395 bool auto_add) |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
396 { return rep->subsref (type, idx, auto_add); } |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
397 |
5759 | 398 octave_value_list subsref (const std::string& type, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
399 const std::list<octave_value_list>& idx, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
400 int nargout); |
3933 | 401 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
402 octave_value_list subsref (const std::string& type, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
403 const std::list<octave_value_list>& idx, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
404 int nargout, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
405 const std::list<octave_lvalue> *lvalue_list); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
406 |
4247 | 407 octave_value next_subsref (const std::string& type, const |
10313 | 408 std::list<octave_value_list>& idx, |
409 size_t skip = 1); | |
3933 | 410 |
4994 | 411 octave_value_list next_subsref (int nargout, |
10313 | 412 const std::string& type, const |
413 std::list<octave_value_list>& idx, | |
414 size_t skip = 1); | |
4994 | 415 |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
416 octave_value next_subsref (bool auto_add, const std::string& type, const |
10313 | 417 std::list<octave_value_list>& idx, |
418 size_t skip = 1); | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
419 |
5759 | 420 octave_value do_index_op (const octave_value_list& idx, |
10313 | 421 bool resize_ok = false) |
3933 | 422 { return rep->do_index_op (idx, resize_ok); } |
423 | |
5759 | 424 octave_value_list |
3544 | 425 do_multi_index_op (int nargout, const octave_value_list& idx); |
2974 | 426 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
427 octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
428 do_multi_index_op (int nargout, const octave_value_list& idx, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
429 const std::list<octave_lvalue> *lvalue_list); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
430 |
5759 | 431 octave_value subsasgn (const std::string& type, |
10313 | 432 const std::list<octave_value_list>& idx, |
433 const octave_value& rhs); | |
2376 | 434 |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
435 octave_value undef_subsasgn (const std::string& type, |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
436 const std::list<octave_value_list>& idx, |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
437 const octave_value& rhs); |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
438 |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
439 octave_value& assign (assign_op op, const std::string& type, |
10313 | 440 const std::list<octave_value_list>& idx, |
441 const octave_value& rhs); | |
2948 | 442 |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
443 octave_value& assign (assign_op, const octave_value& rhs); |
2948 | 444 |
5759 | 445 idx_vector index_vector (void) const |
2376 | 446 { return rep->index_vector (); } |
447 | |
448 // Size. | |
449 | |
5759 | 450 dim_vector dims (void) const |
4513 | 451 { return rep->dims (); } |
452 | |
5759 | 453 octave_idx_type rows (void) const { return rep->rows (); } |
4563 | 454 |
5759 | 455 octave_idx_type columns (void) const { return rep->columns (); } |
3195 | 456 |
5275 | 457 octave_idx_type length (void) const; |
4554 | 458 |
5759 | 459 int ndims (void) const { return rep->ndims (); } |
4563 | 460 |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14770
diff
changeset
|
461 bool all_zero_dims (void) const { return dims ().all_zero (); } |
5164 | 462 |
5759 | 463 octave_idx_type numel (void) const |
5080 | 464 { return rep->numel (); } |
4559 | 465 |
5759 | 466 octave_idx_type capacity (void) const |
5164 | 467 { return rep->capacity (); } |
468 | |
5759 | 469 size_t byte_size (void) const |
4791 | 470 { return rep->byte_size (); } |
471 | |
5759 | 472 octave_idx_type nnz (void) const { return rep->nnz (); } |
5602 | 473 |
5759 | 474 octave_idx_type nzmax (void) const { return rep->nzmax (); } |
5604 | 475 |
5900 | 476 octave_idx_type nfields (void) const { return rep->nfields (); } |
477 | |
5759 | 478 octave_value reshape (const dim_vector& dv) const |
4587 | 479 { return rep->reshape (dv); } |
4567 | 480 |
5759 | 481 octave_value permute (const Array<int>& vec, bool inv = false) const |
4593 | 482 { return rep->permute (vec, inv); } |
483 | |
484 octave_value ipermute (const Array<int>& vec) const | |
485 { return rep->permute (vec, true); } | |
486 | |
5759 | 487 octave_value resize (const dim_vector& dv, bool fill = false) const |
488 { return rep->resize (dv, fill);} | |
4915 | 489 |
5785 | 490 MatrixType matrix_type (void) const |
491 { return rep->matrix_type (); } | |
492 | |
493 MatrixType matrix_type (const MatrixType& typ) const | |
494 { return rep->matrix_type (typ); } | |
495 | |
2376 | 496 // Does this constant have a type? Both of these are provided since |
497 // it is sometimes more natural to write is_undefined() instead of | |
498 // ! is_defined(). | |
499 | |
5759 | 500 bool is_defined (void) const |
2376 | 501 { return rep->is_defined (); } |
502 | |
503 bool is_undefined (void) const | |
504 { return ! is_defined (); } | |
505 | |
4559 | 506 bool is_empty (void) const |
5759 | 507 { return rep->is_empty (); } |
4559 | 508 |
5759 | 509 bool is_cell (void) const |
3351 | 510 { return rep->is_cell (); } |
511 | |
6116 | 512 bool is_cellstr (void) const |
513 { return rep->is_cellstr (); } | |
514 | |
5759 | 515 bool is_real_scalar (void) const |
2376 | 516 { return rep->is_real_scalar (); } |
517 | |
5759 | 518 bool is_real_matrix (void) const |
2376 | 519 { return rep->is_real_matrix (); } |
520 | |
5759 | 521 bool is_real_nd_array (void) const |
4505 | 522 { return rep->is_real_nd_array (); } |
523 | |
5759 | 524 bool is_complex_scalar (void) const |
2376 | 525 { return rep->is_complex_scalar (); } |
526 | |
5759 | 527 bool is_complex_matrix (void) const |
2376 | 528 { return rep->is_complex_matrix (); } |
529 | |
5881 | 530 bool is_bool_scalar (void) const |
531 { return rep->is_bool_scalar (); } | |
532 | |
5759 | 533 bool is_bool_matrix (void) const |
4587 | 534 { return rep->is_bool_matrix (); } |
535 | |
5759 | 536 bool is_char_matrix (void) const |
2376 | 537 { return rep->is_char_matrix (); } |
538 | |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8346
diff
changeset
|
539 bool is_diag_matrix (void) const |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8346
diff
changeset
|
540 { return rep->is_diag_matrix (); } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8346
diff
changeset
|
541 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
542 bool is_perm_matrix (void) const |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
543 { return rep->is_perm_matrix (); } |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
544 |
5759 | 545 bool is_string (void) const |
2376 | 546 { return rep->is_string (); } |
547 | |
5759 | 548 bool is_sq_string (void) const |
5279 | 549 { return rep->is_sq_string (); } |
550 | |
5280 | 551 bool is_dq_string (void) const |
552 { return rep->is_string () && ! rep->is_sq_string (); } | |
553 | |
5759 | 554 bool is_range (void) const |
2376 | 555 { return rep->is_range (); } |
556 | |
5759 | 557 bool is_map (void) const |
2376 | 558 { return rep->is_map (); } |
559 | |
7336 | 560 bool is_object (void) const |
561 { return rep->is_object (); } | |
562 | |
5759 | 563 bool is_cs_list (void) const |
3977 | 564 { return rep->is_cs_list (); } |
565 | |
5759 | 566 bool is_magic_colon (void) const |
2376 | 567 { return rep->is_magic_colon (); } |
568 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
569 bool is_null_value (void) const |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
570 { return rep->is_null_value (); } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
571 |
2376 | 572 // Are any or all of the elements in this constant nonzero? |
573 | |
5759 | 574 octave_value all (int dim = 0) const |
4015 | 575 { return rep->all (dim); } |
2376 | 576 |
5759 | 577 octave_value any (int dim = 0) const |
4015 | 578 { return rep->any (dim); } |
2376 | 579 |
9685 | 580 builtin_type_t builtin_type (void) const |
581 { return rep->builtin_type (); } | |
582 | |
5895 | 583 // Floating point types. |
584 | |
585 bool is_double_type (void) const | |
586 { return rep->is_double_type (); } | |
587 | |
588 bool is_single_type (void) const | |
589 { return rep->is_single_type (); } | |
590 | |
7576 | 591 bool is_float_type (void) const |
592 { return rep->is_float_type (); } | |
593 | |
5895 | 594 // Integer types. |
595 | |
596 bool is_int8_type (void) const | |
597 { return rep->is_int8_type (); } | |
598 | |
599 bool is_int16_type (void) const | |
600 { return rep->is_int16_type (); } | |
601 | |
602 bool is_int32_type (void) const | |
603 { return rep->is_int32_type (); } | |
604 | |
605 bool is_int64_type (void) const | |
606 { return rep->is_int64_type (); } | |
607 | |
608 bool is_uint8_type (void) const | |
609 { return rep->is_uint8_type (); } | |
610 | |
611 bool is_uint16_type (void) const | |
612 { return rep->is_uint16_type (); } | |
613 | |
614 bool is_uint32_type (void) const | |
615 { return rep->is_uint32_type (); } | |
616 | |
617 bool is_uint64_type (void) const | |
618 { return rep->is_uint64_type (); } | |
619 | |
2376 | 620 // Other type stuff. |
621 | |
5759 | 622 bool is_bool_type (void) const |
3209 | 623 { return rep->is_bool_type (); } |
624 | |
6223 | 625 bool is_integer_type (void) const |
626 { return rep->is_integer_type (); } | |
627 | |
5759 | 628 bool is_real_type (void) const |
2376 | 629 { return rep->is_real_type (); } |
630 | |
5759 | 631 bool is_complex_type (void) const |
2376 | 632 { return rep->is_complex_type (); } |
633 | |
5759 | 634 bool is_scalar_type (void) const |
2376 | 635 { return rep->is_scalar_type (); } |
636 | |
5759 | 637 bool is_matrix_type (void) const |
2376 | 638 { return rep->is_matrix_type (); } |
639 | |
5759 | 640 bool is_numeric_type (void) const |
2376 | 641 { return rep->is_numeric_type (); } |
642 | |
5759 | 643 bool is_sparse_type (void) const |
5631 | 644 { return rep->is_sparse_type (); } |
645 | |
2376 | 646 // Does this constant correspond to a truth value? |
647 | |
5759 | 648 bool is_true (void) const |
2376 | 649 { return rep->is_true (); } |
650 | |
8346
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
651 // Do two constants match (in a switch statement)? |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
652 |
8346
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
653 bool is_equal (const octave_value&) const; |
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
654 |
2376 | 655 // Are the dimensions of this constant zero by zero? |
656 | |
5759 | 657 bool is_zero_by_zero (void) const |
658 { return (rows () == 0 && columns () == 0); } | |
2376 | 659 |
5759 | 660 bool is_constant (void) const |
2974 | 661 { return rep->is_constant (); } |
662 | |
5759 | 663 bool is_function_handle (void) const |
4654 | 664 { return rep->is_function_handle (); } |
665 | |
13241
2a8dcb5b3a00
improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents:
13110
diff
changeset
|
666 bool is_anonymous_function (void) const |
2a8dcb5b3a00
improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents:
13110
diff
changeset
|
667 { return rep->is_anonymous_function (); } |
2a8dcb5b3a00
improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents:
13110
diff
changeset
|
668 |
5759 | 669 bool is_inline_function (void) const |
4954 | 670 { return rep->is_inline_function (); } |
671 | |
5759 | 672 bool is_function (void) const |
2974 | 673 { return rep->is_function (); } |
2891 | 674 |
7336 | 675 bool is_user_script (void) const |
676 { return rep->is_user_script (); } | |
677 | |
678 bool is_user_function (void) const | |
679 { return rep->is_user_function (); } | |
680 | |
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
|
681 bool is_user_code (void) const |
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
|
682 { return rep->is_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
|
683 |
5759 | 684 bool is_builtin_function (void) const |
3325 | 685 { return rep->is_builtin_function (); } |
686 | |
5759 | 687 bool is_dld_function (void) const |
3325 | 688 { return rep->is_dld_function (); } |
689 | |
5864 | 690 bool is_mex_function (void) const |
691 { return rep->is_mex_function (); } | |
692 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
693 void erase_subfunctions (void) { rep->erase_subfunctions (); } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
694 |
2376 | 695 // Values. |
696 | |
2891 | 697 octave_value eval (void) { return *this; } |
698 | |
5759 | 699 short int |
4254 | 700 short_value (bool req_int = false, bool frc_str_conv = false) const |
701 { return rep->short_value (req_int, frc_str_conv); } | |
702 | |
5759 | 703 unsigned short int |
4254 | 704 ushort_value (bool req_int = false, bool frc_str_conv = false) const |
705 { return rep->ushort_value (req_int, frc_str_conv); } | |
706 | |
5759 | 707 int int_value (bool req_int = false, bool frc_str_conv = false) const |
3202 | 708 { return rep->int_value (req_int, frc_str_conv); } |
709 | |
5759 | 710 unsigned int |
4254 | 711 uint_value (bool req_int = false, bool frc_str_conv = false) const |
712 { return rep->uint_value (req_int, frc_str_conv); } | |
713 | |
5759 | 714 int nint_value (bool frc_str_conv = false) const |
3202 | 715 { return rep->nint_value (frc_str_conv); } |
716 | |
5759 | 717 long int |
4254 | 718 long_value (bool req_int = false, bool frc_str_conv = false) const |
719 { return rep->long_value (req_int, frc_str_conv); } | |
720 | |
5759 | 721 unsigned long int |
4254 | 722 ulong_value (bool req_int = false, bool frc_str_conv = false) const |
723 { return rep->ulong_value (req_int, frc_str_conv); } | |
724 | |
6133 | 725 octave_idx_type |
8017
260294a5520f
octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents:
7885
diff
changeset
|
726 idx_type_value (bool req_int = false, bool frc_str_conv = false) const; |
6133 | 727 |
5759 | 728 double double_value (bool frc_str_conv = false) const |
2376 | 729 { return rep->double_value (frc_str_conv); } |
730 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
731 float float_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
732 { return rep->float_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
733 |
5759 | 734 double scalar_value (bool frc_str_conv = false) const |
2916 | 735 { return rep->scalar_value (frc_str_conv); } |
736 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
737 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
|
738 { return rep->float_scalar_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
739 |
5759 | 740 Cell cell_value (void) const; |
3351 | 741 |
5759 | 742 Matrix matrix_value (bool frc_str_conv = false) const |
2376 | 743 { return rep->matrix_value (frc_str_conv); } |
744 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
745 FloatMatrix float_matrix_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
746 { return rep->float_matrix_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
747 |
5759 | 748 NDArray array_value (bool frc_str_conv = false) const |
4550 | 749 { return rep->array_value (frc_str_conv); } |
4505 | 750 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
751 FloatNDArray float_array_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
752 { return rep->float_array_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
753 |
5759 | 754 Complex complex_value (bool frc_str_conv = false) const |
2376 | 755 { return rep->complex_value (frc_str_conv); } |
756 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
757 FloatComplex float_complex_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
758 { return rep->float_complex_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
759 |
5759 | 760 ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const |
2376 | 761 { return rep->complex_matrix_value (frc_str_conv); } |
762 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
763 FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
764 { return rep->float_complex_matrix_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
765 |
5759 | 766 ComplexNDArray complex_array_value (bool frc_str_conv = false) const |
4550 | 767 { return rep->complex_array_value (frc_str_conv); } |
768 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
769 FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
770 { return rep->float_complex_array_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
771 |
5943 | 772 bool bool_value (bool warn = false) const |
773 { return rep->bool_value (warn); } | |
4550 | 774 |
5943 | 775 boolMatrix bool_matrix_value (bool warn = false) const |
776 { return rep->bool_matrix_value (warn); } | |
4550 | 777 |
5943 | 778 boolNDArray bool_array_value (bool warn = false) const |
779 { return rep->bool_array_value (warn); } | |
4550 | 780 |
5759 | 781 charMatrix char_matrix_value (bool frc_str_conv = false) const |
2376 | 782 { return rep->char_matrix_value (frc_str_conv); } |
783 | |
5759 | 784 charNDArray char_array_value (bool frc_str_conv = false) const |
4550 | 785 { return rep->char_array_value (frc_str_conv); } |
786 | |
5759 | 787 SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const |
788 { return rep->sparse_matrix_value (frc_str_conv); } | |
5164 | 789 |
5759 | 790 SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = false) const |
791 { return rep->sparse_complex_matrix_value (frc_str_conv); } | |
5164 | 792 |
9852
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9835
diff
changeset
|
793 SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const |
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9835
diff
changeset
|
794 { return rep->sparse_bool_matrix_value (warn); } |
5164 | 795 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
796 DiagMatrix diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
797 { return rep->diag_matrix_value (force); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
798 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
799 FloatDiagMatrix float_diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
800 { return rep->float_diag_matrix_value (force); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
801 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
802 ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
803 { return rep->complex_diag_matrix_value (force); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
804 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
805 FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
806 { return rep->float_complex_diag_matrix_value (force); } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
807 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
808 PermMatrix perm_matrix_value (void) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
809 { return rep->perm_matrix_value (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
810 |
5759 | 811 octave_int8 int8_scalar_value (void) const |
4910 | 812 { return rep->int8_scalar_value (); } |
813 | |
5759 | 814 octave_int16 int16_scalar_value (void) const |
4910 | 815 { return rep->int16_scalar_value (); } |
816 | |
5759 | 817 octave_int32 int32_scalar_value (void) const |
4910 | 818 { return rep->int32_scalar_value (); } |
819 | |
5759 | 820 octave_int64 int64_scalar_value (void) const |
4910 | 821 { return rep->int64_scalar_value (); } |
822 | |
5759 | 823 octave_uint8 uint8_scalar_value (void) const |
4910 | 824 { return rep->uint8_scalar_value (); } |
825 | |
5759 | 826 octave_uint16 uint16_scalar_value (void) const |
4910 | 827 { return rep->uint16_scalar_value (); } |
828 | |
5759 | 829 octave_uint32 uint32_scalar_value (void) const |
4910 | 830 { return rep->uint32_scalar_value (); } |
831 | |
5759 | 832 octave_uint64 uint64_scalar_value (void) const |
4910 | 833 { return rep->uint64_scalar_value (); } |
834 | |
5759 | 835 int8NDArray int8_array_value (void) const |
4906 | 836 { return rep->int8_array_value (); } |
837 | |
5759 | 838 int16NDArray int16_array_value (void) const |
4906 | 839 { return rep->int16_array_value (); } |
840 | |
5759 | 841 int32NDArray int32_array_value (void) const |
4906 | 842 { return rep->int32_array_value (); } |
843 | |
5759 | 844 int64NDArray int64_array_value (void) const |
4906 | 845 { return rep->int64_array_value (); } |
846 | |
5759 | 847 uint8NDArray uint8_array_value (void) const |
4906 | 848 { return rep->uint8_array_value (); } |
849 | |
5759 | 850 uint16NDArray uint16_array_value (void) const |
4906 | 851 { return rep->uint16_array_value (); } |
852 | |
5759 | 853 uint32NDArray uint32_array_value (void) const |
4906 | 854 { return rep->uint32_array_value (); } |
855 | |
5759 | 856 uint64NDArray uint64_array_value (void) const |
4906 | 857 { return rep->uint64_array_value (); } |
858 | |
5759 | 859 string_vector all_strings (bool pad = false) const |
5715 | 860 { return rep->all_strings (pad); } |
2376 | 861 |
5759 | 862 std::string string_value (bool force = false) const |
4665 | 863 { return rep->string_value (force); } |
2376 | 864 |
8732 | 865 Array<std::string> cellstr_value (void) const |
866 { return rep->cellstr_value (); } | |
867 | |
5759 | 868 Range range_value (void) const |
2376 | 869 { return rep->range_value (); } |
870 | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
871 octave_map map_value (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
872 |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
873 octave_scalar_map scalar_map_value (void) const; |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
874 |
5759 | 875 string_vector map_keys (void) const |
3933 | 876 { return rep->map_keys (); } |
877 | |
9151 | 878 size_t nparents (void) const |
879 { return rep->nparents (); } | |
880 | |
881 std::list<std::string> parent_class_name_list (void) const | |
882 { return rep->parent_class_name_list (); } | |
883 | |
9010
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
884 string_vector parent_class_names (void) const |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
885 { return rep->parent_class_names (); } |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
886 |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
887 octave_base_value * |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
888 find_parent_class (const std::string& parent_class_name) |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
889 { return rep->find_parent_class (parent_class_name); } |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
890 |
10075
84b0725f4b09
return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
891 octave_function *function_value (bool silent = false) const; |
2974 | 892 |
10075
84b0725f4b09
return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
893 octave_user_function *user_function_value (bool silent = false) const; |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
894 |
10075
84b0725f4b09
return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
895 octave_user_script *user_script_value (bool silent = false) const; |
4700 | 896 |
10075
84b0725f4b09
return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
897 octave_user_code *user_code_value (bool silent = false) const; |
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
|
898 |
10075
84b0725f4b09
return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
899 octave_fcn_handle *fcn_handle_value (bool silent = false) const; |
4343 | 900 |
10075
84b0725f4b09
return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents:
9881
diff
changeset
|
901 octave_fcn_inline *fcn_inline_value (bool silent = false) const; |
4933 | 902 |
5759 | 903 octave_value_list list_value (void) const; |
2880 | 904 |
3419 | 905 ColumnVector column_vector_value (bool frc_str_conv = false, |
10313 | 906 bool frc_vec_conv = false) const; |
2376 | 907 |
908 ComplexColumnVector | |
3419 | 909 complex_column_vector_value (bool frc_str_conv = false, |
10313 | 910 bool frc_vec_conv = false) const; |
2376 | 911 |
3419 | 912 RowVector row_vector_value (bool frc_str_conv = false, |
10313 | 913 bool frc_vec_conv = false) const; |
3419 | 914 |
915 ComplexRowVector | |
916 complex_row_vector_value (bool frc_str_conv = false, | |
10313 | 917 bool frc_vec_conv = false) const; |
3419 | 918 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
919 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
920 FloatColumnVector float_column_vector_value (bool frc_str_conv = false, |
10313 | 921 bool frc_vec_conv = false) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
922 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
923 FloatComplexColumnVector |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
924 float_complex_column_vector_value (bool frc_str_conv = false, |
10313 | 925 bool frc_vec_conv = false) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
926 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
927 FloatRowVector float_row_vector_value (bool frc_str_conv = false, |
10313 | 928 bool frc_vec_conv = false) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
929 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
930 FloatComplexRowVector |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
931 float_complex_row_vector_value (bool frc_str_conv = false, |
10313 | 932 bool frc_vec_conv = false) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
933 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
934 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
935 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
936 |
4044 | 937 Array<int> int_vector_value (bool req_int = false, |
10313 | 938 bool frc_str_conv = false, |
939 bool frc_vec_conv = false) const; | |
4044 | 940 |
8811 | 941 Array<octave_idx_type> |
942 octave_idx_type_vector_value (bool req_int = false, | |
10313 | 943 bool frc_str_conv = false, |
944 bool frc_vec_conv = false) const; | |
8811 | 945 |
3419 | 946 Array<double> vector_value (bool frc_str_conv = false, |
10313 | 947 bool frc_vec_conv = false) const; |
3419 | 948 |
949 Array<Complex> complex_vector_value (bool frc_str_conv = false, | |
10313 | 950 bool frc_vec_conv = false) const; |
3419 | 951 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
952 Array<float> float_vector_value (bool frc_str_conv = false, |
10313 | 953 bool frc_vec_conv = false) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
954 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
955 Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false, |
10313 | 956 bool frc_vec_conv = false) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
957 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
958 // Possibly economize a lazy-indexed value. |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
959 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
960 void maybe_economize (void) |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
961 { rep->maybe_economize (); } |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
962 |
8531
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
963 // The following two hook conversions are called on any octave_value prior to |
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
964 // storing it to a "permanent" location, like a named variable, a cell or a |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
965 // struct component, or a return value of a function. |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
966 |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
967 octave_value storable_value (void) const; |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
968 |
8531
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
969 // Ditto, but in place, i.e. equivalent to *this = this->storable_value (), |
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
970 // but possibly more efficient. |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
971 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
972 void make_storable_value (void); |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
973 |
2376 | 974 // Conversions. These should probably be private. If a user of this |
975 // class wants a certain kind of constant, he should simply ask for | |
976 // it, and we should convert it if possible. | |
977 | |
5279 | 978 octave_value convert_to_str (bool pad = false, bool force = false, |
10313 | 979 char type = '\'') const |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9685
diff
changeset
|
980 { return rep->convert_to_str (pad, force, type); } |
4452 | 981 |
5759 | 982 octave_value |
5279 | 983 convert_to_str_internal (bool pad, bool force, char type) const |
984 { return rep->convert_to_str_internal (pad, force, type); } | |
2376 | 985 |
5759 | 986 void convert_to_row_or_column_vector (void) |
2376 | 987 { rep->convert_to_row_or_column_vector (); } |
988 | |
5759 | 989 bool print_as_scalar (void) const |
4604 | 990 { return rep->print_as_scalar (); } |
991 | |
5759 | 992 void print (std::ostream& os, bool pr_as_read_syntax = false) const |
2466 | 993 { rep->print (os, pr_as_read_syntax); } |
2376 | 994 |
5759 | 995 void print_raw (std::ostream& os, |
10313 | 996 bool pr_as_read_syntax = false) const |
2903 | 997 { rep->print_raw (os, pr_as_read_syntax); } |
998 | |
5759 | 999 bool print_name_tag (std::ostream& os, const std::string& name) const |
2903 | 1000 { return rep->print_name_tag (os, name); } |
2376 | 1001 |
13110
2d5035847529
Add Júlio Hoffimann Mendes to contributors.in
John W. Eaton <jwe@octave.org>
parents:
12171
diff
changeset
|
1002 void print_with_name (std::ostream& os, const std::string& name) const |
2d5035847529
Add Júlio Hoffimann Mendes to contributors.in
John W. Eaton <jwe@octave.org>
parents:
12171
diff
changeset
|
1003 { rep->print_with_name (os, name, true); } |
2376 | 1004 |
5759 | 1005 int type_id (void) const { return rep->type_id (); } |
2376 | 1006 |
5759 | 1007 std::string type_name (void) const { return rep->type_name (); } |
1008 | |
1009 std::string class_name (void) const { return rep->class_name (); } | |
4612 | 1010 |
3203 | 1011 // Unary and binary operations. |
1012 | |
6109 | 1013 friend OCTINTERP_API octave_value do_unary_op (unary_op op, |
10313 | 1014 const octave_value& a); |
3203 | 1015 |
10614
d1194069e58c
optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents:
10544
diff
changeset
|
1016 octave_value& do_non_const_unary_op (unary_op op); |
3933 | 1017 |
10614
d1194069e58c
optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents:
10544
diff
changeset
|
1018 octave_value& do_non_const_unary_op (unary_op op, const std::string& type, |
10313 | 1019 const std::list<octave_value_list>& idx); |
3205 | 1020 |
6109 | 1021 friend OCTINTERP_API octave_value do_binary_op (binary_op op, |
10313 | 1022 const octave_value& a, |
1023 const octave_value& b); | |
2376 | 1024 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1025 friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1026 const octave_value& a, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1027 const octave_value& b); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1028 |
6109 | 1029 friend OCTINTERP_API octave_value do_cat_op (const octave_value& a, |
10313 | 1030 const octave_value& b, |
1031 const Array<octave_idx_type>& ra_idx); | |
4915 | 1032 |
5759 | 1033 const octave_base_value& get_rep (void) const { return *rep; } |
3301 | 1034 |
8456
c1709a45b45b
optimize structure components access
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
1035 bool is_copy_of (const octave_value &val) const { return rep == val.rep; } |
c1709a45b45b
optimize structure components access
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
1036 |
5759 | 1037 void print_info (std::ostream& os, |
10313 | 1038 const std::string& prefix = std::string ()) const; |
3933 | 1039 |
6974 | 1040 bool save_ascii (std::ostream& os) { return rep->save_ascii (os); } |
4687 | 1041 |
6974 | 1042 bool load_ascii (std::istream& is) { return rep->load_ascii (is); } |
4687 | 1043 |
5759 | 1044 bool save_binary (std::ostream& os, bool& save_as_floats) |
4687 | 1045 { return rep->save_binary (os, save_as_floats); } |
1046 | |
5759 | 1047 bool load_binary (std::istream& is, bool swap, |
10313 | 1048 oct_mach_info::float_format fmt) |
4687 | 1049 { return rep->load_binary (is, swap, fmt); } |
1050 | |
1051 #if defined (HAVE_HDF5) | |
5759 | 1052 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) |
4687 | 1053 { return rep->save_hdf5 (loc_id, name, save_as_floats); } |
1054 | |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9852
diff
changeset
|
1055 bool load_hdf5 (hid_t loc_id, const char *name) |
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9852
diff
changeset
|
1056 { return rep->load_hdf5 (loc_id, name); } |
4687 | 1057 #endif |
1058 | |
5759 | 1059 int write (octave_stream& os, int block_size, |
10313 | 1060 oct_data_conv::data_type output_type, int skip, |
1061 oct_mach_info::float_format flt_fmt) const; | |
4944 | 1062 |
5759 | 1063 octave_base_value *internal_rep (void) const { return rep; } |
4901 | 1064 |
5900 | 1065 // Unsafe. These functions exist to support the MEX interface. |
1066 // You should not use them anywhere else. | |
1067 void *mex_get_data (void) const { return rep->mex_get_data (); } | |
1068 | |
1069 octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); } | |
1070 | |
1071 octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); } | |
1072 | |
1073 mxArray *as_mxArray (void) const { return rep->as_mxArray (); } | |
1074 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
1075 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
|
1076 { return rep->diag (k); } |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
1077 |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14528
diff
changeset
|
1078 octave_value diag (octave_idx_type m, octave_idx_type n) const |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14528
diff
changeset
|
1079 { return rep->diag (m, n); } |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14528
diff
changeset
|
1080 |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1081 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1082 { return rep->sort (dim, mode); } |
7433 | 1083 octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, |
10313 | 1084 sortmode mode = ASCENDING) const |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1085 { return rep->sort (sidx, dim, mode); } |
7433 | 1086 |
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
|
1087 sortmode is_sorted (sortmode mode = UNSORTED) const |
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
|
1088 { return rep->is_sorted (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
1089 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1090 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const |
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1091 { return rep->sort_rows_idx (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
1092 |
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
|
1093 sortmode is_sorted_rows (sortmode mode = UNSORTED) const |
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1094 { return rep->is_sorted_rows (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
1095 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1096 void lock (void) { rep->lock (); } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1097 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1098 void unlock (void) { rep->unlock (); } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1099 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1100 bool islocked (void) const { return rep->islocked (); } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1101 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1102 void dump (std::ostream& os) const { rep->dump (os); } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1103 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1104 #define MAPPER_FORWARD(F) \ |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1105 octave_value F (void) const { return rep->map (octave_base_value::umap_ ## F); } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1106 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1107 MAPPER_FORWARD (abs) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1108 MAPPER_FORWARD (acos) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1109 MAPPER_FORWARD (acosh) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1110 MAPPER_FORWARD (angle) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1111 MAPPER_FORWARD (arg) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1112 MAPPER_FORWARD (asin) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1113 MAPPER_FORWARD (asinh) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1114 MAPPER_FORWARD (atan) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1115 MAPPER_FORWARD (atanh) |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
1116 MAPPER_FORWARD (cbrt) |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1117 MAPPER_FORWARD (ceil) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1118 MAPPER_FORWARD (conj) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1119 MAPPER_FORWARD (cos) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1120 MAPPER_FORWARD (cosh) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1121 MAPPER_FORWARD (erf) |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9813
diff
changeset
|
1122 MAPPER_FORWARD (erfinv) |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14557
diff
changeset
|
1123 MAPPER_FORWARD (erfcinv) |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1124 MAPPER_FORWARD (erfc) |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10325
diff
changeset
|
1125 MAPPER_FORWARD (erfcx) |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1126 MAPPER_FORWARD (exp) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1127 MAPPER_FORWARD (expm1) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1128 MAPPER_FORWARD (finite) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1129 MAPPER_FORWARD (fix) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1130 MAPPER_FORWARD (floor) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1131 MAPPER_FORWARD (gamma) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1132 MAPPER_FORWARD (imag) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1133 MAPPER_FORWARD (isinf) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1134 MAPPER_FORWARD (isna) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1135 MAPPER_FORWARD (isnan) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1136 MAPPER_FORWARD (lgamma) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1137 MAPPER_FORWARD (log) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1138 MAPPER_FORWARD (log2) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1139 MAPPER_FORWARD (log10) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1140 MAPPER_FORWARD (log1p) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1141 MAPPER_FORWARD (real) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1142 MAPPER_FORWARD (round) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1143 MAPPER_FORWARD (roundb) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1144 MAPPER_FORWARD (signum) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1145 MAPPER_FORWARD (sin) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1146 MAPPER_FORWARD (sinh) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1147 MAPPER_FORWARD (sqrt) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1148 MAPPER_FORWARD (tan) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1149 MAPPER_FORWARD (tanh) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1150 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1151 // These functions are prefixed with X to avoid potential macro |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1152 // conflicts. |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1153 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1154 MAPPER_FORWARD (xisalnum) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1155 MAPPER_FORWARD (xisalpha) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1156 MAPPER_FORWARD (xisascii) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1157 MAPPER_FORWARD (xiscntrl) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1158 MAPPER_FORWARD (xisdigit) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1159 MAPPER_FORWARD (xisgraph) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1160 MAPPER_FORWARD (xislower) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1161 MAPPER_FORWARD (xisprint) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1162 MAPPER_FORWARD (xispunct) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1163 MAPPER_FORWARD (xisspace) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1164 MAPPER_FORWARD (xisupper) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1165 MAPPER_FORWARD (xisxdigit) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1166 MAPPER_FORWARD (xtoascii) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1167 MAPPER_FORWARD (xtolower) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1168 MAPPER_FORWARD (xtoupper) |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1169 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1170 #undef MAPPER_FORWARD |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1171 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1172 octave_value map (octave_base_value::unary_mapper_t umap) const |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1173 { return rep->map (umap); } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1174 |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1175 // Extract the n-th element, aka val(n). Result is undefined if val is not an |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1176 // array type or n is out of range. Never error. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1177 octave_value |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1178 fast_elem_extract (octave_idx_type n) const |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1179 { return rep->fast_elem_extract (n); } |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1180 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1181 // Assign the n-th element, aka val(n) = x. Returns false if val is not an |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1182 // array type, x is not a matching scalar type, or n is out of range. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1183 // Never error. |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1184 virtual bool |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1185 fast_elem_insert (octave_idx_type n, const octave_value& x) |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1186 { |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1187 make_unique (); |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1188 return rep->fast_elem_insert (n, x); |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1189 } |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10614
diff
changeset
|
1190 |
2376 | 1191 protected: |
1192 | |
5759 | 1193 // The real representation. |
1194 octave_base_value *rep; | |
2413 | 1195 |
3933 | 1196 private: |
2903 | 1197 |
3205 | 1198 assign_op unary_op_to_assign_op (unary_op op); |
1199 | |
3204 | 1200 binary_op op_eq_to_binary_op (assign_op op); |
1201 | |
9521 | 1202 // This declaration protects against constructing octave_value from |
1203 // const octave_base_value* which actually silently calls octave_value (bool). | |
1204 octave_value (const octave_base_value *); | |
1205 | |
3219 | 1206 DECLARE_OCTAVE_ALLOCATOR |
2376 | 1207 }; |
1208 | |
5508 | 1209 // Publish externally used friend functions. |
1210 | |
6109 | 1211 extern OCTINTERP_API octave_value |
5508 | 1212 do_unary_op (octave_value::unary_op op, const octave_value& a); |
1213 | |
6109 | 1214 extern OCTINTERP_API octave_value |
5508 | 1215 do_binary_op (octave_value::binary_op op, |
10313 | 1216 const octave_value& a, const octave_value& b); |
5508 | 1217 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1218 extern OCTINTERP_API octave_value |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1219 do_binary_op (octave_value::compound_binary_op op, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1220 const octave_value& a, const octave_value& b); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1221 |
3203 | 1222 #define OV_UNOP_FN(name) \ |
1223 inline octave_value \ | |
1224 name (const octave_value& a) \ | |
1225 { \ | |
1226 return do_unary_op (octave_value::name, a); \ | |
1227 } | |
1228 | |
1229 #define OV_UNOP_OP(name, op) \ | |
1230 inline octave_value \ | |
1231 operator op (const octave_value& a) \ | |
1232 { \ | |
1233 return name (a); \ | |
1234 } | |
1235 | |
1236 #define OV_UNOP_FN_OP(name, op) \ | |
1237 OV_UNOP_FN (name) \ | |
1238 OV_UNOP_OP (name, op) | |
1239 | |
3525 | 1240 OV_UNOP_FN_OP (op_not, !) |
6518 | 1241 OV_UNOP_FN_OP (op_uplus, +) |
3525 | 1242 OV_UNOP_FN_OP (op_uminus, -) |
3203 | 1243 |
3525 | 1244 OV_UNOP_FN (op_transpose) |
1245 OV_UNOP_FN (op_hermitian) | |
3203 | 1246 |
1247 // No simple way to define these for prefix and suffix ops? | |
1248 // | |
1249 // incr | |
1250 // decr | |
1251 | |
1252 #define OV_BINOP_FN(name) \ | |
1253 inline octave_value \ | |
1254 name (const octave_value& a1, const octave_value& a2) \ | |
1255 { \ | |
1256 return do_binary_op (octave_value::name, a1, a2); \ | |
1257 } | |
1258 | |
1259 #define OV_BINOP_OP(name, op) \ | |
1260 inline octave_value \ | |
1261 operator op (const octave_value& a1, const octave_value& a2) \ | |
1262 { \ | |
1263 return name (a1, a2); \ | |
1264 } | |
1265 | |
1266 #define OV_BINOP_FN_OP(name, op) \ | |
1267 OV_BINOP_FN (name) \ | |
1268 OV_BINOP_OP (name, op) | |
1269 | |
3525 | 1270 OV_BINOP_FN_OP (op_add, +) |
1271 OV_BINOP_FN_OP (op_sub, -) | |
1272 OV_BINOP_FN_OP (op_mul, *) | |
1273 OV_BINOP_FN_OP (op_div, /) | |
3203 | 1274 |
3525 | 1275 OV_BINOP_FN (op_pow) |
1276 OV_BINOP_FN (op_ldiv) | |
1277 OV_BINOP_FN (op_lshift) | |
1278 OV_BINOP_FN (op_rshift) | |
3203 | 1279 |
3525 | 1280 OV_BINOP_FN_OP (op_lt, <) |
1281 OV_BINOP_FN_OP (op_le, <=) | |
1282 OV_BINOP_FN_OP (op_eq, ==) | |
1283 OV_BINOP_FN_OP (op_ge, >=) | |
1284 OV_BINOP_FN_OP (op_gt, >) | |
1285 OV_BINOP_FN_OP (op_ne, !=) | |
3203 | 1286 |
3525 | 1287 OV_BINOP_FN (op_el_mul) |
1288 OV_BINOP_FN (op_el_div) | |
1289 OV_BINOP_FN (op_el_pow) | |
1290 OV_BINOP_FN (op_el_ldiv) | |
1291 OV_BINOP_FN (op_el_and) | |
1292 OV_BINOP_FN (op_el_or) | |
3203 | 1293 |
3525 | 1294 OV_BINOP_FN (op_struct_ref) |
3203 | 1295 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1296 #define OV_COMP_BINOP_FN(name) \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1297 inline octave_value \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1298 name (const octave_value& a1, const octave_value& a2) \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1299 { \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1300 return do_binary_op (octave_value::name, a1, a2); \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1301 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1302 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1303 OV_COMP_BINOP_FN (op_trans_mul) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1304 OV_COMP_BINOP_FN (op_mul_trans) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1305 OV_COMP_BINOP_FN (op_herm_mul) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1306 OV_COMP_BINOP_FN (op_mul_herm) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1307 |
6109 | 1308 extern OCTINTERP_API void install_types (void); |
2376 | 1309 |
5759 | 1310 // This will eventually go away, but for now it can be used to |
1311 // simplify the transition to the new octave_value class hierarchy, | |
1312 // which uses octave_base_value instead of octave_value for the type | |
1313 // of octave_value::rep. | |
1314 #define OV_REP_TYPE octave_base_value | |
1315 | |
9657
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1316 // Templated value extractors. |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1317 template<class Value> |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1318 inline Value octave_value_extract (const octave_value&) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1319 { assert (false); } |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1320 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1321 #define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \ |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1322 template<> \ |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1323 inline VALUE octave_value_extract<VALUE> (const octave_value& v) \ |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1324 { return v.MPREFIX ## _value (); } |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1325 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1326 DEF_VALUE_EXTRACTOR (double, scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1327 DEF_VALUE_EXTRACTOR (float, float_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1328 DEF_VALUE_EXTRACTOR (Complex, complex) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1329 DEF_VALUE_EXTRACTOR (FloatComplex, float_complex) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1330 DEF_VALUE_EXTRACTOR (bool, bool) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1331 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1332 DEF_VALUE_EXTRACTOR (octave_int8, int8_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1333 DEF_VALUE_EXTRACTOR (octave_int16, int16_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1334 DEF_VALUE_EXTRACTOR (octave_int32, int32_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1335 DEF_VALUE_EXTRACTOR (octave_int64, int64_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1336 DEF_VALUE_EXTRACTOR (octave_uint8, uint8_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1337 DEF_VALUE_EXTRACTOR (octave_uint16, uint16_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1338 DEF_VALUE_EXTRACTOR (octave_uint32, uint32_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1339 DEF_VALUE_EXTRACTOR (octave_uint64, uint64_scalar) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1340 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1341 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1342 DEF_VALUE_EXTRACTOR (NDArray, array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1343 DEF_VALUE_EXTRACTOR (FloatNDArray, float_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1344 DEF_VALUE_EXTRACTOR (ComplexNDArray, complex_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1345 DEF_VALUE_EXTRACTOR (FloatComplexNDArray, float_complex_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1346 DEF_VALUE_EXTRACTOR (boolNDArray, bool_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1347 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1348 DEF_VALUE_EXTRACTOR (charNDArray, char_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1349 DEF_VALUE_EXTRACTOR (int8NDArray, int8_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1350 DEF_VALUE_EXTRACTOR (int16NDArray, int16_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1351 DEF_VALUE_EXTRACTOR (int32NDArray, int32_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1352 DEF_VALUE_EXTRACTOR (int64NDArray, int64_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1353 DEF_VALUE_EXTRACTOR (uint8NDArray, uint8_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1354 DEF_VALUE_EXTRACTOR (uint16NDArray, uint16_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1355 DEF_VALUE_EXTRACTOR (uint32NDArray, uint32_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1356 DEF_VALUE_EXTRACTOR (uint64NDArray, uint64_array) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1357 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1358 DEF_VALUE_EXTRACTOR (Matrix, matrix) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1359 DEF_VALUE_EXTRACTOR (FloatMatrix, float_matrix) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1360 DEF_VALUE_EXTRACTOR (ComplexMatrix, complex_matrix) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1361 DEF_VALUE_EXTRACTOR (FloatComplexMatrix, float_complex_matrix) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1362 DEF_VALUE_EXTRACTOR (boolMatrix, bool_matrix) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1363 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1364 DEF_VALUE_EXTRACTOR (ColumnVector, column_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1365 DEF_VALUE_EXTRACTOR (FloatColumnVector, float_column_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1366 DEF_VALUE_EXTRACTOR (ComplexColumnVector, complex_column_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1367 DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1368 |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1369 DEF_VALUE_EXTRACTOR (RowVector, row_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1370 DEF_VALUE_EXTRACTOR (FloatRowVector, float_row_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1371 DEF_VALUE_EXTRACTOR (ComplexRowVector, complex_row_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1372 DEF_VALUE_EXTRACTOR (FloatComplexRowVector, float_complex_row_vector) |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1373 |
9685 | 1374 DEF_VALUE_EXTRACTOR (DiagMatrix, diag_matrix) |
1375 DEF_VALUE_EXTRACTOR (FloatDiagMatrix, float_diag_matrix) | |
1376 DEF_VALUE_EXTRACTOR (ComplexDiagMatrix, complex_diag_matrix) | |
1377 DEF_VALUE_EXTRACTOR (FloatComplexDiagMatrix, float_complex_diag_matrix) | |
1378 DEF_VALUE_EXTRACTOR (PermMatrix, perm_matrix) | |
1379 | |
9789
97f5de91427b
support sparse templated extractors
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
1380 DEF_VALUE_EXTRACTOR (SparseMatrix, sparse_matrix) |
97f5de91427b
support sparse templated extractors
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
1381 DEF_VALUE_EXTRACTOR (SparseComplexMatrix, sparse_complex_matrix) |
97f5de91427b
support sparse templated extractors
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
1382 DEF_VALUE_EXTRACTOR (SparseBoolMatrix, sparse_bool_matrix) |
9657
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1383 #undef DEF_VALUE_EXTRACTOR |
3c1c3a38ec7b
implement templated octave_value extractor
Jaroslav Hajek <highegg@gmail.com>
parents:
9607
diff
changeset
|
1384 |
13733
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1385 #define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \ |
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1386 template<> \ |
13736
deb69dab4514
Avoid some compilation warnings.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13733
diff
changeset
|
1387 inline VALUE octave_value_extract<VALUE> (const octave_value&) \ |
13733
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1388 { assert (false); return DEFVAL; } |
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1389 |
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1390 DEF_DUMMY_VALUE_EXTRACTOR (char, 0) |
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1391 DEF_DUMMY_VALUE_EXTRACTOR (octave_value, octave_value ()) |
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1392 #undef DEF_DUMMY_VALUE_EXTRACTOR |
b1186adb567e
Add dummy template specializations with a return value.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13294
diff
changeset
|
1393 |
2376 | 1394 #endif |