GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
op-pm-template.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2008-2017 Jaroslav Hajek
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 // FIXME: it might be nice to only include the declarations of the
28 // operators that are actually needed instead of including all of them.
29 #include "mx-ops.h"
30 
31 #include "ov-perm.h"
32 #include MINCLUDE
33 #include "ops.h"
34 #if defined (DEFINENULLASSIGNCONV)
35 # include "ov-null-mat.h"
36 #endif
37 
38 #if ! defined (LDMATRIX)
39 # define LDMATRIX LMATRIX
40 #endif
41 
42 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
43 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
44 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
45 #if defined (LEFT)
46 # define LMATRIX_VALUE perm_matrix_value
47 # define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
48 #else
49 # define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
50 # define RMATRIX_VALUE perm_matrix_value
51 #endif
52 
54 {
55  const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
56  const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
57 
58  return v1.LMATRIX_VALUE () * v2.RMATRIX_VALUE ();
59 }
60 
61 #if defined (LEFT)
62 DEFBINOP (ldiv, LMATRIX, RMATRIX)
63 {
64  const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
65  const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
66 
67  return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE ();
68 }
69 #else
71 {
72  const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
73  const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
74 
75  return v1.LMATRIX_VALUE () * v2.perm_matrix_value ().inverse ();
76 }
77 #endif
78 
79 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
80 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
81 
82 void
83 INST_NAME (void)
84 {
86 #if defined (LEFT)
88 #else
90 #endif
91 #if defined (DEFINENULLASSIGNCONV)
95 #endif
96 }
#define DEFBINOP(name, t1, t2)
Definition: ops.h:223
#define RMATRIX
Definition: op-cdm-cm.cc:31
#define OCTAVE_LDMATRIX
#define LMATRIX
Definition: op-cdm-cm.cc:30
#define OCTAVE_RMATRIX
const octave_base_value & a2
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1517
#define INSTALL_BINOP(op, t1, t2, f)
Definition: ops.h:48
#define INST_NAME
#define OCTAVE_LMATRIX
const octave_char_matrix & v2
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1520
#define INSTALL_ASSIGNCONV(t1, t2, tr)
Definition: ops.h:66
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1516