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 "mx-fs-fcm.h"
00028 #include "mx-fcm-fs.h"
00029 #include "mx-fs-fcnda.h"
00030 #include "mx-fcnda-fs.h"
00031
00032 #include "gripes.h"
00033 #include "oct-obj.h"
00034 #include "ov.h"
00035 #include "ov-scalar.h"
00036 #include "ov-float.h"
00037 #include "ov-cx-mat.h"
00038 #include "ov-flt-cx-mat.h"
00039 #include "ov-flt-re-mat.h"
00040 #include "ov-typeinfo.h"
00041 #include "ops.h"
00042 #include "xdiv.h"
00043 #include "xpow.h"
00044
00045
00046
00047 DEFNDBINOP_OP (add, float_scalar, float_complex_matrix, float_scalar,
00048 float_complex_array, +)
00049 DEFNDBINOP_OP (sub, float_scalar, float_complex_matrix, float_scalar,
00050 float_complex_array, -)
00051 DEFNDBINOP_OP (mul, float_scalar, float_complex_matrix, float_scalar,
00052 float_complex_array, *)
00053
00054 DEFBINOP (div, float_scalar, float_complex_matrix)
00055 {
00056 CAST_BINOP_ARGS (const octave_float_scalar&,
00057 const octave_float_complex_matrix&);
00058
00059 FloatMatrix m1 = v1.float_matrix_value ();
00060 FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
00061 MatrixType typ = v2.matrix_type ();
00062
00063 FloatComplexMatrix ret = xdiv (m1, m2, typ);
00064
00065 v2.matrix_type (typ);
00066 return ret;
00067 }
00068
00069 DEFBINOP_FN (pow, float_scalar, float_complex_matrix, xpow)
00070
00071 DEFBINOP (ldiv, float_scalar, float_complex_matrix)
00072 {
00073 CAST_BINOP_ARGS (const octave_float_scalar&,
00074 const octave_float_complex_matrix&);
00075
00076 float d = v1.float_value ();
00077
00078 if (d == 0.0)
00079 gripe_divide_by_zero ();
00080
00081 return octave_value (v2.float_complex_array_value () / d);
00082 }
00083
00084 DEFNDCMPLXCMPOP_FN (lt, float_scalar, float_complex_matrix, float_scalar,
00085 float_complex_array, mx_el_lt)
00086 DEFNDCMPLXCMPOP_FN (le, float_scalar, float_complex_matrix, float_scalar,
00087 float_complex_array, mx_el_le)
00088 DEFNDCMPLXCMPOP_FN (eq, float_scalar, float_complex_matrix, float_scalar,
00089 float_complex_array, mx_el_eq)
00090 DEFNDCMPLXCMPOP_FN (ge, float_scalar, float_complex_matrix, float_scalar,
00091 float_complex_array, mx_el_ge)
00092 DEFNDCMPLXCMPOP_FN (gt, float_scalar, float_complex_matrix, float_scalar,
00093 float_complex_array, mx_el_gt)
00094 DEFNDCMPLXCMPOP_FN (ne, float_scalar, float_complex_matrix, float_scalar,
00095 float_complex_array, mx_el_ne)
00096
00097 DEFNDBINOP_OP (el_mul, float_scalar, float_complex_matrix, float_scalar,
00098 float_complex_array, *)
00099 DEFNDBINOP_FN (el_div, float_scalar, float_complex_matrix, float_scalar,
00100 float_complex_array, x_el_div)
00101 DEFNDBINOP_FN (el_pow, float_scalar, float_complex_matrix, float_scalar,
00102 float_complex_array, elem_xpow)
00103
00104 DEFBINOP (el_ldiv, float_scalar, float_complex_matrix)
00105 {
00106 CAST_BINOP_ARGS (const octave_float_scalar&,
00107 const octave_float_complex_matrix&);
00108
00109 float d = v1.float_value ();
00110
00111 if (d == 0.0)
00112 gripe_divide_by_zero ();
00113
00114 return octave_value (v2.float_complex_array_value () / d);
00115 }
00116
00117 DEFNDBINOP_FN (el_and, float_scalar, float_complex_matrix, float_scalar,
00118 float_complex_array, mx_el_and)
00119 DEFNDBINOP_FN (el_or, float_scalar, float_complex_matrix, float_scalar,
00120 float_complex_array, mx_el_or)
00121
00122 DEFNDCATOP_FN (fs_fcm, float_scalar, float_complex_matrix, float_array,
00123 float_complex_array, concat)
00124
00125 DEFNDCATOP_FN (s_fcm, scalar, float_complex_matrix, float_array,
00126 float_complex_array, concat)
00127
00128 DEFNDCATOP_FN (fs_cm, float_scalar, complex_matrix, float_array,
00129 float_complex_array, concat)
00130
00131 DEFCONV (float_complex_matrix_conv, float_scalar, float_complex_matrix)
00132 {
00133 CAST_CONV_ARG (const octave_float_scalar&);
00134
00135 return new octave_float_complex_matrix (FloatComplexMatrix (v.float_matrix_value ()));
00136 }
00137
00138 void
00139 install_fs_fcm_ops (void)
00140 {
00141 INSTALL_BINOP (op_add, octave_float_scalar, octave_float_complex_matrix, add);
00142 INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_complex_matrix, sub);
00143 INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_complex_matrix, mul);
00144 INSTALL_BINOP (op_div, octave_float_scalar, octave_float_complex_matrix, div);
00145 INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_complex_matrix, pow);
00146 INSTALL_BINOP (op_ldiv, octave_float_scalar,
00147 octave_float_complex_matrix, ldiv);
00148 INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_complex_matrix, lt);
00149 INSTALL_BINOP (op_le, octave_float_scalar, octave_float_complex_matrix, le);
00150 INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_complex_matrix, eq);
00151 INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_complex_matrix, ge);
00152 INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_complex_matrix, gt);
00153 INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_complex_matrix, ne);
00154 INSTALL_BINOP (op_el_mul, octave_float_scalar,
00155 octave_float_complex_matrix, el_mul);
00156 INSTALL_BINOP (op_el_div, octave_float_scalar,
00157 octave_float_complex_matrix, el_div);
00158 INSTALL_BINOP (op_el_pow, octave_float_scalar,
00159 octave_float_complex_matrix, el_pow);
00160 INSTALL_BINOP (op_el_ldiv, octave_float_scalar,
00161 octave_float_complex_matrix, el_ldiv);
00162 INSTALL_BINOP (op_el_and, octave_float_scalar,
00163 octave_float_complex_matrix, el_and);
00164 INSTALL_BINOP (op_el_or, octave_float_scalar,
00165 octave_float_complex_matrix, el_or);
00166
00167 INSTALL_CATOP (octave_float_scalar, octave_float_complex_matrix, fs_fcm);
00168 INSTALL_CATOP (octave_scalar, octave_float_complex_matrix, s_fcm);
00169 INSTALL_CATOP (octave_float_scalar, octave_complex_matrix, fs_cm);
00170
00171 INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex_matrix,
00172 octave_float_complex_matrix);
00173 INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex_matrix,
00174 octave_complex_matrix);
00175
00176 INSTALL_WIDENOP (octave_float_scalar, octave_float_complex_matrix,
00177 float_complex_matrix_conv);
00178 }