op-dm-template.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 "ops.h"
00028 #include "xdiv.h"
00029 #include LINCLUDE
00030 #include RINCLUDE
00031 #ifdef DEFINENULLASSIGNCONV
00032 #include "ov-null-mat.h"
00033 #endif
00034 
00035 // matrix by diag matrix ops.
00036 
00037 DEFBINOP_OP (add, LMATRIX, RMATRIX, +)
00038 DEFBINOP_OP (sub, LMATRIX, RMATRIX, -)
00039 DEFBINOP_OP (mul, LMATRIX, RMATRIX, *)
00040 
00041 #ifndef LDMATRIX
00042 #define LDMATRIX LMATRIX
00043 #endif
00044 
00045 #ifndef RDMATRIX
00046 #define RDMATRIX RMATRIX
00047 #endif
00048 
00049 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
00050 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
00051 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
00052 #define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
00053 #define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
00054 #define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
00055 #define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
00056 
00057 #ifdef DEFINEDIV
00058 DEFBINOP (div, LMATRIX, RMATRIX)
00059 {
00060   CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
00061 
00062   return xdiv (v1.LDMATRIX_VALUE (), v2.RMATRIX_VALUE ());
00063 }
00064 #endif
00065 
00066 #ifdef DEFINELDIV
00067 DEFBINOP (ldiv, LMATRIX, RMATRIX)
00068 {
00069   CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
00070 
00071   return xleftdiv (v1.LMATRIX_VALUE (), v2.RDMATRIX_VALUE ());
00072 }
00073 #endif
00074 
00075 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
00076 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
00077 
00078 void
00079 INST_NAME (void)
00080 {
00081   INSTALL_BINOP (op_add, OCTAVE_LMATRIX, OCTAVE_RMATRIX, add);
00082   INSTALL_BINOP (op_sub, OCTAVE_LMATRIX, OCTAVE_RMATRIX, sub);
00083   INSTALL_BINOP (op_mul, OCTAVE_LMATRIX, OCTAVE_RMATRIX, mul);
00084 #ifdef DEFINEDIV
00085   INSTALL_BINOP (op_div, OCTAVE_LMATRIX, OCTAVE_RMATRIX, div);
00086 #endif
00087 #ifdef DEFINELDIV
00088   INSTALL_BINOP (op_ldiv, OCTAVE_LMATRIX, OCTAVE_RMATRIX, ldiv);
00089 #endif
00090 #ifdef DEFINENULLASSIGNCONV
00091   INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_matrix, OCTAVE_LDMATRIX);
00092   INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_str, OCTAVE_LDMATRIX);
00093   INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_sq_str, OCTAVE_LDMATRIX);
00094 #endif
00095 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines