op-fdm-fdm.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2008-2012 Jaroslav Hajek
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
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-flt-re-mat.h"
00031 #include "ov-flt-re-diag.h"
00032 #include "ov-re-diag.h"
00033 #include "ov-typeinfo.h"
00034 #include "ops.h"
00035 #include "xdiv.h"
00036 #include "xpow.h"
00037 
00038 // matrix unary ops.
00039 
00040 DEFUNOP_OP (uplus, float_diag_matrix, /* no-op */)
00041 DEFUNOP_OP (uminus, float_diag_matrix, -)
00042 
00043 DEFUNOP (transpose, float_diag_matrix)
00044 {
00045   CAST_UNOP_ARG (const octave_float_diag_matrix&);
00046   return octave_value (v.float_diag_matrix_value().transpose ());
00047 }
00048 
00049 // matrix by matrix ops.
00050 
00051 DEFBINOP_OP (add, float_diag_matrix, float_diag_matrix, +)
00052 DEFBINOP_OP (sub, float_diag_matrix, float_diag_matrix, -)
00053 DEFBINOP_OP (mul, float_diag_matrix, float_diag_matrix, *)
00054 
00055 DEFBINOP (div, float_diag_matrix, float_diag_matrix)
00056 {
00057   CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&);
00058 
00059   return xdiv (v1.float_diag_matrix_value (),
00060                v2.float_diag_matrix_value ());
00061 }
00062 
00063 DEFBINOP (ldiv, float_diag_matrix, float_diag_matrix)
00064 {
00065   CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&);
00066 
00067   return xleftdiv (v1.float_diag_matrix_value (),
00068                    v2.float_diag_matrix_value ());
00069 }
00070 
00071 CONVDECL (float_diag_matrix_to_diag_matrix)
00072 {
00073   CAST_CONV_ARG (const octave_float_diag_matrix&);
00074 
00075   return new octave_diag_matrix (v.diag_matrix_value ());
00076 }
00077 
00078 CONVDECL (float_diag_matrix_to_float_matrix)
00079 {
00080   CAST_CONV_ARG (const octave_float_diag_matrix&);
00081 
00082   return new octave_float_matrix (v.float_matrix_value ());
00083 }
00084 
00085 void
00086 install_fdm_fdm_ops (void)
00087 {
00088   INSTALL_UNOP (op_uplus, octave_float_diag_matrix, uplus);
00089   INSTALL_UNOP (op_uminus, octave_float_diag_matrix, uminus);
00090   INSTALL_UNOP (op_transpose, octave_float_diag_matrix, transpose);
00091   INSTALL_UNOP (op_hermitian, octave_float_diag_matrix, transpose);
00092 
00093   INSTALL_BINOP (op_add, octave_float_diag_matrix, octave_float_diag_matrix, add);
00094   INSTALL_BINOP (op_sub, octave_float_diag_matrix, octave_float_diag_matrix, sub);
00095   INSTALL_BINOP (op_mul, octave_float_diag_matrix, octave_float_diag_matrix, mul);
00096   INSTALL_BINOP (op_div, octave_float_diag_matrix, octave_float_diag_matrix, div);
00097   INSTALL_BINOP (op_ldiv, octave_float_diag_matrix, octave_float_diag_matrix, ldiv);
00098 
00099   INSTALL_CONVOP (octave_float_diag_matrix, octave_float_matrix, float_diag_matrix_to_float_matrix);
00100   INSTALL_CONVOP (octave_float_diag_matrix, octave_diag_matrix, float_diag_matrix_to_diag_matrix);
00101   INSTALL_ASSIGNCONV (octave_float_diag_matrix, octave_float_matrix, octave_float_matrix);
00102   INSTALL_WIDENOP (octave_float_diag_matrix, octave_float_matrix, float_diag_matrix_to_float_matrix);
00103 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines