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