GNU Octave  9.1.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-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 // 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 
43 
44 // matrix by diag matrix ops.
45 
46 DEFBINOP_OP (add, LMATRIX, RMATRIX, +)
47 DEFBINOP_OP (sub, LMATRIX, RMATRIX, -)
48 DEFBINOP_OP (mul, LMATRIX, RMATRIX, *)
49 
50 #if ! defined (LDMATRIX)
51 # define LDMATRIX LMATRIX
52 #endif
53 
54 #if ! defined (RDMATRIX)
55 # define RDMATRIX RMATRIX
56 #endif
57 
58 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
59 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
60 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
61 #define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
62 #define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
63 #define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
64 #define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
65 
66 #if defined (DEFINEDIV)
67 DEFBINOP (div, LMATRIX, RMATRIX)
68 {
69  OCTAVE_CAST_BASE_VALUE (const OCTAVE_LMATRIX&, v1, a1);
71 
72  return xdiv (v1.LDMATRIX_VALUE (), v2.RMATRIX_VALUE ());
73 }
74 #endif
75 
76 #if defined (DEFINELDIV)
77 DEFBINOP (ldiv, LMATRIX, RMATRIX)
78 {
79  OCTAVE_CAST_BASE_VALUE (const OCTAVE_LMATRIX&, v1, a1);
81 
82  return xleftdiv (v1.LMATRIX_VALUE (), v2.RDMATRIX_VALUE ());
83 }
84 #endif
85 
86 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
87 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
88 
89 void
90 INST_NAME (octave::type_info& ti)
91 {
95 #if defined (DEFINEDIV)
97 #endif
98 #if defined (DEFINELDIV)
100 #endif
101 #if defined (DEFINENULLASSIGNCONV)
105 #endif
106 }
107 
108 OCTAVE_END_NAMESPACE(octave)
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
#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:245
#define DEFBINOP_OP(name, t1, t2, op)
Definition: ops.h:250
#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_add(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1663
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1664
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
Matrix xdiv(const Matrix &a, const SparseMatrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:137
Matrix xleftdiv(const SparseMatrix &a, const Matrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:469