Mercurial > octave-nkf
comparison src/OPERATORS/op-cm-cs.cc @ 4550:69a9b22a72a2
[project @ 2003-10-27 15:41:55 by jwe]
author | jwe |
---|---|
date | Mon, 27 Oct 2003 15:41:55 +0000 |
parents | 79df15d4470c |
children | c7ae43dfdea4 |
comparison
equal
deleted
inserted
replaced
4549:2d393bead213 | 4550:69a9b22a72a2 |
---|---|
38 #include "xdiv.h" | 38 #include "xdiv.h" |
39 #include "xpow.h" | 39 #include "xpow.h" |
40 | 40 |
41 // complex matrix by complex scalar ops. | 41 // complex matrix by complex scalar ops. |
42 | 42 |
43 DEFNDBINOP_OP (add, complex_matrix, complex, array, complex, +) | 43 DEFNDBINOP_OP (add, complex_matrix, complex, complex_array, complex, +) |
44 DEFNDBINOP_OP (sub, complex_matrix, complex, array, complex, -) | 44 DEFNDBINOP_OP (sub, complex_matrix, complex, complex_array, complex, -) |
45 DEFNDBINOP_OP (mul, complex_matrix, complex, array, complex, *) | 45 DEFNDBINOP_OP (mul, complex_matrix, complex, complex_array, complex, *) |
46 | 46 |
47 DEFBINOP (div, complex_matrix, complex) | 47 DEFBINOP (div, complex_matrix, complex) |
48 { | 48 { |
49 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); | 49 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); |
50 | 50 |
51 Complex d = v2.complex_value (); | 51 Complex d = v2.complex_value (); |
52 | 52 |
53 if (d == 0.0) | 53 if (d == 0.0) |
54 gripe_divide_by_zero (); | 54 gripe_divide_by_zero (); |
55 | 55 |
56 return octave_value (v1.array_value () / d); | 56 return octave_value (v1.complex_array_value () / d); |
57 } | 57 } |
58 | 58 |
59 DEFBINOP_FN (pow, complex_matrix, complex, xpow) | 59 DEFBINOP_FN (pow, complex_matrix, complex, xpow) |
60 | 60 |
61 DEFBINOP (ldiv, complex_matrix, complex) | 61 DEFBINOP (ldiv, complex_matrix, complex) |
66 ComplexMatrix m2 = v2.complex_matrix_value (); | 66 ComplexMatrix m2 = v2.complex_matrix_value (); |
67 | 67 |
68 return octave_value (xleftdiv (m1, m2)); | 68 return octave_value (xleftdiv (m1, m2)); |
69 } | 69 } |
70 | 70 |
71 DEFNDBINOP_FN (lt, complex_matrix, complex, array, complex, mx_el_lt) | 71 DEFNDBINOP_FN (lt, complex_matrix, complex, complex_array, complex, mx_el_lt) |
72 DEFNDBINOP_FN (le, complex_matrix, complex, array, complex, mx_el_le) | 72 DEFNDBINOP_FN (le, complex_matrix, complex, complex_array, complex, mx_el_le) |
73 DEFNDBINOP_FN (eq, complex_matrix, complex, array, complex, mx_el_eq) | 73 DEFNDBINOP_FN (eq, complex_matrix, complex, complex_array, complex, mx_el_eq) |
74 DEFNDBINOP_FN (ge, complex_matrix, complex, array, complex, mx_el_ge) | 74 DEFNDBINOP_FN (ge, complex_matrix, complex, complex_array, complex, mx_el_ge) |
75 DEFNDBINOP_FN (gt, complex_matrix, complex, array, complex, mx_el_gt) | 75 DEFNDBINOP_FN (gt, complex_matrix, complex, complex_array, complex, mx_el_gt) |
76 DEFNDBINOP_FN (ne, complex_matrix, complex, array, complex, mx_el_ne) | 76 DEFNDBINOP_FN (ne, complex_matrix, complex, complex_array, complex, mx_el_ne) |
77 | 77 |
78 DEFNDBINOP_OP (el_mul, complex_matrix, complex, array, complex, *) | 78 DEFNDBINOP_OP (el_mul, complex_matrix, complex, complex_array, complex, *) |
79 | 79 |
80 DEFBINOP (el_div, complex_matrix, complex) | 80 DEFBINOP (el_div, complex_matrix, complex) |
81 { | 81 { |
82 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); | 82 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); |
83 | 83 |
84 Complex d = v2.complex_value (); | 84 Complex d = v2.complex_value (); |
85 | 85 |
86 if (d == 0.0) | 86 if (d == 0.0) |
87 gripe_divide_by_zero (); | 87 gripe_divide_by_zero (); |
88 | 88 |
89 return octave_value (v1.array_value () / d); | 89 return octave_value (v1.complex_array_value () / d); |
90 } | 90 } |
91 | 91 |
92 DEFNDBINOP_FN (el_pow, complex_matrix, complex, array, complex, elem_xpow) | 92 DEFNDBINOP_FN (el_pow, complex_matrix, complex, complex_array, complex, elem_xpow) |
93 | 93 |
94 DEFBINOP (el_ldiv, complex_matrix, complex) | 94 DEFBINOP (el_ldiv, complex_matrix, complex) |
95 { | 95 { |
96 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); | 96 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); |
97 | 97 |
98 return x_el_div (v2.complex_value (), v1.array_value ()); | 98 return x_el_div (v2.complex_value (), v1.complex_array_value ()); |
99 } | 99 } |
100 | 100 |
101 DEFNDBINOP_FN (el_and, complex_matrix, complex, array, complex, mx_el_and) | 101 DEFNDBINOP_FN (el_and, complex_matrix, complex, complex_array, complex, mx_el_and) |
102 DEFNDBINOP_FN (el_or, complex_matrix, complex, array, complex, mx_el_or) | 102 DEFNDBINOP_FN (el_or, complex_matrix, complex, complex_array, complex, mx_el_or) |
103 | 103 |
104 DEFASSIGNOP_FN (assign, complex_matrix, complex, assign) | 104 DEFASSIGNOP_FN (assign, complex_matrix, complex, assign) |
105 | 105 |
106 void | 106 void |
107 install_cm_cs_ops (void) | 107 install_cm_cs_ops (void) |