GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
op-dm-template.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2008-2017 Jaroslav Hajek
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 // This file should not include config.h. It is only included in other
24 // C++ source files that should have included config.h before including
25 // this file.
26 
27 // FIXME: it might be nice to only include the declarations of the
28 // operators that are actually needed instead of including all of them.
29 #include "mx-ops.h"
30 
31 #include "ops.h"
32 #include "xdiv.h"
33 #include LINCLUDE
34 #include RINCLUDE
35 #if defined (DEFINENULLASSIGNCONV)
36 # include "ov-null-mat.h"
37 #endif
38 
39 // matrix by diag matrix ops.
40 
43 DEFBINOP_OP (mul, LMATRIX, RMATRIX, *)
44 
45 #if ! defined (LDMATRIX)
46 # define LDMATRIX LMATRIX
47 #endif
48 
49 #if ! defined (RDMATRIX)
50 # define RDMATRIX RMATRIX
51 #endif
52 
53 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
54 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
55 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
56 #define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
57 #define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
58 #define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
59 #define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
60 
61 #if defined (DEFINEDIV)
62 DEFBINOP (div, LMATRIX, RMATRIX)
63 {
64  const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
65  const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
66 
67  return xdiv (v1.LDMATRIX_VALUE (), v2.RMATRIX_VALUE ());
68 }
69 #endif
70 
71 #if defined (DEFINELDIV)
72 DEFBINOP (ldiv, LMATRIX, RMATRIX)
73 {
74  const OCTAVE_LMATRIX& v1 = dynamic_cast<const OCTAVE_LMATRIX&> (a1);
75  const OCTAVE_RMATRIX& v2 = dynamic_cast<const OCTAVE_RMATRIX&> (a2);
76 
77  return xleftdiv (v1.LMATRIX_VALUE (), v2.RDMATRIX_VALUE ());
78 }
79 #endif
80 
81 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
82 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
83 
84 void
85 INST_NAME (void)
86 {
90 #if defined (DEFINEDIV)
92 #endif
93 #if defined (DEFINELDIV)
95 #endif
96 #if defined (DEFINENULLASSIGNCONV)
100 #endif
101 }
#define DEFBINOP(name, t1, t2)
Definition: ops.h:223
#define OCTAVE_LMATRIX
#define RMATRIX
Definition: op-cdm-cm.cc:31
#define LMATRIX
Definition: op-cdm-cm.cc:30
#define DEFBINOP_OP(name, t1, t2, op)
Definition: ops.h:228
const octave_base_value & a2
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1517
#define INSTALL_BINOP(op, t1, t2, f)
Definition: ops.h:48
Matrix xleftdiv(const SparseMatrix &a, const Matrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:464
#define INST_NAME
#define OCTAVE_LDMATRIX
const octave_char_matrix & v2
Matrix xdiv(const Matrix &a, const SparseMatrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:133
octave_value op_add(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1514
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1520
#define OCTAVE_RMATRIX
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1515
#define INSTALL_ASSIGNCONV(t1, t2, tr)
Definition: ops.h:66
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1516