Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-range.h @ 20070:09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
* oct-hdf5-id.cc, oct-hdf5-id.h: New files.
* libinterp/corefcn/module.mk: Update.
* libgui/src/module.mk (src_libgui_src_la_CPPFLAGS): Remove
$(HDF5_CPPFLAGS) from the list.
* load-save.h (enum load_save_format_type): Always include LS_HDF5
in the list of values.
* ls-hdf5.cc (read_hdf5_data, save_hdf5_data):
Call check_hdf5_id_type.
* oct-hdf5.h: Also #define HDF5_SAVE_TYPE.
* ov.h, ov-base.h: Include oct-hdf5-id.h instead of oct-hdf5.h.
Always declare load_hdf5 and save_hdf5 functions.
* ov-base-int.cc, ov-base-int.h, ov-base.cc, ov-bool-mat.cc,
ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-cell.cc, ov-cell.h, ov-class.cc, ov-class.h,
ov-complex.cc, ov-complex.h, ov-cx-mat.cc, ov-cx-mat.h,
ov-cx-sparse.cc, ov-cx-sparse.h, ov-fcn-handle.cc, ov-fcn-handle.h,
ov-fcn-inline.cc, ov-fcn-inline.h, ov-float.cc, ov-float.h,
ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-mat.cc,
ov-flt-cx-mat.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-lazy-idx.h, ov-oncleanup.cc,
ov-oncleanup.h, ov-range.cc ov-range.h, ov-re-mat.cc, ov-re-mat.h,
ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h,
ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-uint16.cc,
ov-uint32.cc, ov-uint64.cc, ov-uint8.cc: Move #ifdef HAVE_HDF5 inside
load_hdf5 and save_hdf5 functions. Always declare and define
load_hdf5 and save_hdf5 functions.
author | John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org> |
---|---|
date | Thu, 26 Feb 2015 10:49:20 -0500 |
parents | 4197fc428c7d |
children | 00cf2847355d |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19795
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
2376 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2376 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2376 | 20 |
21 */ | |
22 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
23 #if !defined (octave_ov_range_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #define octave_ov_range_h 1 |
2376 | 25 |
26 #include <cstdlib> | |
27 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
28 #include <iosfwd> |
2376 | 29 #include <string> |
30 | |
31 #include "Range.h" | |
32 | |
2889 | 33 #include "lo-mappers.h" |
2376 | 34 #include "lo-utils.h" |
35 #include "mx-base.h" | |
36 #include "str-vec.h" | |
37 | |
38 #include "error.h" | |
5051 | 39 #include "oct-stream.h" |
2376 | 40 #include "ov-base.h" |
6127 | 41 #include "ov-re-mat.h" |
2376 | 42 #include "ov-typeinfo.h" |
43 | |
44 class octave_value_list; | |
45 | |
46 class tree_walker; | |
47 | |
48 // Range values. | |
49 | |
50 class | |
51 octave_range : public octave_base_value | |
52 { | |
53 public: | |
54 | |
55 octave_range (void) | |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11570
diff
changeset
|
56 : octave_base_value (), range (), idx_cache () { } |
2376 | 57 |
58 octave_range (double base, double limit, double inc) | |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
59 : octave_base_value (), range (base, limit, inc), idx_cache () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 if (range.nelem () < 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 ::error ("invalid range"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 } |
2376 | 64 |
65 octave_range (const Range& r) | |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
66 : octave_base_value (), range (r), idx_cache () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 if (range.nelem () < 0 && range.nelem () != -2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
69 ::error ("invalid range"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 } |
2376 | 71 |
72 octave_range (const octave_range& r) | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
73 : octave_base_value (), range (r.range), |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
74 idx_cache (r.idx_cache ? new idx_vector (*r.idx_cache) : 0) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 { } |
2376 | 76 |
9479
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
9350
diff
changeset
|
77 octave_range (const Range& r, const idx_vector& cache) |
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
9350
diff
changeset
|
78 : octave_base_value (), range (r), idx_cache () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 set_idx_cache (cache); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
81 } |
9479
d9716e3ee0dd
supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents:
9350
diff
changeset
|
82 |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
83 ~octave_range (void) { clear_cached_info (); } |
2376 | 84 |
5759 | 85 octave_base_value *clone (void) const { return new octave_range (*this); } |
6127 | 86 |
87 // A range is really just a special kind of real matrix object. In | |
88 // the places where we need to call empty_clone, it makes more sense | |
89 // to create an empty matrix (0x0) instead of an empty range (1x0). | |
90 octave_base_value *empty_clone (void) const { return new octave_matrix (); } | |
2376 | 91 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
92 type_conv_info numeric_conversion_function (void) const; |
2410 | 93 |
5759 | 94 octave_base_value *try_narrowing_conversion (void); |
2376 | 95 |
4247 | 96 octave_value subsref (const std::string& type, |
10313 | 97 const std::list<octave_value_list>& idx); |
3933 | 98 |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
99 octave_value_list subsref (const std::string& type, |
10313 | 100 const std::list<octave_value_list>& idx, int) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
101 { return subsref (type, idx); } |
4271 | 102 |
5885 | 103 octave_value do_index_op (const octave_value_list& idx, |
10313 | 104 bool resize_ok = false); |
2436 | 105 |
18129
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17870
diff
changeset
|
106 idx_vector index_vector (bool require_integers = false) const; |
2376 | 107 |
4563 | 108 dim_vector dims (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
110 octave_idx_type n = range.nelem (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 return dim_vector (n > 0, n); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
112 } |
3195 | 113 |
5731 | 114 octave_value resize (const dim_vector& dv, bool fill = false) const; |
115 | |
4915 | 116 |
4792 | 117 size_t byte_size (void) const { return 3 * sizeof (double); } |
4791 | 118 |
4627 | 119 octave_value reshape (const dim_vector& new_dims) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 { return NDArray (array_value ().reshape (new_dims)); } |
4627 | 121 |
5434 | 122 octave_value permute (const Array<int>& vec, bool inv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 { return NDArray (array_value ().permute (vec, inv)); } |
5434 | 124 |
6999 | 125 octave_value squeeze (void) const { return range; } |
126 | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
127 octave_value full_value (void) const { return range.matrix_value (); } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
128 |
2376 | 129 bool is_defined (void) const { return true; } |
130 | |
2974 | 131 bool is_constant (void) const { return true; } |
132 | |
2376 | 133 bool is_range (void) const { return true; } |
134 | |
4017 | 135 octave_value all (int dim = 0) const; |
136 | |
137 octave_value any (int dim = 0) const; | |
2376 | 138 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
139 octave_value diag (octave_idx_type k = 0) const; |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
140 |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
141 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:
14138
diff
changeset
|
142 |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7458
diff
changeset
|
143 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
144 { return range.sort (dim, mode); } |
7458 | 145 |
146 octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, | |
10313 | 147 sortmode mode = ASCENDING) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
148 { return range.sort (sidx, dim, mode); } |
7458 | 149 |
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
|
150 sortmode is_sorted (sortmode mode = UNSORTED) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 { return range.is_sorted (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
152 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8721
diff
changeset
|
153 Array<octave_idx_type> sort_rows_idx (sortmode) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
154 { return Array<octave_idx_type> (dim_vector (1, 0)); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
155 |
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
|
156 sortmode is_sorted_rows (sortmode mode = UNSORTED) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
157 { return mode ? mode : ASCENDING; } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
158 |
9685 | 159 builtin_type_t builtin_type (void) const { return btyp_double; } |
160 | |
2376 | 161 bool is_real_type (void) const { return true; } |
162 | |
5895 | 163 bool is_double_type (void) const { return true; } |
164 | |
7576 | 165 bool is_float_type (void) const { return true; } |
166 | |
3678 | 167 bool is_numeric_type (void) const { return true; } |
168 | |
2376 | 169 bool is_true (void) const; |
170 | |
3145 | 171 double double_value (bool = false) const; |
2376 | 172 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
173 float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
174 |
3145 | 175 double scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
176 { return double_value (frc_str_conv); } |
2916 | 177 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
178 float float_scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
179 { return float_value (frc_str_conv); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
180 |
3145 | 181 Matrix matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 { return range.matrix_value (); } |
2376 | 183 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
184 FloatMatrix float_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 { return range.matrix_value (); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
186 |
4668 | 187 NDArray array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 { return range.matrix_value (); } |
4668 | 189 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
190 FloatNDArray float_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
191 { return FloatMatrix (range.matrix_value ()); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
192 |
9146
a48c500e48e1
support range->string conversions
Jaroslav Hajek <highegg@gmail.com>
parents:
8971
diff
changeset
|
193 charNDArray char_array_value (bool = false) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
194 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
195 // FIXME: it would be better to have Range::intXNDArray_value |
6934 | 196 // functions to avoid the intermediate conversion to a matrix |
197 // object. | |
198 | |
6932 | 199 int8NDArray |
200 int8_array_value (void) const { return int8NDArray (array_value ()); } | |
201 | |
202 int16NDArray | |
203 int16_array_value (void) const { return int16NDArray (array_value ()); } | |
204 | |
205 int32NDArray | |
206 int32_array_value (void) const { return int32NDArray (array_value ()); } | |
207 | |
208 int64NDArray | |
209 int64_array_value (void) const { return int64NDArray (array_value ()); } | |
210 | |
211 uint8NDArray | |
212 uint8_array_value (void) const { return uint8NDArray (array_value ()); } | |
213 | |
214 uint16NDArray | |
215 uint16_array_value (void) const { return uint16NDArray (array_value ()); } | |
216 | |
217 uint32NDArray | |
218 uint32_array_value (void) const { return uint32NDArray (array_value ()); } | |
219 | |
220 uint64NDArray | |
221 uint64_array_value (void) const { return uint64NDArray (array_value ()); } | |
222 | |
6928 | 223 SparseMatrix sparse_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
224 { return SparseMatrix (range.matrix_value ()); } |
6928 | 225 |
226 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
227 { return SparseComplexMatrix (sparse_matrix_value ()); } |
6928 | 228 |
3145 | 229 Complex complex_value (bool = false) const; |
2376 | 230 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
231 FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
232 |
10613
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
10605
diff
changeset
|
233 boolNDArray bool_array_value (bool warn = false) const; |
5898 | 234 |
3145 | 235 ComplexMatrix complex_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
236 { return ComplexMatrix (range.matrix_value ()); } |
2376 | 237 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
238 FloatComplexMatrix float_complex_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
239 { return FloatComplexMatrix (range.matrix_value ()); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
240 |
4668 | 241 ComplexNDArray complex_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
242 { return ComplexMatrix (range.matrix_value ()); } |
4668 | 243 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
244 FloatComplexNDArray float_complex_array_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
245 { return FloatComplexMatrix (range.matrix_value ()); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
246 |
2376 | 247 Range range_value (void) const { return range; } |
248 | |
5279 | 249 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
2449 | 250 |
18484
bcd71a2531d3
Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18129
diff
changeset
|
251 void print (std::ostream& os, bool pr_as_read_syntax = false); |
2901 | 252 |
3523 | 253 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901 | 254 |
3523 | 255 bool print_name_tag (std::ostream& os, const std::string& name) const; |
2376 | 256 |
17870 | 257 void short_disp (std::ostream& os) const; |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
258 |
6974 | 259 bool save_ascii (std::ostream& os); |
4687 | 260 |
261 bool load_ascii (std::istream& is); | |
262 | |
263 bool save_binary (std::ostream& os, bool& save_as_floats); | |
264 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
265 bool load_binary (std::istream& is, bool swap, |
10313 | 266 oct_mach_info::float_format fmt); |
4687 | 267 |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
268 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); |
4687 | 269 |
20070
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19898
diff
changeset
|
270 bool load_hdf5 (octave_hdf5_id loc_id, const char *name); |
4687 | 271 |
5051 | 272 int write (octave_stream& os, int block_size, |
10313 | 273 oct_data_conv::data_type output_type, int skip, |
274 oct_mach_info::float_format flt_fmt) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
275 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
276 // FIXME: could be more memory efficient by having a |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
277 // special case of the octave_stream::write method for ranges. |
5051 | 278 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
279 return os.write (matrix_value (), block_size, output_type, skip, flt_fmt); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
280 } |
5051 | 281 |
5900 | 282 mxArray *as_mxArray (void) const; |
283 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
284 octave_value map (unary_mapper_t umap) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
285 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
286 octave_matrix m (matrix_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
287 return m.map (umap); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
288 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7463
diff
changeset
|
289 |
18805
491b0adfec95
compatibility fixes for printf integer format specifiers
John W. Eaton <jwe@octave.org>
parents:
18484
diff
changeset
|
290 octave_value fast_elem_extract (octave_idx_type n) const; |
491b0adfec95
compatibility fixes for printf integer format specifiers
John W. Eaton <jwe@octave.org>
parents:
18484
diff
changeset
|
291 |
2376 | 292 private: |
293 | |
294 Range range; | |
295 | |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
296 idx_vector set_idx_cache (const idx_vector& idx) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
297 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
298 delete idx_cache; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
299 idx_cache = idx ? new idx_vector (idx) : 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
300 return idx; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
301 } |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
302 |
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
303 void clear_cached_info (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
304 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
305 delete idx_cache; idx_cache = 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
306 } |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
307 |
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
308 mutable idx_vector *idx_cache; |
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
9146
diff
changeset
|
309 |
12153
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
310 // No assignment. |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
311 |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
312 octave_range& operator = (const octave_range&); |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
313 |
2477 | 314 |
4612 | 315 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376 | 316 }; |
317 | |
318 #endif |