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 |
|
17 along with this program; see the file COPYING. If not, write to the Free |
|
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
19 |
|
20 */ |
|
21 |
|
22 #if !defined (octave_sparse_complex_matrix_h) |
|
23 #define octave_sparse_complex_matrix_h 1 |
|
24 |
|
25 #include <cstdlib> |
|
26 |
|
27 #include <iostream> |
|
28 #include <string> |
|
29 |
|
30 #include "mx-base.h" |
|
31 #include "oct-alloc.h" |
|
32 #include "so-array.h" |
|
33 #include "str-vec.h" |
|
34 |
|
35 #include "error.h" |
|
36 #include "oct-stream.h" |
|
37 #include "ov-base.h" |
|
38 #include "ov-typeinfo.h" |
|
39 |
|
40 #include "CSparse.h" |
|
41 #include "ov-base-sparse.h" |
|
42 #include "ov-re-sparse.h" |
|
43 #include "ov-bool-sparse.h" |
|
44 |
|
45 class Octave_map; |
|
46 class octave_value_list; |
|
47 |
|
48 class tree_walker; |
|
49 |
|
50 class |
|
51 octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix> |
|
52 { |
|
53 public: |
|
54 |
|
55 octave_sparse_complex_matrix (void) |
|
56 : octave_base_sparse<SparseComplexMatrix> () { } |
|
57 |
|
58 octave_sparse_complex_matrix (const ComplexNDArray& m) |
|
59 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
60 |
|
61 octave_sparse_complex_matrix (const ComplexMatrix& m) |
|
62 : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } |
|
63 |
|
64 octave_sparse_complex_matrix (const SparseComplexMatrix& m) |
|
65 : octave_base_sparse<SparseComplexMatrix> (m) { } |
|
66 |
|
67 octave_sparse_complex_matrix (const SparseComplexMatrix& m, |
|
68 const SparseType &t) |
|
69 : octave_base_sparse<SparseComplexMatrix> (m, t) { } |
|
70 |
|
71 octave_sparse_complex_matrix (const MSparse<Complex>& m) |
|
72 : octave_base_sparse<SparseComplexMatrix> (m) { } |
|
73 |
|
74 octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm) |
|
75 : octave_base_sparse<SparseComplexMatrix> (cm) { } |
|
76 |
|
77 ~octave_sparse_complex_matrix (void) { } |
|
78 |
|
79 octave_value *clone (void) const { return new octave_sparse_complex_matrix (*this); } |
|
80 octave_value *empty_clone (void) const { return new octave_sparse_complex_matrix (); } |
|
81 |
|
82 octave_value *try_narrowing_conversion (void); |
|
83 |
|
84 void assign (const octave_value_list& idx, const SparseComplexMatrix& rhs); |
|
85 |
|
86 void assign (const octave_value_list& idx, const SparseMatrix& rhs); |
|
87 |
|
88 bool is_complex_matrix (void) const { return true; } |
|
89 |
|
90 bool is_complex_type (void) const { return true; } |
|
91 |
|
92 bool valid_as_scalar_index (void) const; |
|
93 |
|
94 double double_value (bool = false) const; |
|
95 |
|
96 double scalar_value (bool frc_str_conv = false) const |
|
97 { return double_value (frc_str_conv); } |
|
98 |
|
99 Matrix matrix_value (bool = false) const; |
|
100 |
|
101 Complex complex_value (bool = false) const; |
|
102 |
|
103 ComplexMatrix complex_matrix_value (bool = false) const; |
|
104 |
|
105 ComplexNDArray complex_array_value (bool = false) const; |
|
106 |
|
107 SparseMatrix sparse_matrix_value (bool = false) const; |
|
108 |
|
109 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const |
|
110 { return matrix; } |
|
111 |
|
112 #if 0 |
|
113 int write (octave_stream& os, int block_size, |
|
114 oct_data_conv::data_type output_type, int skip, |
|
115 oct_mach_info::float_format flt_fmt) const |
|
116 { |
|
117 // Yes, for compatibility, we drop the imaginary part here. |
|
118 return os.write (matrix_value (true), block_size, output_type, |
|
119 skip, flt_fmt); |
|
120 } |
|
121 #endif |
|
122 |
|
123 bool save_binary (std::ostream& os, bool& save_as_floats); |
|
124 |
|
125 bool load_binary (std::istream& is, bool swap, |
|
126 oct_mach_info::float_format fmt); |
|
127 |
|
128 #if defined (HAVE_HDF5) |
|
129 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); |
|
130 |
|
131 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); |
|
132 #endif |
|
133 |
|
134 private: |
|
135 |
|
136 DECLARE_OCTAVE_ALLOCATOR |
|
137 |
|
138 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
139 }; |
|
140 |
|
141 #endif |
|
142 |
|
143 /* |
|
144 ;;; Local Variables: *** |
|
145 ;;; mode: C++ *** |
|
146 ;;; End: *** |
|
147 */ |