5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
7016
|
4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
|
5 |
|
6 This file is part of Octave. |
5164
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
5164
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
5164
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_sparse_complex_matrix_h) |
|
25 #define octave_sparse_complex_matrix_h 1 |
|
26 |
|
27 #include <cstdlib> |
|
28 |
|
29 #include <iostream> |
|
30 #include <string> |
|
31 |
|
32 #include "mx-base.h" |
|
33 #include "oct-alloc.h" |
|
34 #include "so-array.h" |
|
35 #include "str-vec.h" |
|
36 |
|
37 #include "error.h" |
|
38 #include "oct-stream.h" |
|
39 #include "ov-base.h" |
|
40 #include "ov-typeinfo.h" |
|
41 |
|
42 #include "CSparse.h" |
|
43 #include "ov-base-sparse.h" |
|
44 #include "ov-re-sparse.h" |
|
45 #include "ov-bool-sparse.h" |
|
46 |
|
47 class Octave_map; |
|
48 class octave_value_list; |
|
49 |
|
50 class tree_walker; |
|
51 |
|
52 class |
6109
|
53 OCTINTERP_API |
5164
|
54 octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix> |
|
55 { |
|
56 public: |
|
57 |
|
58 octave_sparse_complex_matrix (void) |
|
59 : octave_base_sparse<SparseComplexMatrix> () { } |
|
60 |
|
61 octave_sparse_complex_matrix (const ComplexNDArray& m) |
|
62 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
63 |
|
64 octave_sparse_complex_matrix (const ComplexMatrix& m) |
|
65 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
66 |
|
67 octave_sparse_complex_matrix (const SparseComplexMatrix& m) |
|
68 : octave_base_sparse<SparseComplexMatrix> (m) { } |
|
69 |
|
70 octave_sparse_complex_matrix (const SparseComplexMatrix& m, |
5785
|
71 const MatrixType &t) |
5164
|
72 : octave_base_sparse<SparseComplexMatrix> (m, t) { } |
|
73 |
|
74 octave_sparse_complex_matrix (const MSparse<Complex>& m) |
|
75 : octave_base_sparse<SparseComplexMatrix> (m) { } |
|
76 |
6863
|
77 octave_sparse_complex_matrix (const MSparse<Complex>& m, |
|
78 const MatrixType &t) |
|
79 : octave_base_sparse<SparseComplexMatrix> (m, t) { } |
|
80 |
|
81 octave_sparse_complex_matrix (const Sparse<Complex>& m, |
|
82 const MatrixType &t) |
|
83 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m), t) { } |
|
84 |
|
85 octave_sparse_complex_matrix (const Sparse<Complex>& m) |
|
86 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
87 |
5164
|
88 octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm) |
|
89 : octave_base_sparse<SparseComplexMatrix> (cm) { } |
|
90 |
|
91 ~octave_sparse_complex_matrix (void) { } |
|
92 |
5759
|
93 octave_base_value *clone (void) const { return new octave_sparse_complex_matrix (*this); } |
|
94 octave_base_value *empty_clone (void) const { return new octave_sparse_complex_matrix (); } |
5164
|
95 |
5759
|
96 octave_base_value *try_narrowing_conversion (void); |
5164
|
97 |
|
98 void assign (const octave_value_list& idx, const SparseComplexMatrix& rhs); |
|
99 |
|
100 void assign (const octave_value_list& idx, const SparseMatrix& rhs); |
|
101 |
|
102 bool is_complex_matrix (void) const { return true; } |
|
103 |
|
104 bool is_complex_type (void) const { return true; } |
|
105 |
5895
|
106 bool is_double_type (void) const { return true; } |
|
107 |
5164
|
108 bool valid_as_scalar_index (void) const; |
|
109 |
|
110 double double_value (bool = false) const; |
|
111 |
|
112 double scalar_value (bool frc_str_conv = false) const |
|
113 { return double_value (frc_str_conv); } |
|
114 |
|
115 Matrix matrix_value (bool = false) const; |
|
116 |
|
117 Complex complex_value (bool = false) const; |
|
118 |
|
119 ComplexMatrix complex_matrix_value (bool = false) const; |
|
120 |
|
121 ComplexNDArray complex_array_value (bool = false) const; |
|
122 |
|
123 SparseMatrix sparse_matrix_value (bool = false) const; |
|
124 |
|
125 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const |
|
126 { return matrix; } |
|
127 |
|
128 #if 0 |
|
129 int write (octave_stream& os, int block_size, |
|
130 oct_data_conv::data_type output_type, int skip, |
|
131 oct_mach_info::float_format flt_fmt) const |
|
132 { |
|
133 // Yes, for compatibility, we drop the imaginary part here. |
|
134 return os.write (matrix_value (true), block_size, output_type, |
|
135 skip, flt_fmt); |
|
136 } |
|
137 #endif |
|
138 |
|
139 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
140 |
|
141 bool load_binary (std::istream& is, bool swap, |
|
142 oct_mach_info::float_format fmt); |
|
143 |
|
144 #if defined (HAVE_HDF5) |
|
145 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
146 |
|
147 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
148 #endif |
|
149 |
5900
|
150 mxArray *as_mxArray (void) const; |
|
151 |
5164
|
152 private: |
|
153 |
|
154 DECLARE_OCTAVE_ALLOCATOR |
|
155 |
|
156 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
157 }; |
|
158 |
|
159 #endif |
|
160 |
|
161 /* |
|
162 ;;; Local Variables: *** |
|
163 ;;; mode: C++ *** |
|
164 ;;; End: *** |
|
165 */ |