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-fcm-fm.h"
00028 #include "mx-fm-fcm.h"
00029 #include "mx-fcnda-fnda.h"
00030 #include "mx-fnda-fcnda.h"
00031
00032 #include "gripes.h"
00033 #include "oct-obj.h"
00034 #include "ov.h"
00035 #include "ov-cx-mat.h"
00036 #include "ov-flt-cx-mat.h"
00037 #include "ov-flt-re-mat.h"
00038 #include "ov-re-mat.h"
00039 #include "ov-typeinfo.h"
00040 #include "ops.h"
00041 #include "xdiv.h"
00042 #include "xpow.h"
00043
00044
00045
00046 DEFNDBINOP_OP (add, float_complex_matrix, float_matrix, float_complex_array, float_array, +)
00047 DEFNDBINOP_OP (sub, float_complex_matrix, float_matrix, float_complex_array, float_array, -)
00048
00049 DEFBINOP_OP (mul, float_complex_matrix, float_matrix, *)
00050
00051 DEFBINOP (mul_trans, float_complex_matrix, float_matrix)
00052 {
00053 CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&);
00054
00055 FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
00056 FloatMatrix m2 = v2.float_matrix_value ();
00057
00058 return FloatComplexMatrix (xgemm (real (m1), m2, blas_no_trans, blas_trans),
00059 xgemm (imag (m1), m2, blas_no_trans, blas_trans));
00060 }
00061
00062 DEFBINOP (div, float_complex_matrix, float_matrix)
00063 {
00064 CAST_BINOP_ARGS (const octave_float_complex_matrix&,
00065 const octave_float_matrix&);
00066 MatrixType typ = v2.matrix_type ();
00067
00068 FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (),
00069 v2.float_matrix_value (), typ);
00070
00071 v2.matrix_type (typ);
00072 return ret;
00073 }
00074
00075
00076 DEFBINOPX (pow, float_complex_matrix, float_matrix)
00077 {
00078 error ("can't do A ^ B for A and B both matrices");
00079 return octave_value ();
00080 }
00081
00082 DEFBINOP (ldiv, float_complex_matrix, float_matrix)
00083 {
00084 CAST_BINOP_ARGS (const octave_float_complex_matrix&,
00085 const octave_float_matrix&);
00086 MatrixType typ = v1.matrix_type ();
00087
00088 FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
00089 v2.float_matrix_value (), typ);
00090
00091 v1.matrix_type (typ);
00092 return ret;
00093 }
00094
00095 DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_matrix,
00096 float_complex_array, float_array, mx_el_lt)
00097 DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_matrix,
00098 float_complex_array, float_array, mx_el_le)
00099 DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_matrix,
00100 float_complex_array, float_array, mx_el_eq)
00101 DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_matrix,
00102 float_complex_array, float_array, mx_el_ge)
00103 DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_matrix,
00104 float_complex_array, float_array, mx_el_gt)
00105 DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_matrix,
00106 float_complex_array, float_array, mx_el_ne)
00107
00108 DEFNDBINOP_FN (el_mul, float_complex_matrix, float_matrix,
00109 float_complex_array, float_array, product)
00110 DEFNDBINOP_FN (el_div, float_complex_matrix, float_matrix,
00111 float_complex_array, float_array, quotient)
00112 DEFNDBINOP_FN (el_pow, float_complex_matrix, float_matrix,
00113 float_complex_array, float_array, elem_xpow)
00114
00115 DEFBINOP (el_ldiv, float_complex_matrix, float_matrix)
00116 {
00117 CAST_BINOP_ARGS (const octave_float_complex_matrix&,
00118 const octave_float_matrix&);
00119
00120 return quotient (v2.float_array_value (), v1.float_complex_array_value ());
00121 }
00122
00123 DEFNDBINOP_FN (el_and, float_complex_matrix, float_matrix,
00124 float_complex_array, float_array, mx_el_and)
00125 DEFNDBINOP_FN (el_or, float_complex_matrix, float_matrix,
00126 float_complex_array, float_array, mx_el_or)
00127
00128 DEFNDCATOP_FN (fcm_fm, float_complex_matrix, float_matrix,
00129 float_complex_array, float_array, concat)
00130
00131 DEFNDCATOP_FN (cm_fm, complex_matrix, float_matrix,
00132 float_complex_array, float_array, concat)
00133
00134 DEFNDCATOP_FN (fcm_m, float_complex_matrix, matrix,
00135 float_complex_array, float_array, concat)
00136
00137 DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_matrix,
00138 float_complex_array, assign)
00139 DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_matrix,
00140 complex_array, assign)
00141
00142 void
00143 install_fcm_fm_ops (void)
00144 {
00145 INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_matrix, add);
00146 INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_matrix, sub);
00147 INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_matrix, mul);
00148 INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_matrix, div);
00149 INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_matrix, pow);
00150 INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
00151 octave_float_matrix, ldiv);
00152 INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_matrix, lt);
00153 INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_matrix, le);
00154 INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_matrix, eq);
00155 INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_matrix, ge);
00156 INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_matrix, gt);
00157 INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_matrix, ne);
00158 INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
00159 octave_float_matrix, el_mul);
00160 INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
00161 octave_float_matrix, el_div);
00162 INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
00163 octave_float_matrix, el_pow);
00164 INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
00165 octave_float_matrix, el_ldiv);
00166 INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
00167 octave_float_matrix, el_and);
00168 INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
00169 octave_float_matrix, el_or);
00170 INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix,
00171 octave_float_matrix, mul_trans);
00172 INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix,
00173 octave_float_matrix, mul_trans);
00174
00175 INSTALL_CATOP (octave_float_complex_matrix, octave_float_matrix, fcm_fm);
00176 INSTALL_CATOP (octave_complex_matrix, octave_float_matrix, cm_fm);
00177 INSTALL_CATOP (octave_float_complex_matrix, octave_matrix, fcm_m);
00178
00179 INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
00180 octave_float_matrix, assign);
00181 INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
00182 octave_float_matrix, dbl_assign);
00183 }