annotate libinterp/operators/op-pm-template.cc @ 19269:65554f5847ac

don't include oct-locbuf.h in header files unnecessarily * oct-stream.h: Don't include oct-locbuf.h. * Sparse-op-decls.h: New file. * module.mk (OPERATORS_INC): Include it in the list. * Sparse-op-defs.h: Move decls to Sparse-op-decls.h. * CSparse.h, boolSparse.h, dSparse.h: Include Sparse-op-decls.h instead of Sparse-op-defs.h. * help.cc, oct-map.cc, oct-stream.cc, quadcc.cc, strfind.cc, sub2ind.cc, utils.cc, xpow.cc, __delaunayn__.cc, __ichol__.cc, __ilu__.cc, __voronoi__.cc, convhulln.cc, ov-base-mat.cc, op-dm-scm.cc, op-dm-template.cc, op-fcm-fs.cc, op-fcs-fm.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-pm-template.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, pt-mat.cc, CMatrix.cc, CNDArray.cc, CSparse.cc, MatrixType.cc, boolMatrix.cc, boolNDArray.cc, boolSparse.cc, dMatrix.cc, dSparse.cc, fCMatrix.cc, fCNDArray.cc, fMatrix.cc, eigs-base.cc, oct-norm.cc, sparse-base-lu.cc, * mx-op-defs.h: Update list of include files accordingly. * sparse-mk-ops.awk: Update emitted list of include files accordingly.
author John W. Eaton <jwe@octave.org>
date Sun, 19 Oct 2014 08:42:58 -0400
parents d63878346099
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
1 /*
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
3 Copyright (C) 2008-2013 Jaroslav Hajek
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
4
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
5 This file is part of Octave.
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
6
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
10 option) any later version.
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
11
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
15 for more details.
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
16
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
20
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
21 */
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
22
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
24 #include <config.h>
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
25 #endif
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
26
19269
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
27 // FIXME: it might be nice to only include the declarations of the
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
28 // operators that are actually needed instead of including all of them.
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
29 #include "mx-ops.h"
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
30
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
31 #include "ov-perm.h"
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
32 #include MINCLUDE
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33 #include "ops.h"
9499
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
34 #ifdef DEFINENULLASSIGNCONV
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
35 #include "ov-null-mat.h"
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
36 #endif
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
37
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
38 #ifndef LDMATRIX
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
39 #define LDMATRIX LMATRIX
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
40 #endif
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
41
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
42 #define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
9499
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
43 #define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
44 #define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
45 #ifdef LEFT
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
46 #define LMATRIX_VALUE perm_matrix_value
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
47 #define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
48 #else
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
49 #define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
50 #define RMATRIX_VALUE perm_matrix_value
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
51 #endif
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
52
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
53 DEFBINOP (mul, LMATRIX, RMATRIX)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
54 {
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
55 CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
56
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
57 return v1.LMATRIX_VALUE () * v2.RMATRIX_VALUE ();
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
58 }
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
59
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
60 #ifdef LEFT
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
61 DEFBINOP (ldiv, LMATRIX, RMATRIX)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
62 {
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
63 CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
64
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
65 return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE ();
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
66 }
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
67 #else
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
68 DEFBINOP (div, LMATRIX, RMATRIX)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
69 {
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
70 CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
71
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
72 return v1.LMATRIX_VALUE () * v2.perm_matrix_value ().inverse ();
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
73 }
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
74 #endif
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
75
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
76
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
77 #define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
78 #define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
79
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
80 void
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
81 INST_NAME (void)
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
82 {
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
83 INSTALL_BINOP (op_mul, OCTAVE_LMATRIX, OCTAVE_RMATRIX, mul);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
84 #ifdef LEFT
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
85 INSTALL_BINOP (op_ldiv, OCTAVE_LMATRIX, OCTAVE_RMATRIX, ldiv);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
86 #else
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
87 INSTALL_BINOP (op_div, OCTAVE_LMATRIX, OCTAVE_RMATRIX, div);
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
88 #endif
9499
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
89 #ifdef DEFINENULLASSIGNCONV
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
90 INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_matrix, OCTAVE_LDMATRIX);
9503
edc657b9ec8a complete change d5570d4b1116
Jaroslav Hajek <highegg@gmail.com>
parents: 9499
diff changeset
91 INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_str, OCTAVE_LDMATRIX);
edc657b9ec8a complete change d5570d4b1116
Jaroslav Hajek <highegg@gmail.com>
parents: 9499
diff changeset
92 INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_sq_str, OCTAVE_LDMATRIX);
9499
d5570d4b1116 handle null matrix assignment for diagonal and permutation matrices
John W. Eaton <jwe@octave.org>
parents: 8960
diff changeset
93 #endif
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
94 }