GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-dm-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 // This file should not include config.h. It is only included in other
27 // C++ source files that should have included config.h before including
28 // this file.
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 "ops.h"
35 #include "xdiv.h"
36 #include LINCLUDE
37 #include RINCLUDE
38 #if defined (DEFINENULLASSIGNCONV)
39 # include "ov-null-mat.h"
40 #endif
41 
42 // matrix by diag matrix ops.
43 
47 
48 #if ! defined (LDMATRIX)
49 # define LDMATRIX LMATRIX
50 #endif
51 
52 #if ! defined (RDMATRIX)
53 # define RDMATRIX RMATRIX
54 #endif
55 
56 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
57 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
58 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
59 #define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
60 #define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
61 #define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
62 #define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
63 
64 #if defined (DEFINEDIV)
65 DEFBINOP (div, 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 xdiv (v1.LDMATRIX_VALUE (), v2.RMATRIX_VALUE ());
71 }
72 #endif
73 
74 #if defined (DEFINELDIV)
75 DEFBINOP (ldiv, LMATRIX, RMATRIX)
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 xleftdiv (v1.LMATRIX_VALUE (), v2.RDMATRIX_VALUE ());
81 }
82 #endif
83 
84 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
85 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
86 
87 void
89 {
93 #if defined (DEFINEDIV)
95 #endif
96 #if defined (DEFINELDIV)
98 #endif
99 #if defined (DEFINENULLASSIGNCONV)
103 #endif
104 }
#define RMATRIX
Definition: op-cdm-cm.cc:34
#define LMATRIX
Definition: op-cdm-cm.cc:33
#define INST_NAME
#define OCTAVE_LDMATRIX
#define OCTAVE_LMATRIX
#define OCTAVE_RMATRIX
const octave_base_value & a2
const octave_char_matrix & v2
#define DEFBINOP(name, t1, t2)
Definition: ops.h:230
#define DEFBINOP_OP(name, t1, t2, op)
Definition: ops.h:235
#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_add(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1566
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1567
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
Matrix xdiv(const Matrix &a, const SparseMatrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:135
Matrix xleftdiv(const SparseMatrix &a, const Matrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:466