Mercurial > hg > octave-lyh
annotate src/OPERATORS/op-bm-bm.cc @ 14846:460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Example: func() => func ()
* dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc,
funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h,
CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc,
CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc,
Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h,
SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc,
SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h,
SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc,
dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc,
dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc,
fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc,
fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc,
file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h,
lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc,
oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c,
sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc,
tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m,
what.m, getarchdir.m, install.m, installed_packages.m, repackage.m,
unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m,
plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m,
__marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m,
trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc,
__dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc,
bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc,
dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc,
lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc,
regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc,
op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc,
op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc,
op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc,
op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc,
op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc,
op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc,
op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc,
data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc,
graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h,
ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h,
oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc,
ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc,
ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc,
ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc,
ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc,
pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc,
toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m,
getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m,
getStash.m, myStash.m, fntests.m: Use Octave coding convention for
cuddled parenthis in function calls with empty argument lists.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 08 Jul 2012 11:28:50 -0700 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
2928 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2928 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2928 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2928 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include "gripes.h" | |
4055 | 28 #include "oct-obj.h" |
2928 | 29 #include "ov.h" |
30 #include "ov-bool-mat.h" | |
7105 | 31 #include "ov-scalar.h" |
5898 | 32 #include "ov-range.h" |
4915 | 33 #include "ov-re-mat.h" |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7105
diff
changeset
|
34 #include "ov-flt-re-mat.h" |
5898 | 35 #include "ov-re-sparse.h" |
36 #include "ov-str-mat.h" | |
37 #include "ov-int8.h" | |
38 #include "ov-int16.h" | |
39 #include "ov-int32.h" | |
40 #include "ov-int64.h" | |
41 #include "ov-uint8.h" | |
42 #include "ov-uint16.h" | |
43 #include "ov-uint32.h" | |
44 #include "ov-uint64.h" | |
2928 | 45 #include "ov-typeinfo.h" |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
46 #include "ov-null-mat.h" |
2928 | 47 #include "ops.h" |
48 #include "xdiv.h" | |
49 #include "xpow.h" | |
50 | |
3203 | 51 // unary bool matrix ops. |
52 | |
4550 | 53 DEFNDUNOP_OP (not, bool_matrix, bool_array, !) |
4965 | 54 DEFNDUNOP_OP (uplus, bool_matrix, array, +) |
55 DEFNDUNOP_OP (uminus, bool_matrix, array, -) | |
3203 | 56 |
9607
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9548
diff
changeset
|
57 DEFNCUNOP_METHOD (invert, bool_matrix, invert) |
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9548
diff
changeset
|
58 |
3203 | 59 DEFUNOP (transpose, bool_matrix) |
60 { | |
61 CAST_UNOP_ARG (const octave_bool_matrix&); | |
62 | |
4673 | 63 if (v.ndims () > 2) |
64 { | |
65 error ("transpose not defined for N-d objects"); | |
66 return octave_value (); | |
67 } | |
68 else | |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
69 return octave_value (v.bool_matrix_value ().transpose ()); |
3203 | 70 } |
71 | |
2928 | 72 // bool matrix by bool matrix ops. |
73 | |
4550 | 74 DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_eq) |
75 DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_ne) | |
2928 | 76 |
4669 | 77 DEFNDBINOP_FN (el_and, bool_matrix, bool_matrix, bool_array, bool_array, |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
78 mx_el_and) |
4669 | 79 |
80 DEFNDBINOP_FN (el_or, bool_matrix, bool_matrix, bool_array, bool_array, | |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
81 mx_el_or) |
4669 | 82 |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
83 DEFNDBINOP_FN (el_not_and, bool_matrix, bool_matrix, bool_array, bool_array, |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
84 mx_el_not_and) |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
85 |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
86 DEFNDBINOP_FN (el_not_or, bool_matrix, bool_matrix, bool_array, bool_array, |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
87 mx_el_not_or) |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
88 |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
89 DEFNDBINOP_FN (el_and_not, bool_matrix, bool_matrix, bool_array, bool_array, |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
90 mx_el_and_not) |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
91 |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
92 DEFNDBINOP_FN (el_or_not, bool_matrix, bool_matrix, bool_array, bool_array, |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
93 mx_el_or_not) |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
94 |
4964 | 95 DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, bool_array, bool_array, concat) |
4915 | 96 DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat) |
97 DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat) | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7105
diff
changeset
|
98 DEFNDCATOP_FN (bm_fm, bool_matrix, float_matrix, float_array, float_array, concat) |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7105
diff
changeset
|
99 DEFNDCATOP_FN (fm_bm, float_matrix, bool_matrix, float_array, float_array, concat) |
4915 | 100 |
4686 | 101 DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, bool_array, assign) |
9548
e5f7aee2ab8c
optimize &=, |= operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
102 DEFNDASSIGNOP_FNOP (assign_and, bool_matrix, bool_matrix, bool_array, mx_el_and_assign) |
e5f7aee2ab8c
optimize &=, |= operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
103 DEFNDASSIGNOP_FNOP (assign_or, bool_matrix, bool_matrix, bool_array, mx_el_or_assign) |
4669 | 104 |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
105 DEFNULLASSIGNOP_FN (null_assign, bool_matrix, delete_elements) |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
106 |
5898 | 107 static octave_value |
108 oct_assignop_conv_and_assign (octave_base_value& a1, | |
9931
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
109 const octave_value_list& idx, |
fb6b6fcafa62
untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents:
9607
diff
changeset
|
110 const octave_base_value& a2) |
5898 | 111 { |
112 octave_bool_matrix& v1 = dynamic_cast<octave_bool_matrix&> (a1); | |
113 | |
114 // FIXME -- perhaps add a warning for this conversion if the values | |
115 // are not all 0 or 1? | |
116 | |
5943 | 117 boolNDArray v2 = a2.bool_array_value (true); |
5898 | 118 |
119 if (! error_state) | |
120 v1.assign (idx, v2); | |
121 | |
122 return octave_value (); | |
123 } | |
124 | |
7105 | 125 DEFCONVFN (matrix_to_bool_matrix, matrix, bool) |
126 DEFCONVFN (scalar_to_bool_matrix, scalar, bool) | |
127 | |
2928 | 128 void |
129 install_bm_bm_ops (void) | |
130 { | |
3538 | 131 INSTALL_UNOP (op_not, octave_bool_matrix, not); |
4965 | 132 INSTALL_UNOP (op_uplus, octave_bool_matrix, uplus); |
133 INSTALL_UNOP (op_uminus, octave_bool_matrix, uminus); | |
3538 | 134 INSTALL_UNOP (op_transpose, octave_bool_matrix, transpose); |
135 INSTALL_UNOP (op_hermitian, octave_bool_matrix, transpose); | |
3203 | 136 |
9607
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9548
diff
changeset
|
137 INSTALL_NCUNOP (op_not, octave_bool_matrix, invert); |
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
9548
diff
changeset
|
138 |
3538 | 139 INSTALL_BINOP (op_eq, octave_bool_matrix, octave_bool_matrix, eq); |
140 INSTALL_BINOP (op_ne, octave_bool_matrix, octave_bool_matrix, ne); | |
4669 | 141 |
142 INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool_matrix, el_and); | |
143 INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool_matrix, el_or); | |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
144 INSTALL_BINOP (op_el_not_and, octave_bool_matrix, octave_bool_matrix, el_not_and); |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
145 INSTALL_BINOP (op_el_not_or, octave_bool_matrix, octave_bool_matrix, el_not_or); |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
146 INSTALL_BINOP (op_el_and_not, octave_bool_matrix, octave_bool_matrix, el_and_not); |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
147 INSTALL_BINOP (op_el_or_not, octave_bool_matrix, octave_bool_matrix, el_or_not); |
4669 | 148 |
4915 | 149 INSTALL_CATOP (octave_bool_matrix, octave_bool_matrix, bm_bm); |
150 INSTALL_CATOP (octave_bool_matrix, octave_matrix, bm_m); | |
151 INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm); | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7105
diff
changeset
|
152 INSTALL_CATOP (octave_bool_matrix, octave_float_matrix, bm_fm); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7105
diff
changeset
|
153 INSTALL_CATOP (octave_float_matrix, octave_bool_matrix, fm_bm); |
4915 | 154 |
7105 | 155 INSTALL_CONVOP (octave_matrix, octave_bool_matrix, matrix_to_bool_matrix); |
156 INSTALL_CONVOP (octave_scalar, octave_bool_matrix, scalar_to_bool_matrix); | |
157 | |
4669 | 158 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign); |
5898 | 159 |
160 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_matrix, conv_and_assign); | |
161 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_str, conv_and_assign); | |
162 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_sq_str, conv_and_assign); | |
163 | |
164 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_range, conv_and_assign); | |
165 | |
166 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_matrix, conv_and_assign); | |
167 | |
168 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int8_matrix, conv_and_assign); | |
169 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_matrix, conv_and_assign); | |
170 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_matrix, conv_and_assign); | |
171 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_matrix, conv_and_assign); | |
172 | |
173 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_matrix, conv_and_assign); | |
174 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_matrix, conv_and_assign); | |
175 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_matrix, conv_and_assign); | |
176 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_matrix, conv_and_assign); | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
177 |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
178 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_matrix, null_assign); |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
179 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_str, null_assign); |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
180 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_sq_str, null_assign); |
9548
e5f7aee2ab8c
optimize &=, |= operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
181 |
e5f7aee2ab8c
optimize &=, |= operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
182 INSTALL_ASSIGNOP (op_el_and_eq, octave_bool_matrix, octave_bool_matrix, assign_and); |
e5f7aee2ab8c
optimize &=, |= operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
183 INSTALL_ASSIGNOP (op_el_or_eq, octave_bool_matrix, octave_bool_matrix, assign_or); |
2928 | 184 } |