GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-dms-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 #include "ops.h"
31 #include "xpow.h"
32 #include SINCLUDE
33 #include MINCLUDE
34 
35 // matrix by diag matrix ops.
36 
37 #if ! defined (SCALARV)
38 # define SCALARV SCALAR
39 #endif
40 
41 #if ! defined (MATRIXV)
42 # define MATRIXV MATRIX
43 #endif
44 
47 
48 #define OCTAVE_MATRIX CONCAT2(octave_, MATRIX)
49 #define OCTAVE_SCALAR CONCAT2(octave_, SCALAR)
50 #define MATRIX_VALUE CONCAT2(MATRIXV, _value)
51 #define SCALAR_VALUE CONCAT2(SCALARV, _value)
52 
54 {
55  const OCTAVE_MATRIX& v1 = dynamic_cast<const OCTAVE_MATRIX&> (a1);
56  const OCTAVE_SCALAR& v2 = dynamic_cast<const OCTAVE_SCALAR&> (a2);
57 
58  return v1.MATRIX_VALUE () / v2.SCALAR_VALUE ();
59 }
60 
61 DEFBINOP (sdmldiv, SCALAR, MATRIX)
62 {
63  const OCTAVE_SCALAR& v1 = dynamic_cast<const OCTAVE_SCALAR&> (a1);
64  const OCTAVE_MATRIX& v2 = dynamic_cast<const OCTAVE_MATRIX&> (a2);
65 
66  return v2.MATRIX_VALUE () / v1.SCALAR_VALUE ();
67 }
68 
70 {
71  const OCTAVE_MATRIX& v1 = dynamic_cast<const OCTAVE_MATRIX&> (a1);
72  const OCTAVE_SCALAR& v2 = dynamic_cast<const OCTAVE_SCALAR&> (a2);
73 
74  return xpow (v1.MATRIX_VALUE (), v2.SCALAR_VALUE ());
75 }
76 
77 #define SHORT_NAME CONCAT3(MSHORT, _, SSHORT)
78 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
79 
80 void
82 {
88 }
#define SCALAR
Definition: op-cdm-cs.cc:29
#define MATRIX
Definition: op-cdm-cs.cc:30
#define INST_NAME
#define OCTAVE_MATRIX
#define MATRIXV
#define OCTAVE_SCALAR
#define SCALARV
const octave_base_value & a2
const octave_char_matrix & v2
#define DEFNDBINOP_OP(name, t1, t2, e1, e2, op)
Definition: ops.h:276
#define DEFBINOP(name, t1, t2)
Definition: ops.h:230
#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_pow(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1571
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1569
octave_value xpow(const SparseMatrix &a, double b)
Definition: sparse-xpow.cc:60