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-re-mat.h"
00031 #include "ov-re-diag.h"
00032 #include "ov-flt-re-diag.h"
00033 #include "ov-typeinfo.h"
00034 #include "ops.h"
00035 #include "xdiv.h"
00036 #include "xpow.h"
00037
00038
00039
00040 DEFUNOP_OP (uplus, diag_matrix, )
00041 DEFUNOP_OP (uminus, diag_matrix, -)
00042
00043 DEFUNOP (transpose, diag_matrix)
00044 {
00045 CAST_UNOP_ARG (const octave_diag_matrix&);
00046 return octave_value (v.diag_matrix_value().transpose ());
00047 }
00048
00049
00050
00051 DEFBINOP_OP (add, diag_matrix, diag_matrix, +)
00052 DEFBINOP_OP (sub, diag_matrix, diag_matrix, -)
00053 DEFBINOP_OP (mul, diag_matrix, diag_matrix, *)
00054
00055 DEFBINOP (div, diag_matrix, diag_matrix)
00056 {
00057 CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&);
00058
00059 return xdiv (v1.diag_matrix_value (),
00060 v2.diag_matrix_value ());
00061 }
00062
00063 DEFBINOP (ldiv, diag_matrix, diag_matrix)
00064 {
00065 CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&);
00066
00067 return xleftdiv (v1.diag_matrix_value (),
00068 v2.diag_matrix_value ());
00069 }
00070
00071 CONVDECL (diag_matrix_to_matrix)
00072 {
00073 CAST_CONV_ARG (const octave_diag_matrix&);
00074
00075 return new octave_matrix (v.matrix_value ());
00076 }
00077
00078 CONVDECL (diag_matrix_to_float_diag_matrix)
00079 {
00080 CAST_CONV_ARG (const octave_diag_matrix&);
00081
00082 return new octave_float_diag_matrix (v.float_diag_matrix_value ());
00083 }
00084
00085 void
00086 install_dm_dm_ops (void)
00087 {
00088 INSTALL_UNOP (op_uplus, octave_diag_matrix, uplus);
00089 INSTALL_UNOP (op_uminus, octave_diag_matrix, uminus);
00090 INSTALL_UNOP (op_transpose, octave_diag_matrix, transpose);
00091 INSTALL_UNOP (op_hermitian, octave_diag_matrix, transpose);
00092
00093 INSTALL_BINOP (op_add, octave_diag_matrix, octave_diag_matrix, add);
00094 INSTALL_BINOP (op_sub, octave_diag_matrix, octave_diag_matrix, sub);
00095 INSTALL_BINOP (op_mul, octave_diag_matrix, octave_diag_matrix, mul);
00096 INSTALL_BINOP (op_div, octave_diag_matrix, octave_diag_matrix, div);
00097 INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_diag_matrix, ldiv);
00098
00099 INSTALL_CONVOP (octave_diag_matrix, octave_matrix, diag_matrix_to_matrix);
00100 INSTALL_CONVOP (octave_diag_matrix, octave_float_diag_matrix, diag_matrix_to_float_diag_matrix);
00101 INSTALL_ASSIGNCONV (octave_diag_matrix, octave_matrix, octave_matrix);
00102 INSTALL_WIDENOP (octave_diag_matrix, octave_matrix, diag_matrix_to_matrix);
00103 }