GNU Octave  9.1.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-2024 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 
46 
47 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
48 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
49 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
50 #if defined (LEFT)
51 # define LMATRIX_VALUE perm_matrix_value
52 # define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
53 #else
54 # define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
55 # define RMATRIX_VALUE perm_matrix_value
56 #endif
57 
58 DEFBINOP (mul, LMATRIX, RMATRIX)
59 {
60  OCTAVE_CAST_BASE_VALUE (const OCTAVE_LMATRIX&, v1, a1);
62 
63  return v1.LMATRIX_VALUE () * v2.RMATRIX_VALUE ();
64 }
65 
66 #if defined (LEFT)
67 DEFBINOP (ldiv, LMATRIX, RMATRIX)
68 {
69  OCTAVE_CAST_BASE_VALUE (const OCTAVE_LMATRIX&, v1, a1);
71 
72  return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE ();
73 }
74 #else
75 DEFBINOP (div, LMATRIX, RMATRIX)
76 {
77  OCTAVE_CAST_BASE_VALUE (const OCTAVE_LMATRIX&, v1, a1);
79 
80  return v1.LMATRIX_VALUE () * v2.perm_matrix_value ().inverse ();
81 }
82 #endif
83 
84 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
85 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
86 
87 void
88 INST_NAME (octave::type_info& ti)
89 {
91 #if defined (LEFT)
93 #else
95 #endif
96 #if defined (DEFINENULLASSIGNCONV)
100 #endif
101 }
102 
103 OCTAVE_END_NAMESPACE(octave)
PermMatrix inverse() const
Definition: PermMatrix.cc:114
virtual PermMatrix perm_matrix_value() const
Definition: ov-base.cc:742
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#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:245
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
Definition: ops.h:88
#define OCTAVE_CAST_BASE_VALUE(T, T_VAL, BASE_VAL)
Definition: ops.h:52
#define INSTALL_BINOP_TI(ti, op, t1, t2, f)
Definition: ops.h:70
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1665
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1669
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1666