GNU Octave 7.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-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#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
45OCTAVE_NAMESPACE_BEGIN
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
56{
57 const OCTAVE_MATRIX& v1 = dynamic_cast<const OCTAVE_MATRIX&> (a1);
58 const OCTAVE_SCALAR& v2 = dynamic_cast<const OCTAVE_SCALAR&> (a2);
59
60 return v1.MATRIX_VALUE () / v2.SCALAR_VALUE ();
61}
62
64{
65 const OCTAVE_SCALAR& v1 = dynamic_cast<const OCTAVE_SCALAR&> (a1);
66 const OCTAVE_MATRIX& v2 = dynamic_cast<const OCTAVE_MATRIX&> (a2);
67
68 return v2.MATRIX_VALUE () / v1.SCALAR_VALUE ();
69}
70
72{
73 const OCTAVE_MATRIX& v1 = dynamic_cast<const OCTAVE_MATRIX&> (a1);
74 const OCTAVE_SCALAR& v2 = dynamic_cast<const OCTAVE_SCALAR&> (a2);
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
82void
83INST_NAME (octave::type_info& ti)
84{
90}
91
92OCTAVE_NAMESPACE_END
#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:274
#define DEFBINOP(name, t1, t2)
Definition: ops.h:228
#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_pow(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1870
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1868
octave_value xpow(const SparseMatrix &a, double b)
Definition: sparse-xpow.cc:62