2928
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 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 2, or (at your option) any |
|
10 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, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2928
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "mx-m-cm.h" |
|
32 #include "mx-cm-m.h" |
|
33 |
|
34 #include "gripes.h" |
4055
|
35 #include "oct-obj.h" |
2928
|
36 #include "ov.h" |
|
37 #include "ov-re-mat.h" |
|
38 #include "ov-cx-mat.h" |
|
39 #include "ov-typeinfo.h" |
|
40 #include "ops.h" |
|
41 #include "xdiv.h" |
|
42 #include "xpow.h" |
|
43 |
|
44 // matrix by complex matrix ops. |
|
45 |
4543
|
46 DEFNDBINOP_OP (add, matrix, complex_matrix, array, array, +) |
|
47 DEFNDBINOP_OP (sub, matrix, complex_matrix, array, array, -) |
|
48 |
2928
|
49 DEFBINOP_OP (mul, matrix, complex_matrix, *) |
3766
|
50 DEFBINOP_FN (div, matrix, complex_matrix, xdiv) |
2928
|
51 |
|
52 DEFBINOPX (pow, matrix, complex_matrix) |
|
53 { |
|
54 error ("can't do A ^ B for A and B both matrices"); |
|
55 return octave_value (); |
|
56 } |
|
57 |
|
58 DEFBINOP_FN (ldiv, matrix, complex_matrix, xleftdiv) |
|
59 |
4543
|
60 DEFNDBINOP_FN (lt, matrix, complex_matrix, array, array, mx_el_lt) |
|
61 DEFNDBINOP_FN (le, matrix, complex_matrix, array, array, mx_el_le) |
|
62 DEFNDBINOP_FN (eq, matrix, complex_matrix, array, array, mx_el_eq) |
|
63 DEFNDBINOP_FN (ge, matrix, complex_matrix, array, array, mx_el_ge) |
|
64 DEFNDBINOP_FN (gt, matrix, complex_matrix, array, array, mx_el_gt) |
|
65 DEFNDBINOP_FN (ne, matrix, complex_matrix, array, array, mx_el_ne) |
2928
|
66 |
4543
|
67 DEFNDBINOP_FN (el_mul, matrix, complex_matrix, array, array, product) |
|
68 DEFNDBINOP_FN (el_div, matrix, complex_matrix, array, array, quotient) |
|
69 DEFNDBINOP_FN (el_pow, matrix, complex_matrix, array, array, elem_xpow) |
2928
|
70 |
|
71 DEFBINOP (el_ldiv, matrix, complex_matrix) |
|
72 { |
|
73 CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); |
|
74 |
4543
|
75 return quotient (v2.array_value (), v1.array_value ()); |
2928
|
76 } |
|
77 |
4543
|
78 DEFNDBINOP_FN (el_and, matrix, complex_matrix, array, array, mx_el_and) |
|
79 DEFNDBINOP_FN (el_or, matrix, complex_matrix, array, array, mx_el_or) |
2928
|
80 |
|
81 DEFCONV (complex_matrix_conv, matrix, complex_matrix) |
|
82 { |
|
83 CAST_CONV_ARG (const octave_matrix&); |
|
84 |
4543
|
85 return new octave_complex_matrix (ComplexNDArray (v.array_value ())); |
2928
|
86 } |
|
87 |
|
88 void |
|
89 install_m_cm_ops (void) |
|
90 { |
3538
|
91 INSTALL_BINOP (op_add, octave_matrix, octave_complex_matrix, add); |
|
92 INSTALL_BINOP (op_sub, octave_matrix, octave_complex_matrix, sub); |
|
93 INSTALL_BINOP (op_mul, octave_matrix, octave_complex_matrix, mul); |
|
94 INSTALL_BINOP (op_div, octave_matrix, octave_complex_matrix, div); |
|
95 INSTALL_BINOP (op_pow, octave_matrix, octave_complex_matrix, pow); |
|
96 INSTALL_BINOP (op_ldiv, octave_matrix, octave_complex_matrix, ldiv); |
|
97 INSTALL_BINOP (op_lt, octave_matrix, octave_complex_matrix, lt); |
|
98 INSTALL_BINOP (op_le, octave_matrix, octave_complex_matrix, le); |
|
99 INSTALL_BINOP (op_eq, octave_matrix, octave_complex_matrix, eq); |
|
100 INSTALL_BINOP (op_ge, octave_matrix, octave_complex_matrix, ge); |
|
101 INSTALL_BINOP (op_gt, octave_matrix, octave_complex_matrix, gt); |
|
102 INSTALL_BINOP (op_ne, octave_matrix, octave_complex_matrix, ne); |
|
103 INSTALL_BINOP (op_el_mul, octave_matrix, octave_complex_matrix, el_mul); |
|
104 INSTALL_BINOP (op_el_div, octave_matrix, octave_complex_matrix, el_div); |
|
105 INSTALL_BINOP (op_el_pow, octave_matrix, octave_complex_matrix, el_pow); |
|
106 INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_complex_matrix, el_ldiv); |
|
107 INSTALL_BINOP (op_el_and, octave_matrix, octave_complex_matrix, el_and); |
|
108 INSTALL_BINOP (op_el_or, octave_matrix, octave_complex_matrix, el_or); |
2928
|
109 |
|
110 INSTALL_ASSIGNCONV (octave_matrix, octave_complex_matrix, octave_complex_matrix); |
|
111 |
3540
|
112 INSTALL_WIDENOP (octave_matrix, octave_complex_matrix, complex_matrix_conv); |
2928
|
113 } |
|
114 |
|
115 /* |
|
116 ;;; Local Variables: *** |
|
117 ;;; mode: C++ *** |
|
118 ;;; End: *** |
|
119 */ |