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