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_complex_matrix_h) |
|
24 #define octave_sparse_complex_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 "CSparse.h" |
|
42 #include "ov-base-sparse.h" |
|
43 #include "ov-re-sparse.h" |
|
44 #include "ov-bool-sparse.h" |
|
45 |
|
46 class Octave_map; |
|
47 class octave_value_list; |
|
48 |
|
49 class tree_walker; |
|
50 |
|
51 class |
|
52 octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix> |
|
53 { |
|
54 public: |
|
55 |
|
56 octave_sparse_complex_matrix (void) |
|
57 : octave_base_sparse<SparseComplexMatrix> () { } |
|
58 |
|
59 octave_sparse_complex_matrix (const ComplexNDArray& m) |
|
60 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
61 |
|
62 octave_sparse_complex_matrix (const ComplexMatrix& m) |
|
63 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
64 |
|
65 octave_sparse_complex_matrix (const SparseComplexMatrix& m) |
|
66 : octave_base_sparse<SparseComplexMatrix> (m) { } |
|
67 |
|
68 octave_sparse_complex_matrix (const SparseComplexMatrix& m, |
5785
|
69 const MatrixType &t) |
5164
|
70 : octave_base_sparse<SparseComplexMatrix> (m, t) { } |
|
71 |
|
72 octave_sparse_complex_matrix (const MSparse<Complex>& m) |
|
73 : octave_base_sparse<SparseComplexMatrix> (m) { } |
|
74 |
|
75 octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm) |
|
76 : octave_base_sparse<SparseComplexMatrix> (cm) { } |
|
77 |
|
78 ~octave_sparse_complex_matrix (void) { } |
|
79 |
5759
|
80 octave_base_value *clone (void) const { return new octave_sparse_complex_matrix (*this); } |
|
81 octave_base_value *empty_clone (void) const { return new octave_sparse_complex_matrix (); } |
5164
|
82 |
5759
|
83 octave_base_value *try_narrowing_conversion (void); |
5164
|
84 |
|
85 void assign (const octave_value_list& idx, const SparseComplexMatrix& rhs); |
|
86 |
|
87 void assign (const octave_value_list& idx, const SparseMatrix& rhs); |
|
88 |
|
89 bool is_complex_matrix (void) const { return true; } |
|
90 |
|
91 bool is_complex_type (void) const { return true; } |
|
92 |
|
93 bool valid_as_scalar_index (void) const; |
|
94 |
|
95 double double_value (bool = false) const; |
|
96 |
|
97 double scalar_value (bool frc_str_conv = false) const |
|
98 { return double_value (frc_str_conv); } |
|
99 |
|
100 Matrix matrix_value (bool = false) const; |
|
101 |
|
102 Complex complex_value (bool = false) const; |
|
103 |
|
104 ComplexMatrix complex_matrix_value (bool = false) const; |
|
105 |
|
106 ComplexNDArray complex_array_value (bool = false) const; |
|
107 |
|
108 SparseMatrix sparse_matrix_value (bool = false) const; |
|
109 |
|
110 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const |
|
111 { return matrix; } |
|
112 |
|
113 #if 0 |
|
114 int write (octave_stream& os, int block_size, |
|
115 oct_data_conv::data_type output_type, int skip, |
|
116 oct_mach_info::float_format flt_fmt) const |
|
117 { |
|
118 // Yes, for compatibility, we drop the imaginary part here. |
|
119 return os.write (matrix_value (true), block_size, output_type, |
|
120 skip, flt_fmt); |
|
121 } |
|
122 #endif |
|
123 |
|
124 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
125 |
|
126 bool load_binary (std::istream& is, bool swap, |
|
127 oct_mach_info::float_format fmt); |
|
128 |
|
129 #if defined (HAVE_HDF5) |
|
130 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
131 |
|
132 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
133 #endif |
|
134 |
|
135 private: |
|
136 |
|
137 DECLARE_OCTAVE_ALLOCATOR |
|
138 |
|
139 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
140 }; |
|
141 |
|
142 #endif |
|
143 |
|
144 /* |
|
145 ;;; Local Variables: *** |
|
146 ;;; mode: C++ *** |
|
147 ;;; End: *** |
|
148 */ |