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