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-pm-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 "
ov-perm.h
"
28
#include MINCLUDE
29
#include "
ops.h
"
30
#ifdef DEFINENULLASSIGNCONV
31
#include "
ov-null-mat.h
"
32
#endif
33
34
#ifndef LDMATRIX
35
#define LDMATRIX LMATRIX
36
#endif
37
38
#define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
39
#define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
40
#define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
41
#ifdef LEFT
42
#define LMATRIX_VALUE perm_matrix_value
43
#define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
44
#else
45
#define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
46
#define RMATRIX_VALUE perm_matrix_value
47
#endif
48
49
DEFBINOP
(mul,
LMATRIX
,
RMATRIX
)
50
{
51
CAST_BINOP_ARGS
(
const
OCTAVE_LMATRIX
&,
const
OCTAVE_RMATRIX
&);
52
53
return
v1
.LMATRIX_VALUE () *
v2
.RMATRIX_VALUE ();
54
}
55
56
#ifdef LEFT
57
DEFBINOP
(ldiv,
LMATRIX
,
RMATRIX
)
58
{
59
CAST_BINOP_ARGS
(
const
OCTAVE_LMATRIX
&,
const
OCTAVE_RMATRIX
&);
60
61
return
v1
.
perm_matrix_value
().
inverse
() *
v2
.RMATRIX_VALUE ();
62
}
63
#else
64
DEFBINOP
(div,
LMATRIX
,
RMATRIX
)
65
{
66
CAST_BINOP_ARGS
(
const
OCTAVE_LMATRIX
&,
const
OCTAVE_RMATRIX
&);
67
68
return
v1
.LMATRIX_VALUE () *
v2
.
perm_matrix_value
().
inverse
();
69
}
70
#endif
71
72
73
#define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
74
#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
75
76
void
77
INST_NAME
(
void
)
78
{
79
INSTALL_BINOP
(
op_mul
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, mul);
80
#ifdef LEFT
81
INSTALL_BINOP
(
op_ldiv
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, ldiv);
82
#else
83
INSTALL_BINOP
(
op_div
,
OCTAVE_LMATRIX
,
OCTAVE_RMATRIX
, div);
84
#endif
85
#ifdef DEFINENULLASSIGNCONV
86
INSTALL_ASSIGNCONV
(
OCTAVE_LMATRIX
,
octave_null_matrix
,
OCTAVE_LDMATRIX
);
87
INSTALL_ASSIGNCONV
(
OCTAVE_LMATRIX
,
octave_null_str
,
OCTAVE_LDMATRIX
);
88
INSTALL_ASSIGNCONV
(
OCTAVE_LMATRIX
,
octave_null_sq_str
,
OCTAVE_LDMATRIX
);
89
#endif
90
}
Generated on Mon Dec 30 2013 03:04:36 for GNU Octave by
1.8.1.2