Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-bool-sparse.h @ 19954:c913247c85a8
make colon function work (bug #44290)
* colon.m: Delete.
* scripts/miscellaneous/module.mk: Update.
* data.cc (Fcolon): New function.
* ov.h, ov.cc (do_colon_op): New functions.
* pt-colon.h, pt-colon.cc (tree_colon_expression::make_range): Delete.
(tree_colon_expression::rvalue1): Use do_colon_op instead of make_range.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 18 Feb 2015 17:02:13 -0500 |
parents | 4197fc428c7d |
children | 09ed6f7538dd |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19795
diff
changeset
|
3 Copyright (C) 2004-2015 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
7016 | 5 |
6 This file is part of Octave. | |
5164 | 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. | |
5164 | 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/>. | |
5164 | 21 |
22 */ | |
23 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #if !defined (octave_ov_bool_sparse_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
25 #define octave_ov_bool_sparse_h 1 |
5164 | 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> |
5164 | 30 #include <string> |
31 | |
32 #include "mx-base.h" | |
33 #include "str-vec.h" | |
34 | |
35 #include "error.h" | |
36 #include "oct-stream.h" | |
37 #include "ov-base.h" | |
38 #include "ov-typeinfo.h" | |
39 | |
40 #include "boolSparse.h" | |
41 #include "ov-base-sparse.h" | |
42 #include "ov-re-sparse.h" | |
43 | |
44 class octave_value_list; | |
45 | |
46 class tree_walker; | |
47 | |
48 class | |
6109 | 49 OCTINTERP_API |
5164 | 50 octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix> |
51 { | |
52 public: | |
53 | |
54 octave_sparse_bool_matrix (void) | |
55 : octave_base_sparse<SparseBoolMatrix> () { } | |
56 | |
57 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda) | |
58 : octave_base_sparse<SparseBoolMatrix> (bnda) { } | |
59 | |
60 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda, | |
10313 | 61 const MatrixType& t) |
5164 | 62 : octave_base_sparse<SparseBoolMatrix> (bnda, t) { } |
63 | |
64 octave_sparse_bool_matrix (const boolNDArray& m) | |
65 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { } | |
66 | |
67 octave_sparse_bool_matrix (const boolMatrix& m) | |
68 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { } | |
69 | |
70 octave_sparse_bool_matrix (const Sparse<bool>& a) | |
71 : octave_base_sparse<SparseBoolMatrix> (a) { } | |
72 | |
73 octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm) | |
74 : octave_base_sparse<SparseBoolMatrix> (bm) { } | |
75 | |
76 ~octave_sparse_bool_matrix (void) { } | |
77 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 octave_base_value *clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 { return new octave_sparse_bool_matrix (*this); } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 octave_base_value *empty_clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
81 { return new octave_sparse_bool_matrix (); } |
5164 | 82 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
83 type_conv_info numeric_conversion_function (void) const; |
5164 | 84 |
5759 | 85 octave_base_value *try_narrowing_conversion (void); |
5164 | 86 |
16779
8fce0ed4894a
Specialize is_empty and numel methods for sparse matrices (debian bug #706376)
David Bateman <dbateman@free.fr>
parents:
15195
diff
changeset
|
87 // FIXME Adapt idx_vector to allow sparse logical indexing without overflow!! |
18129
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
88 idx_vector index_vector (bool /* require_integers */ = false) const |
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
89 { |
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
90 return idx_vector (matrix); |
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
91 } |
5164 | 92 |
9685 | 93 builtin_type_t builtin_type (void) const { return btyp_bool; } |
94 | |
5164 | 95 bool is_bool_matrix (void) const { return true; } |
96 | |
97 bool is_bool_type (void) const { return true; } | |
98 | |
99 bool is_real_type (void) const { return true; } | |
100 | |
11433
9f4321024fbf
make insumeric return false on sparse logicals
Jaroslav Hajek <highegg@gmail.com>
parents:
10759
diff
changeset
|
101 bool is_numeric_type (void) const { return false; } |
9f4321024fbf
make insumeric return false on sparse logicals
Jaroslav Hajek <highegg@gmail.com>
parents:
10759
diff
changeset
|
102 |
5164 | 103 double double_value (bool = false) const; |
104 | |
105 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
|
106 { return double_value (frc_str_conv); } |
5164 | 107 |
108 Matrix matrix_value (bool = false) const; | |
109 | |
110 NDArray array_value (bool = false) const; | |
111 | |
112 Complex complex_value (bool = false) const; | |
113 | |
114 ComplexMatrix complex_matrix_value (bool = false) const; | |
115 | |
116 ComplexNDArray complex_array_value (bool = false) const; | |
117 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
118 charNDArray char_array_value (bool = false) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
119 |
5944 | 120 boolMatrix bool_matrix_value (bool = false) const; |
5164 | 121 |
5944 | 122 boolNDArray bool_array_value (bool = false) const; |
5164 | 123 |
5188 | 124 SparseMatrix sparse_matrix_value (bool = false) const; |
5164 | 125 |
5188 | 126 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164 | 127 |
5189 | 128 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 { return matrix; } |
5164 | 130 |
5279 | 131 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5164 | 132 |
133 bool save_binary (std::ostream& os, bool& save_as_floats); | |
134 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
135 bool load_binary (std::istream& is, bool swap, |
10313 | 136 oct_mach_info::float_format fmt); |
5164 | 137 |
138 #if defined (HAVE_HDF5) | |
139 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
140 | |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9812
diff
changeset
|
141 bool load_hdf5 (hid_t loc_id, const char *name); |
5164 | 142 #endif |
143 | |
5900 | 144 mxArray *as_mxArray (void) const; |
145 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
146 // Mapper functions are converted to double for treatment |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
147 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
|
148 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
149 octave_sparse_matrix m (sparse_matrix_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
150 return m.map (umap); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
152 |
5164 | 153 protected: |
154 | |
155 | |
156 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
157 }; | |
158 | |
159 #endif |