comparison libinterp/operators/op-cm-cm.cc @ 21647:66cae7a6dc47

eliminate some macros for operator definitions * ops.h (CAST_UNOP_ARG, CAST_BINOP_ARGS, CAST_CONV_ARG, ASSIGNOPDECL, NULLASSIGNOPDECL, ASSIGNANYOPDECL, DEFASSIGNOP, DEFASSIGNOP_FN, UNOPDECL, BINOPDECL, CATOPDECL): Delete macros. * make_int.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-complex.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-flt-cx-diag.cc, ov-flt-re-diag.cc, ov-lazy-idx.cc, ov-null-mat.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-scalar.cc, ov-str-mat.cc, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-int-conv.cc, op-int.h, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, ops.h: Expand eliminated macros in place.
author John W. Eaton <jwe@octave.org>
date Wed, 27 Apr 2016 16:13:40 -0400
parents 40de9f8f23a6
children aba2e6293dd8
comparison
equal deleted inserted replaced
21646:3cddf1e65ccf 21647:66cae7a6dc47
41 DEFNDUNOP_OP (uplus, complex_matrix, complex_array, /* no-op */) 41 DEFNDUNOP_OP (uplus, complex_matrix, complex_array, /* no-op */)
42 DEFNDUNOP_OP (uminus, complex_matrix, complex_array, -) 42 DEFNDUNOP_OP (uminus, complex_matrix, complex_array, -)
43 43
44 DEFUNOP (transpose, complex_matrix) 44 DEFUNOP (transpose, complex_matrix)
45 { 45 {
46 CAST_UNOP_ARG (const octave_complex_matrix&); 46 const octave_complex_matrix& v = dynamic_cast<const octave_complex_matrix&> (a);
47 47
48 if (v.ndims () > 2) 48 if (v.ndims () > 2)
49 error ("transpose not defined for N-D objects"); 49 error ("transpose not defined for N-D objects");
50 50
51 return octave_value (v.complex_matrix_value ().transpose ()); 51 return octave_value (v.complex_matrix_value ().transpose ());
52 } 52 }
53 53
54 DEFUNOP (hermitian, complex_matrix) 54 DEFUNOP (hermitian, complex_matrix)
55 { 55 {
56 CAST_UNOP_ARG (const octave_complex_matrix&); 56 const octave_complex_matrix& v = dynamic_cast<const octave_complex_matrix&> (a);
57 57
58 if (v.ndims () > 2) 58 if (v.ndims () > 2)
59 error ("complex-conjugate transpose not defined for N-D objects"); 59 error ("complex-conjugate transpose not defined for N-D objects");
60 60
61 return octave_value (v.complex_matrix_value ().hermitian ()); 61 return octave_value (v.complex_matrix_value ().hermitian ());
74 74
75 DEFBINOP_OP (mul, complex_matrix, complex_matrix, *) 75 DEFBINOP_OP (mul, complex_matrix, complex_matrix, *)
76 76
77 DEFBINOP (div, complex_matrix, complex_matrix) 77 DEFBINOP (div, complex_matrix, complex_matrix)
78 { 78 {
79 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 79 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
80 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
80 MatrixType typ = v2.matrix_type (); 81 MatrixType typ = v2.matrix_type ();
81 82
82 ComplexMatrix ret = xdiv (v1.complex_matrix_value (), 83 ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
83 v2.complex_matrix_value (), typ); 84 v2.complex_matrix_value (), typ);
84 85
91 error ("can't do A ^ B for A and B both matrices"); 92 error ("can't do A ^ B for A and B both matrices");
92 } 93 }
93 94
94 DEFBINOP (ldiv, complex_matrix, complex_matrix) 95 DEFBINOP (ldiv, complex_matrix, complex_matrix)
95 { 96 {
96 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 97 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
98 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
97 MatrixType typ = v1.matrix_type (); 99 MatrixType typ = v1.matrix_type ();
98 100
99 ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), 101 ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
100 v2.complex_matrix_value (), typ); 102 v2.complex_matrix_value (), typ);
101 103
103 return ret; 105 return ret;
104 } 106 }
105 107
106 DEFBINOP (trans_mul, complex_matrix, complex_matrix) 108 DEFBINOP (trans_mul, complex_matrix, complex_matrix)
107 { 109 {
108 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 110 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
111 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
109 return octave_value(xgemm (v1.complex_matrix_value (), 112 return octave_value(xgemm (v1.complex_matrix_value (),
110 v2.complex_matrix_value (), 113 v2.complex_matrix_value (),
111 blas_trans, blas_no_trans)); 114 blas_trans, blas_no_trans));
112 } 115 }
113 116
114 DEFBINOP (mul_trans, complex_matrix, complex_matrix) 117 DEFBINOP (mul_trans, complex_matrix, complex_matrix)
115 { 118 {
116 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 119 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
120 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
117 return octave_value(xgemm (v1.complex_matrix_value (), 121 return octave_value(xgemm (v1.complex_matrix_value (),
118 v2.complex_matrix_value (), 122 v2.complex_matrix_value (),
119 blas_no_trans, blas_trans)); 123 blas_no_trans, blas_trans));
120 } 124 }
121 125
122 DEFBINOP (herm_mul, complex_matrix, complex_matrix) 126 DEFBINOP (herm_mul, complex_matrix, complex_matrix)
123 { 127 {
124 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 128 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
129 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
125 return octave_value(xgemm (v1.complex_matrix_value (), 130 return octave_value(xgemm (v1.complex_matrix_value (),
126 v2.complex_matrix_value (), 131 v2.complex_matrix_value (),
127 blas_conj_trans, blas_no_trans)); 132 blas_conj_trans, blas_no_trans));
128 } 133 }
129 134
130 DEFBINOP (mul_herm, complex_matrix, complex_matrix) 135 DEFBINOP (mul_herm, complex_matrix, complex_matrix)
131 { 136 {
132 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 137 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
138 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
133 return octave_value(xgemm (v1.complex_matrix_value (), 139 return octave_value(xgemm (v1.complex_matrix_value (),
134 v2.complex_matrix_value (), 140 v2.complex_matrix_value (),
135 blas_no_trans, blas_conj_trans)); 141 blas_no_trans, blas_conj_trans));
136 } 142 }
137 143
138 DEFBINOP (trans_ldiv, complex_matrix, complex_matrix) 144 DEFBINOP (trans_ldiv, complex_matrix, complex_matrix)
139 { 145 {
140 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 146 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
147 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
141 MatrixType typ = v1.matrix_type (); 148 MatrixType typ = v1.matrix_type ();
142 149
143 ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), 150 ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
144 v2.complex_matrix_value (), typ, blas_trans); 151 v2.complex_matrix_value (), typ, blas_trans);
145 152
147 return ret; 154 return ret;
148 } 155 }
149 156
150 DEFBINOP (herm_ldiv, complex_matrix, complex_matrix) 157 DEFBINOP (herm_ldiv, complex_matrix, complex_matrix)
151 { 158 {
152 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 159 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
160 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
153 MatrixType typ = v1.matrix_type (); 161 MatrixType typ = v1.matrix_type ();
154 162
155 ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), 163 ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
156 v2.complex_matrix_value (), typ, 164 v2.complex_matrix_value (), typ,
157 blas_conj_trans); 165 blas_conj_trans);
180 DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, complex_array, 188 DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, complex_array,
181 complex_array, elem_xpow) 189 complex_array, elem_xpow)
182 190
183 DEFBINOP (el_ldiv, complex_matrix, complex_matrix) 191 DEFBINOP (el_ldiv, complex_matrix, complex_matrix)
184 { 192 {
185 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); 193 const octave_complex_matrix& v1 = dynamic_cast<const octave_complex_matrix&> (a1);
194 const octave_complex_matrix& v2 = dynamic_cast<const octave_complex_matrix&> (a2);
186 195
187 return octave_value (quotient (v2.complex_array_value (), 196 return octave_value (quotient (v2.complex_array_value (),
188 v1.complex_array_value ())); 197 v1.complex_array_value ()));
189 } 198 }
190 199
207 DEFNDASSIGNOP_FNOP (assign_el_div, complex_matrix, complex_matrix, 216 DEFNDASSIGNOP_FNOP (assign_el_div, complex_matrix, complex_matrix,
208 complex_array, quotient_eq) 217 complex_array, quotient_eq)
209 218
210 CONVDECL (complex_matrix_to_float_complex_matrix) 219 CONVDECL (complex_matrix_to_float_complex_matrix)
211 { 220 {
212 CAST_CONV_ARG (const octave_complex_matrix&); 221 const octave_complex_matrix& v = dynamic_cast<const octave_complex_matrix&> (a);
213 222
214 return 223 return
215 new octave_float_complex_matrix 224 new octave_float_complex_matrix
216 (FloatComplexNDArray (v.complex_array_value ())); 225 (FloatComplexNDArray (v.complex_array_value ()));
217 } 226 }