Mercurial > hg > octave-nkf
annotate src/ov-bool-sparse.h @ 14026:3781981be535 ss-3-5-90
snapshot 3.5.90
* configure.ac (AC_INIT): Version is now 3.5.90.
(OCTAVE_API_VERSION_NUMBER): Now 46.
(OCTAVE_RELEASE_DATE): Now 2011-12-11.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 11 Dec 2011 23:18:31 -0500 |
parents | 12df7854fa7c |
children | 72c96de7a403 |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
11523 | 3 Copyright (C) 2004-2011 David Bateman |
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 | |
24 #if !defined (octave_sparse_bool_matrix_h) | |
25 #define octave_sparse_bool_matrix_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> |
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 | |
5759 | 79 octave_base_value *clone (void) const { return new octave_sparse_bool_matrix (*this); } |
80 octave_base_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); } | |
5164 | 81 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
82 type_conv_info numeric_conversion_function (void) const; |
5164 | 83 |
5759 | 84 octave_base_value *try_narrowing_conversion (void); |
5164 | 85 |
5775 | 86 // FIXME Adapt idx_vector to allow sparse logical indexing!! |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
87 idx_vector index_vector (void) const |
5282 | 88 { return idx_vector (bool_array_value ()); } |
5164 | 89 |
9685 | 90 builtin_type_t builtin_type (void) const { return btyp_bool; } |
91 | |
5164 | 92 bool is_bool_matrix (void) const { return true; } |
93 | |
94 bool is_bool_type (void) const { return true; } | |
95 | |
96 bool is_real_type (void) const { return true; } | |
97 | |
11433
9f4321024fbf
make insumeric return false on sparse logicals
Jaroslav Hajek <highegg@gmail.com>
parents:
10759
diff
changeset
|
98 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
|
99 |
5164 | 100 double double_value (bool = false) const; |
101 | |
102 double scalar_value (bool frc_str_conv = false) const | |
103 { return double_value (frc_str_conv); } | |
104 | |
105 Matrix matrix_value (bool = false) const; | |
106 | |
107 NDArray array_value (bool = false) const; | |
108 | |
109 Complex complex_value (bool = false) const; | |
110 | |
111 ComplexMatrix complex_matrix_value (bool = false) const; | |
112 | |
113 ComplexNDArray complex_array_value (bool = false) const; | |
114 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
115 charNDArray char_array_value (bool = false) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
116 |
5944 | 117 boolMatrix bool_matrix_value (bool = false) const; |
5164 | 118 |
5944 | 119 boolNDArray bool_array_value (bool = false) const; |
5164 | 120 |
5188 | 121 SparseMatrix sparse_matrix_value (bool = false) const; |
5164 | 122 |
5188 | 123 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164 | 124 |
5189 | 125 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const |
5164 | 126 { return matrix; } |
127 | |
5279 | 128 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5164 | 129 |
130 bool save_binary (std::ostream& os, bool& save_as_floats); | |
131 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
132 bool load_binary (std::istream& is, bool swap, |
10313 | 133 oct_mach_info::float_format fmt); |
5164 | 134 |
135 #if defined (HAVE_HDF5) | |
136 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
137 | |
9881
b3089dba88bf
Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents:
9812
diff
changeset
|
138 bool load_hdf5 (hid_t loc_id, const char *name); |
5164 | 139 #endif |
140 | |
5900 | 141 mxArray *as_mxArray (void) const; |
142 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
143 // Mapper functions are converted to double for treatment |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
144 octave_value map (unary_mapper_t umap) const |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
145 { |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
146 octave_sparse_matrix m (sparse_matrix_value ()); |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
147 return m.map (umap); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
148 } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
149 |
5164 | 150 protected: |
151 | |
152 DECLARE_OCTAVE_ALLOCATOR | |
153 | |
154 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
155 }; | |
156 | |
157 #endif |