5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
7016
|
4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
|
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 |
|
29 #include <iostream> |
|
30 #include <string> |
|
31 |
|
32 #include "mx-base.h" |
|
33 #include "oct-alloc.h" |
|
34 #include "so-array.h" |
|
35 #include "str-vec.h" |
|
36 |
|
37 #include "error.h" |
|
38 #include "oct-stream.h" |
|
39 #include "ov-base.h" |
|
40 #include "ov-typeinfo.h" |
|
41 |
|
42 #include "boolSparse.h" |
|
43 #include "ov-base-sparse.h" |
|
44 #include "ov-re-sparse.h" |
|
45 |
|
46 class Octave_map; |
|
47 class octave_value_list; |
|
48 |
|
49 class tree_walker; |
|
50 |
|
51 class |
6109
|
52 OCTINTERP_API |
5164
|
53 octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix> |
|
54 { |
|
55 public: |
|
56 |
|
57 octave_sparse_bool_matrix (void) |
|
58 : octave_base_sparse<SparseBoolMatrix> () { } |
|
59 |
|
60 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda) |
|
61 : octave_base_sparse<SparseBoolMatrix> (bnda) { } |
|
62 |
|
63 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda, |
5785
|
64 const MatrixType& t) |
5164
|
65 : octave_base_sparse<SparseBoolMatrix> (bnda, t) { } |
|
66 |
|
67 octave_sparse_bool_matrix (const boolNDArray& m) |
|
68 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { } |
|
69 |
|
70 octave_sparse_bool_matrix (const boolMatrix& m) |
|
71 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { } |
|
72 |
|
73 octave_sparse_bool_matrix (const Sparse<bool>& a) |
|
74 : octave_base_sparse<SparseBoolMatrix> (a) { } |
|
75 |
|
76 octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm) |
|
77 : octave_base_sparse<SparseBoolMatrix> (bm) { } |
|
78 |
|
79 ~octave_sparse_bool_matrix (void) { } |
|
80 |
5759
|
81 octave_base_value *clone (void) const { return new octave_sparse_bool_matrix (*this); } |
|
82 octave_base_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); } |
5164
|
83 |
|
84 type_conv_fcn numeric_conversion_function (void) const; |
|
85 |
5759
|
86 octave_base_value *try_narrowing_conversion (void); |
5164
|
87 |
5775
|
88 // FIXME Adapt idx_vector to allow sparse logical indexing!! |
5282
|
89 idx_vector index_vector (void) const |
|
90 { return idx_vector (bool_array_value ()); } |
5164
|
91 |
|
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 |
|
98 bool valid_as_scalar_index (void) const; |
|
99 |
|
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 |
5944
|
115 boolMatrix bool_matrix_value (bool = false) const; |
5164
|
116 |
5944
|
117 boolNDArray bool_array_value (bool = false) const; |
5164
|
118 |
5188
|
119 SparseMatrix sparse_matrix_value (bool = false) const; |
5164
|
120 |
5188
|
121 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164
|
122 |
5189
|
123 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const |
5164
|
124 { return matrix; } |
|
125 |
5279
|
126 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5164
|
127 |
|
128 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
129 |
|
130 bool load_binary (std::istream& is, bool swap, |
|
131 oct_mach_info::float_format fmt); |
|
132 |
|
133 #if defined (HAVE_HDF5) |
|
134 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
135 |
|
136 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
137 #endif |
|
138 |
5900
|
139 mxArray *as_mxArray (void) const; |
|
140 |
5164
|
141 protected: |
|
142 |
|
143 DECLARE_OCTAVE_ALLOCATOR |
|
144 |
|
145 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
146 }; |
|
147 |
|
148 #endif |
|
149 |
|
150 /* |
|
151 ;;; Local Variables: *** |
|
152 ;;; mode: C++ *** |
|
153 ;;; End: *** |
|
154 */ |