Mercurial > hg > octave-nkf
comparison src/ov-flt-cx-mat.h @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | |
children | a41df65f3f00 |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, | |
4 2007 John W. Eaton | |
5 | |
6 This file is part of Octave. | |
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 | |
10 Free Software Foundation; either version 3 of the License, or (at your | |
11 option) any later version. | |
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 | |
19 along with Octave; see the file COPYING. If not, see | |
20 <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
24 #if !defined (octave_float_complex_matrix_h) | |
25 #define octave_float_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 "str-vec.h" | |
35 | |
36 #include "error.h" | |
37 #include "oct-stream.h" | |
38 #include "ov-base.h" | |
39 #include "ov-base-mat.h" | |
40 #include "ov-typeinfo.h" | |
41 | |
42 #include "MatrixType.h" | |
43 | |
44 class Octave_map; | |
45 class octave_value_list; | |
46 | |
47 class tree_walker; | |
48 | |
49 // Complex matrix values. | |
50 | |
51 class | |
52 OCTINTERP_API | |
53 octave_float_complex_matrix : public octave_base_matrix<FloatComplexNDArray> | |
54 { | |
55 public: | |
56 | |
57 octave_float_complex_matrix (void) | |
58 : octave_base_matrix<FloatComplexNDArray> () { } | |
59 | |
60 octave_float_complex_matrix (const FloatComplexNDArray& m) | |
61 : octave_base_matrix<FloatComplexNDArray> (m) { } | |
62 | |
63 octave_float_complex_matrix (const FloatComplexMatrix& m) | |
64 : octave_base_matrix<FloatComplexNDArray> (m) { } | |
65 | |
66 octave_float_complex_matrix (const FloatComplexMatrix& m, const MatrixType& t) | |
67 : octave_base_matrix<FloatComplexNDArray> (m, t) { } | |
68 | |
69 octave_float_complex_matrix (const ArrayN<FloatComplex>& m) | |
70 : octave_base_matrix<FloatComplexNDArray> (FloatComplexNDArray (m)) { } | |
71 | |
72 octave_float_complex_matrix (const FloatComplexDiagMatrix& d) | |
73 : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (d)) { } | |
74 | |
75 octave_float_complex_matrix (const FloatComplexRowVector& v) | |
76 : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { } | |
77 | |
78 octave_float_complex_matrix (const FloatComplexColumnVector& v) | |
79 : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { } | |
80 | |
81 octave_float_complex_matrix (const octave_float_complex_matrix& cm) | |
82 : octave_base_matrix<FloatComplexNDArray> (cm) { } | |
83 | |
84 ~octave_float_complex_matrix (void) { } | |
85 | |
86 octave_base_value *clone (void) const { return new octave_float_complex_matrix (*this); } | |
87 octave_base_value *empty_clone (void) const { return new octave_float_complex_matrix (); } | |
88 | |
89 octave_base_value *try_narrowing_conversion (void); | |
90 | |
91 void assign (const octave_value_list& idx, const FloatComplexNDArray& rhs); | |
92 | |
93 void assign (const octave_value_list& idx, const FloatNDArray& rhs); | |
94 | |
95 bool is_complex_matrix (void) const { return true; } | |
96 | |
97 bool is_complex_type (void) const { return true; } | |
98 | |
99 bool is_double_type (void) const { return true; } | |
100 | |
101 bool is_float_type (void) const { return true; } | |
102 | |
103 bool valid_as_scalar_index (void) const; | |
104 | |
105 double double_value (bool = false) const; | |
106 | |
107 float float_value (bool = false) const; | |
108 | |
109 double scalar_value (bool frc_str_conv = false) const | |
110 { return double_value (frc_str_conv); } | |
111 | |
112 float float_scalar_value (bool frc_str_conv = false) const | |
113 { return float_value (frc_str_conv); } | |
114 | |
115 Matrix matrix_value (bool = false) const; | |
116 | |
117 FloatMatrix float_matrix_value (bool = false) const; | |
118 | |
119 Complex complex_value (bool = false) const; | |
120 | |
121 FloatComplex float_complex_value (bool = false) const; | |
122 | |
123 ComplexMatrix complex_matrix_value (bool = false) const; | |
124 | |
125 FloatComplexMatrix float_complex_matrix_value (bool = false) const; | |
126 | |
127 ComplexNDArray complex_array_value (bool = false) const { return matrix; } | |
128 | |
129 FloatComplexNDArray float_complex_array_value (bool = false) const; | |
130 | |
131 charNDArray char_array_value (bool frc_str_conv = false) const; | |
132 | |
133 SparseMatrix sparse_matrix_value (bool = false) const; | |
134 | |
135 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |
136 | |
137 void increment (void) { matrix += FloatComplex (1.0); } | |
138 | |
139 void decrement (void) { matrix -= FloatComplex (1.0); } | |
140 | |
141 bool save_ascii (std::ostream& os); | |
142 | |
143 bool load_ascii (std::istream& is); | |
144 | |
145 bool save_binary (std::ostream& os, bool& save_as_floats); | |
146 | |
147 bool load_binary (std::istream& is, bool swap, | |
148 oct_mach_info::float_format fmt); | |
149 | |
150 #if defined (HAVE_HDF5) | |
151 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
152 | |
153 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); | |
154 #endif | |
155 | |
156 int write (octave_stream& os, int block_size, | |
157 oct_data_conv::data_type output_type, int skip, | |
158 oct_mach_info::float_format flt_fmt) const | |
159 { | |
160 // Yes, for compatibility, we drop the imaginary part here. | |
161 return os.write (matrix_value (true), block_size, output_type, | |
162 skip, flt_fmt); | |
163 } | |
164 | |
165 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |
166 | |
167 mxArray *as_mxArray (void) const; | |
168 | |
169 octave_value erf (void) const; | |
170 octave_value erfc (void) const; | |
171 octave_value gamma (void) const; | |
172 octave_value lgamma (void) const; | |
173 octave_value abs (void) const; | |
174 octave_value acos (void) const; | |
175 octave_value acosh (void) const; | |
176 octave_value angle (void) const; | |
177 octave_value arg (void) const; | |
178 octave_value asin (void) const; | |
179 octave_value asinh (void) const; | |
180 octave_value atan (void) const; | |
181 octave_value atanh (void) const; | |
182 octave_value ceil (void) const; | |
183 octave_value conj (void) const; | |
184 octave_value cos (void) const; | |
185 octave_value cosh (void) const; | |
186 octave_value exp (void) const; | |
187 octave_value expm1 (void) const; | |
188 octave_value fix (void) const; | |
189 octave_value floor (void) const; | |
190 octave_value imag (void) const; | |
191 octave_value log (void) const; | |
192 octave_value log2 (void) const; | |
193 octave_value log10 (void) const; | |
194 octave_value log1p (void) const; | |
195 octave_value real (void) const; | |
196 octave_value round (void) const; | |
197 octave_value roundb (void) const; | |
198 octave_value signum (void) const; | |
199 octave_value sin (void) const; | |
200 octave_value sinh (void) const; | |
201 octave_value sqrt (void) const; | |
202 octave_value tan (void) const; | |
203 octave_value tanh (void) const; | |
204 octave_value finite (void) const; | |
205 octave_value isinf (void) const; | |
206 octave_value isna (void) const; | |
207 octave_value isnan (void) const; | |
208 | |
209 private: | |
210 | |
211 DECLARE_OCTAVE_ALLOCATOR | |
212 | |
213 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
214 }; | |
215 | |
216 #endif | |
217 | |
218 /* | |
219 ;;; Local Variables: *** | |
220 ;;; mode: C++ *** | |
221 ;;; End: *** | |
222 */ |