2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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_matrix_h) |
|
24 #define octave_matrix_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2376
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
3503
|
32 #include <iostream> |
2376
|
33 #include <string> |
|
34 |
|
35 #include "mx-base.h" |
2477
|
36 #include "oct-alloc.h" |
4649
|
37 #include "so-array.h" |
2376
|
38 #include "str-vec.h" |
|
39 |
|
40 #include "error.h" |
|
41 #include "ov-base.h" |
3219
|
42 #include "ov-base-mat.h" |
2376
|
43 #include "ov-typeinfo.h" |
|
44 |
|
45 class Octave_map; |
|
46 class octave_value_list; |
|
47 |
|
48 class tree_walker; |
|
49 |
|
50 // Real matrix values. |
|
51 |
|
52 class |
4513
|
53 octave_matrix : public octave_base_matrix<NDArray> |
2376
|
54 { |
|
55 public: |
|
56 |
|
57 octave_matrix (void) |
4513
|
58 : octave_base_matrix<NDArray> () { } |
2376
|
59 |
|
60 octave_matrix (const Matrix& m) |
4513
|
61 : octave_base_matrix<NDArray> (m) { } |
|
62 |
|
63 octave_matrix (const NDArray& nda) |
|
64 : octave_base_matrix<NDArray> (nda) { } |
2376
|
65 |
4911
|
66 octave_matrix (const ArrayN<double>& m) |
|
67 : octave_base_matrix<NDArray> (NDArray (m)) { } |
|
68 |
2376
|
69 octave_matrix (const DiagMatrix& d) |
4513
|
70 : octave_base_matrix<NDArray> (Matrix (d)) { } |
2376
|
71 |
3418
|
72 octave_matrix (const RowVector& v) |
4513
|
73 : octave_base_matrix<NDArray> (Matrix (v)) { } |
2376
|
74 |
3418
|
75 octave_matrix (const ColumnVector& v) |
4513
|
76 : octave_base_matrix<NDArray> (Matrix (v)) { } |
2376
|
77 |
|
78 octave_matrix (const octave_matrix& m) |
4513
|
79 : octave_base_matrix<NDArray> (m) { } |
2376
|
80 |
|
81 ~octave_matrix (void) { } |
|
82 |
3933
|
83 octave_value *clone (void) const { return new octave_matrix (*this); } |
|
84 octave_value *empty_clone (void) const { return new octave_matrix (); } |
2376
|
85 |
2410
|
86 octave_value *try_narrowing_conversion (void); |
|
87 |
4650
|
88 idx_vector index_vector (void) const { return idx_vector (matrix); } |
2376
|
89 |
|
90 bool is_real_matrix (void) const { return true; } |
|
91 |
|
92 bool is_real_type (void) const { return true; } |
|
93 |
|
94 bool valid_as_scalar_index (void) const; |
|
95 |
|
96 double double_value (bool = false) const; |
|
97 |
3145
|
98 double scalar_value (bool frc_str_conv = false) const |
|
99 { return double_value (frc_str_conv); } |
2916
|
100 |
4513
|
101 Matrix matrix_value (bool = false) const; |
2376
|
102 |
|
103 Complex complex_value (bool = false) const; |
|
104 |
4513
|
105 ComplexMatrix complex_matrix_value (bool = false) const; |
2376
|
106 |
4699
|
107 ComplexNDArray complex_array_value (bool = false) const; |
4758
|
108 |
|
109 charNDArray char_array_value (bool = false) const; |
|
110 |
4550
|
111 NDArray array_value (bool = false) const { return matrix; } |
4505
|
112 |
4645
|
113 streamoff_array streamoff_array_value (void) const; |
|
114 |
2376
|
115 void increment (void) { matrix += 1.0; } |
|
116 |
|
117 void decrement (void) { matrix -= 1.0; } |
|
118 |
4457
|
119 octave_value convert_to_str_internal (bool pad, bool force) const; |
2376
|
120 |
4643
|
121 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
122 |
4687
|
123 bool save_ascii (std::ostream& os, bool& infnan_warned, |
|
124 bool strip_nan_and_inf); |
|
125 |
|
126 bool load_ascii (std::istream& is); |
|
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 |
2376
|
139 private: |
|
140 |
3219
|
141 DECLARE_OCTAVE_ALLOCATOR |
2477
|
142 |
3219
|
143 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376
|
144 }; |
|
145 |
|
146 #endif |
|
147 |
|
148 /* |
|
149 ;;; Local Variables: *** |
|
150 ;;; mode: C++ *** |
|
151 ;;; End: *** |
|
152 */ |