5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_sparse_bool_matrix_h) |
|
24 #define octave_sparse_bool_matrix_h 1 |
|
25 |
|
26 #include <cstdlib> |
|
27 |
|
28 #include <iostream> |
|
29 #include <string> |
|
30 |
|
31 #include "mx-base.h" |
|
32 #include "oct-alloc.h" |
|
33 #include "so-array.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_map; |
|
46 class octave_value_list; |
|
47 |
|
48 class tree_walker; |
|
49 |
|
50 class |
|
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, |
5785
|
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 |
|
82 type_conv_fcn numeric_conversion_function (void) const; |
|
83 |
5759
|
84 octave_base_value *try_narrowing_conversion (void); |
5164
|
85 |
5775
|
86 // FIXME Adapt idx_vector to allow sparse logical indexing!! |
5282
|
87 idx_vector index_vector (void) const |
|
88 { return idx_vector (bool_array_value ()); } |
5164
|
89 |
|
90 bool is_bool_matrix (void) const { return true; } |
|
91 |
|
92 bool is_bool_type (void) const { return true; } |
|
93 |
|
94 bool is_real_type (void) const { return true; } |
|
95 |
|
96 bool valid_as_scalar_index (void) const; |
|
97 |
|
98 double double_value (bool = false) const; |
|
99 |
|
100 double scalar_value (bool frc_str_conv = false) const |
|
101 { return double_value (frc_str_conv); } |
|
102 |
|
103 Matrix matrix_value (bool = false) const; |
|
104 |
|
105 NDArray array_value (bool = false) const; |
|
106 |
|
107 Complex complex_value (bool = false) const; |
|
108 |
|
109 ComplexMatrix complex_matrix_value (bool = false) const; |
|
110 |
|
111 ComplexNDArray complex_array_value (bool = false) const; |
|
112 |
|
113 boolMatrix bool_matrix_value (void) const; |
|
114 |
|
115 boolNDArray bool_array_value (void) const; |
|
116 |
5188
|
117 SparseMatrix sparse_matrix_value (bool = false) const; |
5164
|
118 |
5188
|
119 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; |
5164
|
120 |
5189
|
121 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const |
5164
|
122 { return matrix; } |
|
123 |
5279
|
124 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5164
|
125 |
|
126 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
127 |
|
128 bool load_binary (std::istream& is, bool swap, |
|
129 oct_mach_info::float_format fmt); |
|
130 |
|
131 #if defined (HAVE_HDF5) |
|
132 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
133 |
|
134 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
135 #endif |
|
136 |
5900
|
137 mxArray *as_mxArray (void) const; |
|
138 |
5164
|
139 protected: |
|
140 |
|
141 DECLARE_OCTAVE_ALLOCATOR |
|
142 |
|
143 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
144 }; |
|
145 |
|
146 #endif |
|
147 |
|
148 /* |
|
149 ;;; Local Variables: *** |
|
150 ;;; mode: C++ *** |
|
151 ;;; End: *** |
|
152 */ |