00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include "gripes.h"
00028 #include "oct-obj.h"
00029 #include "ov.h"
00030 #include "ov-complex.h"
00031 #include "ov-flt-complex.h"
00032 #include "ov-cx-mat.h"
00033 #include "ov-flt-cx-mat.h"
00034 #include "ov-typeinfo.h"
00035 #include "ops.h"
00036 #include "xdiv.h"
00037 #include "xpow.h"
00038
00039
00040
00041 DEFNDBINOP_OP (add, float_complex, float_complex_matrix, float_complex, float_complex_array, +)
00042 DEFNDBINOP_OP (sub, float_complex, float_complex_matrix, float_complex, float_complex_array, -)
00043 DEFNDBINOP_OP (mul, float_complex, float_complex_matrix, float_complex, float_complex_array, *)
00044
00045 DEFBINOP (div, float_complex, float_complex_matrix)
00046 {
00047 CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
00048
00049 FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
00050 FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
00051 MatrixType typ = v2.matrix_type ();
00052
00053 FloatComplexMatrix ret = xdiv (m1, m2, typ);
00054
00055 v2.matrix_type (typ);
00056 return ret;
00057 }
00058
00059 DEFBINOP_FN (pow, float_complex, float_complex_matrix, xpow)
00060
00061 DEFBINOP (ldiv, float_complex, float_complex_matrix)
00062 {
00063 CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
00064
00065 FloatComplex d = v1.float_complex_value ();
00066
00067 if (d == static_cast<float>(0.0))
00068 gripe_divide_by_zero ();
00069
00070 return octave_value (v2.float_complex_array_value () / d);
00071 }
00072
00073 DEFNDCMPLXCMPOP_FN (lt, float_complex, float_complex_matrix, float_complex,
00074 float_complex_array, mx_el_lt)
00075 DEFNDCMPLXCMPOP_FN (le, float_complex, float_complex_matrix, float_complex,
00076 float_complex_array, mx_el_le)
00077 DEFNDCMPLXCMPOP_FN (eq, float_complex, float_complex_matrix, float_complex,
00078 float_complex_array, mx_el_eq)
00079 DEFNDCMPLXCMPOP_FN (ge, float_complex, float_complex_matrix, float_complex,
00080 float_complex_array, mx_el_ge)
00081 DEFNDCMPLXCMPOP_FN (gt, float_complex, float_complex_matrix, float_complex,
00082 float_complex_array, mx_el_gt)
00083 DEFNDCMPLXCMPOP_FN (ne, float_complex, float_complex_matrix, float_complex,
00084 float_complex_array, mx_el_ne)
00085
00086 DEFNDBINOP_OP (el_mul, float_complex, float_complex_matrix, float_complex,
00087 float_complex_array, *)
00088 DEFNDBINOP_FN (el_div, float_complex, float_complex_matrix, float_complex,
00089 float_complex_array, x_el_div)
00090 DEFNDBINOP_FN (el_pow, float_complex, float_complex_matrix, float_complex,
00091 float_complex_array, elem_xpow)
00092
00093 DEFBINOP (el_ldiv, float_complex, float_complex_matrix)
00094 {
00095 CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
00096
00097 FloatComplex d = v1.float_complex_value ();
00098
00099 if (d == static_cast<float>(0.0))
00100 gripe_divide_by_zero ();
00101
00102 return octave_value (v2.float_complex_array_value () / d);
00103 }
00104
00105 DEFNDBINOP_FN (el_and, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_and)
00106 DEFNDBINOP_FN (el_or, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_or)
00107
00108 DEFNDCATOP_FN (fcs_fcm, float_complex, float_complex_matrix, float_complex_array, float_complex_array, concat)
00109
00110 DEFNDCATOP_FN (cs_fcm, complex, float_complex_matrix, float_complex_array, float_complex_array, concat)
00111
00112 DEFNDCATOP_FN (fcs_cm, float_complex, complex_matrix, float_complex_array, float_complex_array, concat)
00113
00114 DEFCONV (float_complex_matrix_conv, float_complex, float_complex_matrix)
00115 {
00116 CAST_CONV_ARG (const octave_float_complex&);
00117
00118 return new octave_float_complex_matrix (v.float_complex_matrix_value ());
00119 }
00120
00121 void
00122 install_fcs_fcm_ops (void)
00123 {
00124 INSTALL_BINOP (op_add, octave_float_complex, octave_float_complex_matrix, add);
00125 INSTALL_BINOP (op_sub, octave_float_complex, octave_float_complex_matrix, sub);
00126 INSTALL_BINOP (op_mul, octave_float_complex, octave_float_complex_matrix, mul);
00127 INSTALL_BINOP (op_div, octave_float_complex, octave_float_complex_matrix, div);
00128 INSTALL_BINOP (op_pow, octave_float_complex, octave_float_complex_matrix, pow);
00129 INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_complex_matrix, ldiv);
00130 INSTALL_BINOP (op_lt, octave_float_complex, octave_float_complex_matrix, lt);
00131 INSTALL_BINOP (op_le, octave_float_complex, octave_float_complex_matrix, le);
00132 INSTALL_BINOP (op_eq, octave_float_complex, octave_float_complex_matrix, eq);
00133 INSTALL_BINOP (op_ge, octave_float_complex, octave_float_complex_matrix, ge);
00134 INSTALL_BINOP (op_gt, octave_float_complex, octave_float_complex_matrix, gt);
00135 INSTALL_BINOP (op_ne, octave_float_complex, octave_float_complex_matrix, ne);
00136 INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_complex_matrix, el_mul);
00137 INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_complex_matrix, el_div);
00138 INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_complex_matrix, el_pow);
00139 INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_complex_matrix, el_ldiv);
00140 INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_complex_matrix, el_and);
00141 INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_complex_matrix, el_or);
00142
00143 INSTALL_CATOP (octave_float_complex, octave_float_complex_matrix, fcs_fcm);
00144 INSTALL_CATOP (octave_complex, octave_float_complex_matrix, cs_fcm);
00145 INSTALL_CATOP (octave_float_complex, octave_complex_matrix, fcs_cm);
00146
00147 INSTALL_ASSIGNCONV (octave_float_complex, octave_float_complex_matrix, octave_float_complex_matrix);
00148
00149 INSTALL_ASSIGNCONV (octave_complex, octave_float_complex_matrix, octave_complex_matrix);
00150
00151 INSTALL_WIDENOP (octave_float_complex, octave_float_complex_matrix, float_complex_matrix_conv);
00152 }