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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
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" |
4915
|
31 #include "ov-re-mat.h" |
2928
|
32 #include "ov-typeinfo.h" |
|
33 #include "ops.h" |
|
34 #include "xdiv.h" |
|
35 #include "xpow.h" |
|
36 |
3203
|
37 // unary bool matrix ops. |
|
38 |
4550
|
39 DEFNDUNOP_OP (not, bool_matrix, bool_array, !) |
4965
|
40 DEFNDUNOP_OP (uplus, bool_matrix, array, +) |
|
41 DEFNDUNOP_OP (uminus, bool_matrix, array, -) |
3203
|
42 |
|
43 DEFUNOP (transpose, bool_matrix) |
|
44 { |
|
45 CAST_UNOP_ARG (const octave_bool_matrix&); |
|
46 |
4673
|
47 if (v.ndims () > 2) |
|
48 { |
|
49 error ("transpose not defined for N-d objects"); |
|
50 return octave_value (); |
|
51 } |
|
52 else |
|
53 return octave_value (v.bool_matrix_value().transpose ()); |
3203
|
54 } |
|
55 |
2928
|
56 // bool matrix by bool matrix ops. |
|
57 |
4550
|
58 DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_eq) |
|
59 DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_ne) |
2928
|
60 |
4669
|
61 DEFNDBINOP_FN (el_and, bool_matrix, bool_matrix, bool_array, bool_array, |
|
62 mx_el_and) |
|
63 |
|
64 DEFNDBINOP_FN (el_or, bool_matrix, bool_matrix, bool_array, bool_array, |
|
65 mx_el_or) |
|
66 |
4964
|
67 DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, bool_array, bool_array, concat) |
4915
|
68 DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat) |
|
69 DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat) |
|
70 |
4686
|
71 DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, bool_array, assign) |
4669
|
72 |
2928
|
73 void |
|
74 install_bm_bm_ops (void) |
|
75 { |
3538
|
76 INSTALL_UNOP (op_not, octave_bool_matrix, not); |
4965
|
77 INSTALL_UNOP (op_uplus, octave_bool_matrix, uplus); |
|
78 INSTALL_UNOP (op_uminus, octave_bool_matrix, uminus); |
3538
|
79 INSTALL_UNOP (op_transpose, octave_bool_matrix, transpose); |
|
80 INSTALL_UNOP (op_hermitian, octave_bool_matrix, transpose); |
3203
|
81 |
3538
|
82 INSTALL_BINOP (op_eq, octave_bool_matrix, octave_bool_matrix, eq); |
|
83 INSTALL_BINOP (op_ne, octave_bool_matrix, octave_bool_matrix, ne); |
4669
|
84 |
|
85 INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool_matrix, el_and); |
|
86 INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool_matrix, el_or); |
|
87 |
4915
|
88 INSTALL_CATOP (octave_bool_matrix, octave_bool_matrix, bm_bm); |
|
89 INSTALL_CATOP (octave_bool_matrix, octave_matrix, bm_m); |
|
90 INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm); |
|
91 |
4669
|
92 INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign); |
2928
|
93 } |
|
94 |
|
95 /* |
|
96 ;;; Local Variables: *** |
|
97 ;;; mode: C++ *** |
|
98 ;;; End: *** |
|
99 */ |