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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_bool_matrix_h) |
|
24 #define octave_bool_matrix_h 1 |
|
25 |
|
26 #include <cstdlib> |
|
27 |
3503
|
28 #include <iostream> |
2871
|
29 #include <string> |
|
30 |
|
31 #include "mx-base.h" |
|
32 #include "oct-alloc.h" |
|
33 |
|
34 #include "error.h" |
4970
|
35 #include "oct-stream.h" |
2871
|
36 #include "ov-base.h" |
3219
|
37 #include "ov-base-mat.h" |
2871
|
38 #include "ov-typeinfo.h" |
|
39 |
|
40 class Octave_map; |
|
41 class octave_value_list; |
|
42 |
|
43 class tree_walker; |
|
44 |
|
45 // Character matrix values. |
|
46 |
|
47 class |
4513
|
48 octave_bool_matrix : public octave_base_matrix<boolNDArray> |
2871
|
49 { |
|
50 public: |
|
51 |
|
52 octave_bool_matrix (void) |
4513
|
53 : octave_base_matrix<boolNDArray> () { } |
|
54 |
|
55 octave_bool_matrix (const boolNDArray& bnda) |
|
56 : octave_base_matrix<boolNDArray> (bnda) { } |
2871
|
57 |
|
58 octave_bool_matrix (const boolMatrix& bm) |
4513
|
59 : octave_base_matrix<boolNDArray> (bm) { } |
2871
|
60 |
3225
|
61 octave_bool_matrix (const Array2<bool>& a) |
4513
|
62 : octave_base_matrix<boolNDArray> (a) { } |
3225
|
63 |
2871
|
64 octave_bool_matrix (const octave_bool_matrix& bm) |
4513
|
65 : octave_base_matrix<boolNDArray> (bm) { } |
2871
|
66 |
|
67 ~octave_bool_matrix (void) { } |
|
68 |
3933
|
69 octave_value *clone (void) const { return new octave_bool_matrix (*this); } |
|
70 octave_value *empty_clone (void) const { return new octave_bool_matrix (); } |
2871
|
71 |
|
72 type_conv_fcn numeric_conversion_function (void) const; |
|
73 |
|
74 octave_value *try_narrowing_conversion (void); |
|
75 |
4650
|
76 idx_vector index_vector (void) const { return idx_vector (matrix); } |
2871
|
77 |
|
78 bool is_bool_matrix (void) const { return true; } |
|
79 |
3209
|
80 bool is_bool_type (void) const { return true; } |
|
81 |
2871
|
82 bool is_real_type (void) const { return true; } |
|
83 |
|
84 bool valid_as_scalar_index (void) const; |
|
85 |
|
86 double double_value (bool = false) const; |
|
87 |
3145
|
88 double scalar_value (bool frc_str_conv = false) const |
|
89 { return double_value (frc_str_conv); } |
2916
|
90 |
4513
|
91 Matrix matrix_value (bool = false) const |
|
92 { return Matrix (matrix.matrix_value ()); } |
2871
|
93 |
4569
|
94 NDArray array_value (bool = false) const |
4650
|
95 { return NDArray (matrix); } |
4569
|
96 |
2871
|
97 Complex complex_value (bool = false) const; |
|
98 |
3145
|
99 ComplexMatrix complex_matrix_value (bool = false) const |
4513
|
100 { return ComplexMatrix (matrix.matrix_value ( )); } |
2871
|
101 |
4569
|
102 ComplexNDArray complex_array_value (bool = false) const |
4901
|
103 { return ComplexNDArray (matrix); } |
4569
|
104 |
3545
|
105 boolMatrix bool_matrix_value (void) const |
4513
|
106 { return matrix.matrix_value (); } |
2871
|
107 |
4580
|
108 boolNDArray bool_array_value (void) const |
4543
|
109 { return matrix; } |
|
110 |
4457
|
111 octave_value convert_to_str_internal (bool pad, bool force) const; |
2871
|
112 |
4643
|
113 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
114 |
4687
|
115 bool save_ascii (std::ostream& os, bool& infnan_warned, |
|
116 bool strip_nan_and_inf); |
|
117 |
|
118 bool load_ascii (std::istream& is); |
|
119 |
|
120 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
121 |
|
122 bool load_binary (std::istream& is, bool swap, |
|
123 oct_mach_info::float_format fmt); |
|
124 |
|
125 #if defined (HAVE_HDF5) |
|
126 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
127 |
|
128 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
129 #endif |
|
130 |
4970
|
131 int write (octave_stream& os, int block_size, |
|
132 oct_data_conv::data_type output_type, int skip, |
|
133 oct_mach_info::float_format flt_fmt) const |
|
134 { return os.write (matrix, block_size, output_type, skip, flt_fmt); } |
|
135 |
2871
|
136 protected: |
|
137 |
3219
|
138 DECLARE_OCTAVE_ALLOCATOR |
2871
|
139 |
3219
|
140 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2871
|
141 }; |
|
142 |
|
143 #endif |
|
144 |
|
145 /* |
|
146 ;;; Local Variables: *** |
|
147 ;;; mode: C++ *** |
|
148 ;;; End: *** |
|
149 */ |