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 |
|
17 along with this program; see the file COPYING. If not, write to the Free |
|
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
19 |
|
20 */ |
|
21 |
|
22 #if !defined (octave_sparse_bool_matrix_h) |
|
23 #define octave_sparse_bool_matrix_h 1 |
|
24 |
|
25 #include <cstdlib> |
|
26 |
|
27 #include <iostream> |
|
28 #include <string> |
|
29 |
|
30 #include "mx-base.h" |
|
31 #include "oct-alloc.h" |
|
32 #include "so-array.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_map; |
|
45 class octave_value_list; |
|
46 |
|
47 class tree_walker; |
|
48 |
|
49 class |
|
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, |
|
61 const SparseType& t) |
|
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 |
|
78 octave_value *clone (void) const { return new octave_sparse_bool_matrix (*this); } |
|
79 octave_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); } |
|
80 |
|
81 type_conv_fcn numeric_conversion_function (void) const; |
|
82 |
|
83 octave_value *try_narrowing_conversion (void); |
|
84 |
|
85 #if 0 |
|
86 idx_vector index_vector (void) const { return idx_vector (matrix); } |
|
87 #endif |
|
88 |
|
89 bool is_bool_matrix (void) const { return true; } |
|
90 |
|
91 bool is_bool_type (void) const { return true; } |
|
92 |
|
93 bool is_real_type (void) const { return true; } |
|
94 |
|
95 bool valid_as_scalar_index (void) const; |
|
96 |
|
97 double double_value (bool = false) const; |
|
98 |
|
99 double scalar_value (bool frc_str_conv = false) const |
|
100 { return double_value (frc_str_conv); } |
|
101 |
|
102 Matrix matrix_value (bool = false) const; |
|
103 |
|
104 NDArray array_value (bool = false) const; |
|
105 |
|
106 Complex complex_value (bool = false) const; |
|
107 |
|
108 ComplexMatrix complex_matrix_value (bool = false) const; |
|
109 |
|
110 ComplexNDArray complex_array_value (bool = false) const; |
|
111 |
|
112 boolMatrix bool_matrix_value (void) const; |
|
113 |
|
114 boolNDArray bool_array_value (void) const; |
|
115 |
|
116 SparseMatrix sparse_matrix_value (void) const; |
|
117 |
|
118 SparseComplexMatrix sparse_complex_matrix_value (void) const; |
|
119 |
|
120 SparseBoolMatrix sparse_bool_matrix_value (void) const |
|
121 { return matrix; } |
|
122 |
|
123 octave_value convert_to_str_internal (bool pad, bool force) const; |
|
124 |
|
125 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
126 |
|
127 bool load_binary (std::istream& is, bool swap, |
|
128 oct_mach_info::float_format fmt); |
|
129 |
|
130 #if defined (HAVE_HDF5) |
|
131 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
132 |
|
133 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
134 #endif |
|
135 |
|
136 protected: |
|
137 |
|
138 DECLARE_OCTAVE_ALLOCATOR |
|
139 |
|
140 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
141 }; |
|
142 |
|
143 #endif |
|
144 |
|
145 /* |
|
146 ;;; Local Variables: *** |
|
147 ;;; mode: C++ *** |
|
148 ;;; End: *** |
|
149 */ |