GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
libinterp
operators
op-dm-template.cc
Go to the documentation of this file.
1
/*
2
3
Copyright (C) 2008-2013 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
#ifdef HAVE_CONFIG_H
24
#include <config.h>
25
#endif
26
27
#include "
ops.h
"
28
#include "
xdiv.h
"
29
#include LINCLUDE
30
#include RINCLUDE
31
#ifdef DEFINENULLASSIGNCONV
32
#include "
ov-null-mat.h
"
33
#endif
34
35
// matrix by diag matrix ops.
36
37
DEFBINOP_OP
(add,
LMATRIX
,
RMATRIX
, +)
38
DEFBINOP_OP
(sub,
LMATRIX
,
RMATRIX
, -)
39
DEFBINOP_OP
(mul, LMATRIX, RMATRIX, *)
40
41
#ifndef LDMATRIX
42
#define LDMATRIX LMATRIX
43
#endif
44
45
#ifndef RDMATRIX
46
#define RDMATRIX RMATRIX
47
#endif
48
49
#define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
50
#define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
51
#define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
52
#define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
53
#define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
54
#define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
55
#define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
56
57
#ifdef DEFINEDIV
58
DEFBINOP
(div, LMATRIX, RMATRIX)
59
{
60
CAST_BINOP_ARGS
(
const
OCTAVE_LMATRIX
&,
const
OCTAVE_RMATRIX
&);
61
62
return
xdiv
(
v1
.LDMATRIX_VALUE (),
v2
.RMATRIX_VALUE ());
63
}
64
#endif
65
66
#ifdef DEFINELDIV
67
DEFBINOP
(ldiv, LMATRIX, RMATRIX)
68
{
69
CAST_BINOP_ARGS
(
const
OCTAVE_LMATRIX
&,
const
OCTAVE_RMATRIX
&);
70
71
return
xleftdiv
(
v1
.LMATRIX_VALUE (),
v2
.RDMATRIX_VALUE ());
72
}
73
#endif
74
75
#define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
76
#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
77
78
void
79
INST_NAME
(
void
)
80
{
81
INSTALL_BINOP
(
op_add
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, add);
82
INSTALL_BINOP
(
op_sub
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, sub);
83
INSTALL_BINOP
(
op_mul
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, mul);
84
#ifdef DEFINEDIV
85
INSTALL_BINOP
(
op_div
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, div);
86
#endif
87
#ifdef DEFINELDIV
88
INSTALL_BINOP
(
op_ldiv
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, ldiv);
89
#endif
90
#ifdef DEFINENULLASSIGNCONV
91
INSTALL_ASSIGNCONV
(
OCTAVE_LMATRIX
,
octave_null_matrix
,
OCTAVE_LDMATRIX
);
92
INSTALL_ASSIGNCONV
(
OCTAVE_LMATRIX
,
octave_null_str
,
OCTAVE_LDMATRIX
);
93
INSTALL_ASSIGNCONV
(
OCTAVE_LMATRIX
,
octave_null_sq_str
,
OCTAVE_LDMATRIX
);
94
#endif
95
}
Generated on Mon Dec 30 2013 03:04:35 for GNU Octave by
1.8.1.2