GNU Octave  9.1.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-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 #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 
46 
49 
50 #define OCTAVE_MATRIX CONCAT2(octave_, MATRIX)
51 #define OCTAVE_SCALAR CONCAT2(octave_, SCALAR)
52 #define MATRIX_VALUE CONCAT2(MATRIXV, _value)
53 #define SCALAR_VALUE CONCAT2(SCALARV, _value)
54 
55 DEFBINOP (dmsdiv, MATRIX, SCALAR)
56 {
57  OCTAVE_CAST_BASE_VALUE (const OCTAVE_MATRIX&, v1, a1);
59 
60  return v1.MATRIX_VALUE () / v2.SCALAR_VALUE ();
61 }
62 
63 DEFBINOP (sdmldiv, SCALAR, MATRIX)
64 {
65  OCTAVE_CAST_BASE_VALUE (const OCTAVE_SCALAR&, v1, a1);
67 
68  return v2.MATRIX_VALUE () / v1.SCALAR_VALUE ();
69 }
70 
71 DEFBINOP (dmspow, MATRIX, SCALAR)
72 {
73  OCTAVE_CAST_BASE_VALUE (const OCTAVE_MATRIX&, v1, a1);
75 
76  return xpow (v1.MATRIX_VALUE (), v2.SCALAR_VALUE ());
77 }
78 
79 #define SHORT_NAME CONCAT3(MSHORT, _, SSHORT)
80 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
81 
82 void
83 INST_NAME (octave::type_info& ti)
84 {
90 }
91 
92 OCTAVE_END_NAMESPACE(octave)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#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:291
#define DEFBINOP(name, t1, t2)
Definition: ops.h:245
#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_pow(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1668
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1666
octave_value xpow(const SparseMatrix &a, double b)
Definition: sparse-xpow.cc:62