2928
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
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 2, or (at your option) any |
|
10 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, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2928
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include <config.h> |
|
26 #endif |
|
27 |
|
28 #include "gripes.h" |
4055
|
29 #include "oct-obj.h" |
2928
|
30 #include "ov.h" |
|
31 #include "ov-bool-mat.h" |
4915
|
32 #include "ov-re-mat.h" |
2928
|
33 #include "ov-typeinfo.h" |
|
34 #include "ops.h" |
|
35 #include "xdiv.h" |
|
36 #include "xpow.h" |
|
37 |
3203
|
38 // unary bool matrix ops. |
|
39 |
4550
|
40 DEFNDUNOP_OP (not, bool_matrix, bool_array, !) |
4965
|
41 DEFNDUNOP_OP (uplus, bool_matrix, array, +) |
|
42 DEFNDUNOP_OP (uminus, bool_matrix, array, -) |
3203
|
43 |
|
44 DEFUNOP (transpose, bool_matrix) |
|
45 { |
|
46 CAST_UNOP_ARG (const octave_bool_matrix&); |
|
47 |
4673
|
48 if (v.ndims () > 2) |
|
49 { |
|
50 error ("transpose not defined for N-d objects"); |
|
51 return octave_value (); |
|
52 } |
|
53 else |
|
54 return octave_value (v.bool_matrix_value().transpose ()); |
3203
|
55 } |
|
56 |
2928
|
57 // bool matrix by bool matrix ops. |
|
58 |
4550
|
59 DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_eq) |
|
60 DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_ne) |
2928
|
61 |
4669
|
62 DEFNDBINOP_FN (el_and, bool_matrix, bool_matrix, bool_array, bool_array, |
|
63 mx_el_and) |
|
64 |
|
65 DEFNDBINOP_FN (el_or, bool_matrix, bool_matrix, bool_array, bool_array, |
|
66 mx_el_or) |
|
67 |
4964
|
68 DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, bool_array, bool_array, concat) |
4915
|
69 DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat) |
|
70 DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat) |
|
71 |
4686
|
72 DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, bool_array, assign) |
4669
|
73 |
2928
|
74 void |
|
75 install_bm_bm_ops (void) |
|
76 { |
3538
|
77 INSTALL_UNOP (op_not, octave_bool_matrix, not); |
4965
|
78 INSTALL_UNOP (op_uplus, octave_bool_matrix, uplus); |
|
79 INSTALL_UNOP (op_uminus, octave_bool_matrix, uminus); |
3538
|
80 INSTALL_UNOP (op_transpose, octave_bool_matrix, transpose); |
|
81 INSTALL_UNOP (op_hermitian, octave_bool_matrix, transpose); |
3203
|
82 |
3538
|
83 INSTALL_BINOP (op_eq, octave_bool_matrix, octave_bool_matrix, eq); |
|
84 INSTALL_BINOP (op_ne, octave_bool_matrix, octave_bool_matrix, ne); |
4669
|
85 |
|
86 INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool_matrix, el_and); |
|
87 INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool_matrix, el_or); |
|
88 |
4915
|
89 INSTALL_CATOP (octave_bool_matrix, octave_bool_matrix, bm_bm); |
|
90 INSTALL_CATOP (octave_bool_matrix, octave_matrix, bm_m); |
|
91 INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm); |
|
92 |
4669
|
93 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign); |
2928
|
94 } |
|
95 |
|
96 /* |
|
97 ;;; Local Variables: *** |
|
98 ;;; mode: C++ *** |
|
99 ;;; End: *** |
|
100 */ |