2871
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2871
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_bool_matrix_h) |
|
25 #define octave_bool_matrix_h 1 |
|
26 |
|
27 #include <cstdlib> |
|
28 |
3503
|
29 #include <iostream> |
2871
|
30 #include <string> |
|
31 |
|
32 #include "mx-base.h" |
|
33 #include "oct-alloc.h" |
|
34 |
|
35 #include "error.h" |
4970
|
36 #include "oct-stream.h" |
2871
|
37 #include "ov-base.h" |
3219
|
38 #include "ov-base-mat.h" |
2871
|
39 #include "ov-typeinfo.h" |
|
40 |
|
41 class Octave_map; |
|
42 class octave_value_list; |
|
43 |
|
44 class tree_walker; |
|
45 |
|
46 // Character matrix values. |
|
47 |
|
48 class |
4513
|
49 octave_bool_matrix : public octave_base_matrix<boolNDArray> |
2871
|
50 { |
|
51 public: |
|
52 |
|
53 octave_bool_matrix (void) |
4513
|
54 : octave_base_matrix<boolNDArray> () { } |
|
55 |
|
56 octave_bool_matrix (const boolNDArray& bnda) |
|
57 : octave_base_matrix<boolNDArray> (bnda) { } |
2871
|
58 |
|
59 octave_bool_matrix (const boolMatrix& bm) |
4513
|
60 : octave_base_matrix<boolNDArray> (bm) { } |
2871
|
61 |
3225
|
62 octave_bool_matrix (const Array2<bool>& a) |
4513
|
63 : octave_base_matrix<boolNDArray> (a) { } |
3225
|
64 |
2871
|
65 octave_bool_matrix (const octave_bool_matrix& bm) |
4513
|
66 : octave_base_matrix<boolNDArray> (bm) { } |
2871
|
67 |
|
68 ~octave_bool_matrix (void) { } |
|
69 |
3933
|
70 octave_value *clone (void) const { return new octave_bool_matrix (*this); } |
|
71 octave_value *empty_clone (void) const { return new octave_bool_matrix (); } |
2871
|
72 |
|
73 type_conv_fcn numeric_conversion_function (void) const; |
|
74 |
|
75 octave_value *try_narrowing_conversion (void); |
|
76 |
4650
|
77 idx_vector index_vector (void) const { return idx_vector (matrix); } |
2871
|
78 |
|
79 bool is_bool_matrix (void) const { return true; } |
|
80 |
3209
|
81 bool is_bool_type (void) const { return true; } |
|
82 |
2871
|
83 bool is_real_type (void) const { return true; } |
|
84 |
|
85 bool valid_as_scalar_index (void) const; |
|
86 |
|
87 double double_value (bool = false) const; |
|
88 |
3145
|
89 double scalar_value (bool frc_str_conv = false) const |
|
90 { return double_value (frc_str_conv); } |
2916
|
91 |
4513
|
92 Matrix matrix_value (bool = false) const |
|
93 { return Matrix (matrix.matrix_value ()); } |
2871
|
94 |
4569
|
95 NDArray array_value (bool = false) const |
4650
|
96 { return NDArray (matrix); } |
4569
|
97 |
2871
|
98 Complex complex_value (bool = false) const; |
|
99 |
3145
|
100 ComplexMatrix complex_matrix_value (bool = false) const |
4513
|
101 { return ComplexMatrix (matrix.matrix_value ( )); } |
2871
|
102 |
4569
|
103 ComplexNDArray complex_array_value (bool = false) const |
4901
|
104 { return ComplexNDArray (matrix); } |
4569
|
105 |
3545
|
106 boolMatrix bool_matrix_value (void) const |
4513
|
107 { return matrix.matrix_value (); } |
2871
|
108 |
4580
|
109 boolNDArray bool_array_value (void) const |
4543
|
110 { return matrix; } |
|
111 |
5164
|
112 SparseMatrix sparse_matrix_value (bool = false) const |
|
113 { return SparseMatrix (Matrix (matrix.matrix_value ())); } |
|
114 |
|
115 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const |
|
116 { return SparseComplexMatrix (ComplexMatrix (matrix.matrix_value ())); } |
|
117 |
|
118 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const |
|
119 { return SparseBoolMatrix (matrix.matrix_value ()); } |
|
120 |
5279
|
121 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
2871
|
122 |
4643
|
123 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
124 |
4687
|
125 bool save_ascii (std::ostream& os, bool& infnan_warned, |
|
126 bool strip_nan_and_inf); |
|
127 |
|
128 bool load_ascii (std::istream& is); |
|
129 |
|
130 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
131 |
|
132 bool load_binary (std::istream& is, bool swap, |
|
133 oct_mach_info::float_format fmt); |
|
134 |
|
135 #if defined (HAVE_HDF5) |
|
136 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
137 |
|
138 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
139 #endif |
|
140 |
4970
|
141 int write (octave_stream& os, int block_size, |
|
142 oct_data_conv::data_type output_type, int skip, |
|
143 oct_mach_info::float_format flt_fmt) const |
|
144 { return os.write (matrix, block_size, output_type, skip, flt_fmt); } |
|
145 |
2871
|
146 protected: |
|
147 |
3219
|
148 DECLARE_OCTAVE_ALLOCATOR |
2871
|
149 |
3219
|
150 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2871
|
151 }; |
|
152 |
|
153 #endif |
|
154 |
|
155 /* |
|
156 ;;; Local Variables: *** |
|
157 ;;; mode: C++ *** |
|
158 ;;; End: *** |
|
159 */ |