GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
op-fcm-fcm.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2013 John W. Eaton
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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "gripes.h"
28 #include "oct-obj.h"
29 #include "ov.h"
30 #include "ov-cx-mat.h"
31 #include "ov-flt-cx-mat.h"
32 #include "ov-typeinfo.h"
33 #include "ov-null-mat.h"
34 #include "ops.h"
35 #include "xdiv.h"
36 #include "xpow.h"
37 
38 // unary complex matrix ops.
39 
40 DEFNDUNOP_OP (not, float_complex_matrix, float_complex_array, !)
41 DEFNDUNOP_OP (uplus, float_complex_matrix, float_complex_array, /* no-op */)
42 DEFNDUNOP_OP (uminus, float_complex_matrix, float_complex_array, -)
43 
44 DEFUNOP (transpose, float_complex_matrix)
45 {
47 
48  if (v.ndims () > 2)
49  {
50  error ("transpose not defined for N-d objects");
51  return octave_value ();
52  }
53  else
54  return octave_value (v.float_complex_matrix_value ().transpose ());
55 }
56 
57 DEFUNOP (hermitian, float_complex_matrix)
58 {
60 
61  if (v.ndims () > 2)
62  {
63  error ("complex-conjugate transpose not defined for N-d objects");
64  return octave_value ();
65  }
66  else
67  return octave_value (v.float_complex_matrix_value ().hermitian ());
68 }
69 
70 DEFNCUNOP_METHOD (incr, float_complex_matrix, increment)
71 DEFNCUNOP_METHOD (decr, float_complex_matrix, decrement)
72 DEFNCUNOP_METHOD (changesign, float_complex_matrix, changesign)
73 
74 // complex matrix by complex matrix ops.
75 
76 DEFNDBINOP_OP (add, float_complex_matrix, float_complex_matrix,
77  float_complex_array, float_complex_array, +)
78 DEFNDBINOP_OP (sub, float_complex_matrix, float_complex_matrix,
79  float_complex_array, float_complex_array, -)
80 
81 DEFBINOP_OP (mul, float_complex_matrix, float_complex_matrix, *)
82 
83 DEFBINOP (div, float_complex_matrix, float_complex_matrix)
84 {
87  MatrixType typ = v2.matrix_type ();
88 
91 
92  v2.matrix_type (typ);
93  return ret;
94 }
95 
96 DEFBINOPX (pow, float_complex_matrix, float_complex_matrix)
97 {
98  error ("can't do A ^ B for A and B both matrices");
99  return octave_value ();
100 }
101 
102 DEFBINOP (ldiv, float_complex_matrix, float_complex_matrix)
103 {
106  MatrixType typ = v1.matrix_type ();
107 
110 
111  v1.matrix_type (typ);
112  return ret;
113 }
114 
115 DEFBINOP (trans_mul, float_complex_matrix, float_complex_matrix)
116 {
122 }
123 
124 DEFBINOP (mul_trans, float_complex_matrix, float_complex_matrix)
125 {
131 }
132 
133 DEFBINOP (herm_mul, float_complex_matrix, float_complex_matrix)
134 {
140 }
141 
142 DEFBINOP (mul_herm, float_complex_matrix, float_complex_matrix)
143 {
149 }
150 
151 DEFBINOP (trans_ldiv, float_complex_matrix, float_complex_matrix)
152 {
155  MatrixType typ = v1.matrix_type ();
156 
159  typ, blas_trans);
160 
161  v1.matrix_type (typ);
162  return ret;
163 }
164 
165 DEFBINOP (herm_ldiv, float_complex_matrix, float_complex_matrix)
166 {
169  MatrixType typ = v1.matrix_type ();
170 
173  typ, blas_conj_trans);
174 
175  v1.matrix_type (typ);
176  return ret;
177 }
178 
179 DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex_matrix,
180  float_complex_array, float_complex_array, mx_el_lt)
181 DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex_matrix,
182  float_complex_array, float_complex_array, mx_el_le)
183 DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex_matrix,
184  float_complex_array, float_complex_array, mx_el_eq)
185 DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex_matrix,
186  float_complex_array, float_complex_array, mx_el_ge)
187 DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex_matrix,
188  float_complex_array, float_complex_array, mx_el_gt)
189 DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex_matrix,
190  float_complex_array, float_complex_array, mx_el_ne)
191 
192 DEFNDBINOP_FN (el_mul, float_complex_matrix, float_complex_matrix,
193  float_complex_array, float_complex_array, product)
194 DEFNDBINOP_FN (el_div, float_complex_matrix, float_complex_matrix,
195  float_complex_array, float_complex_array, quotient)
196 DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex_matrix,
197  float_complex_array, float_complex_array, elem_xpow)
198 
199 DEFBINOP (el_ldiv, float_complex_matrix, float_complex_matrix)
200 {
203 
206 }
207 
208 DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex_matrix,
209  float_complex_array, float_complex_array, mx_el_and)
210 DEFNDBINOP_FN (el_or, float_complex_matrix, float_complex_matrix,
211  float_complex_array, float_complex_array, mx_el_or)
212 
213 DEFNDCATOP_FN (fcm_fcm, float_complex_matrix, float_complex_matrix,
214  float_complex_array, float_complex_array, concat)
215 
216 DEFNDCATOP_FN (cm_fcm, complex_matrix, float_complex_matrix,
217  float_complex_array, float_complex_array, concat)
218 
219 DEFNDCATOP_FN (fcm_cm, float_complex_matrix, complex_matrix,
220  float_complex_array, float_complex_array, concat)
221 
222 DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex_matrix,
223  float_complex_array, assign)
224 DEFNDASSIGNOP_FN (dbl_clx_assign, float_complex_matrix, complex_matrix,
225  float_complex_array, assign)
226 DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, matrix,
227  float_complex_array, assign)
228 
229 DEFNULLASSIGNOP_FN (null_assign, float_complex_matrix, delete_elements)
230 
231 DEFNDASSIGNOP_OP (assign_add, float_complex_matrix,
232  float_complex_matrix, float_complex_array, +=)
233 DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix,
234  float_complex_matrix, float_complex_array, -=)
235 DEFNDASSIGNOP_FNOP (assign_el_mul, float_complex_matrix, float_complex_matrix,
236  float_complex_array, product_eq)
237 DEFNDASSIGNOP_FNOP (assign_el_div, float_complex_matrix, float_complex_matrix,
238  float_complex_array, quotient_eq)
239 
240 CONVDECL (float_complex_matrix_to_complex_matrix)
241 {
243 
244  return
245  new octave_complex_matrix (ComplexNDArray (v.float_complex_array_value ()));
246 }
247 
248 void
250 {
256 
260 
282  octave_float_complex_matrix, trans_ldiv);
284  octave_float_complex_matrix, herm_ldiv);
285 
305  octave_float_complex_matrix, el_ldiv);
310 
312  octave_float_complex_matrix, fcm_fcm);
316  octave_complex_matrix, fcm_cm);
317 
321  octave_complex_matrix, dbl_clx_assign);
323  octave_matrix, dbl_assign);
324 
326  octave_null_matrix, null_assign);
328  octave_null_str, null_assign);
330  octave_null_sq_str, null_assign);
331 
333  octave_float_complex_matrix, assign_add);
335  octave_float_complex_matrix, assign_sub);
337  octave_float_complex_matrix, assign_el_mul);
339  octave_float_complex_matrix, assign_el_div);
340 
342  float_complex_matrix_to_complex_matrix);
343 }