GNU Octave 7.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-2022 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
45OCTAVE_NAMESPACE_BEGIN
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
59{
60 const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
61 const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
62
63 return v1.LMATRIX_VALUE () * v2.RMATRIX_VALUE ();
64}
65
66#if defined (LEFT)
68{
69 const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
70 const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
71
72 return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE ();
73}
74#else
76{
77 const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
78 const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
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
87void
88INST_NAME (octave::type_info& ti)
89{
91#if defined (LEFT)
93#else
95#endif
96#if defined (DEFINENULLASSIGNCONV)
100#endif
101}
102
103OCTAVE_NAMESPACE_END
OCTAVE_API PermMatrix inverse(void) const
Definition: PermMatrix.cc:114
virtual PermMatrix perm_matrix_value(void) const
Definition: ov-base.cc:685
#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:228
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
Definition: ops.h:71
#define INSTALL_BINOP_TI(ti, op, t1, t2, f)
Definition: ops.h:53
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1867
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1871
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1868