2928
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2004, 2005, 2007 |
|
4 John W. Eaton |
2928
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
2928
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
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.h" |
4964
|
32 #include "ov-bool-mat.h" |
4915
|
33 #include "ov-scalar.h" |
|
34 #include "ov-re-mat.h" |
2928
|
35 #include "ov-typeinfo.h" |
|
36 #include "ops.h" |
|
37 #include "xdiv.h" |
|
38 #include "xpow.h" |
|
39 |
3203
|
40 // bool unary ops. |
|
41 |
|
42 // scalar unary ops. |
|
43 |
|
44 DEFUNOP_OP (not, bool, !) |
4965
|
45 |
|
46 UNOPDECL (uplus, a) |
|
47 { |
|
48 CAST_UNOP_ARG (const octave_bool&); |
|
49 return octave_value (v.double_value ()); |
|
50 } |
|
51 |
|
52 UNOPDECL (uminus, a) |
|
53 { |
|
54 CAST_UNOP_ARG (const octave_bool&); |
|
55 return octave_value (- v.double_value ()); |
|
56 } |
|
57 |
3203
|
58 DEFUNOP_OP (transpose, bool, /* no-op */) |
|
59 DEFUNOP_OP (hermitian, bool, /* no-op */) |
|
60 |
2928
|
61 // bool by bool ops. |
|
62 |
|
63 DEFBINOP_OP (eq, bool, bool, ==) |
|
64 DEFBINOP_OP (ne, bool, bool, !=) |
3798
|
65 DEFBINOP_OP (el_and, bool, bool, &&) |
|
66 DEFBINOP_OP (el_or, bool, bool, ||) |
3797
|
67 |
4964
|
68 DEFNDCATOP_FN (b_b, bool, bool, bool_array, bool_array, concat) |
4915
|
69 DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat) |
|
70 DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat) |
|
71 |
2928
|
72 void |
|
73 install_b_b_ops (void) |
|
74 { |
3538
|
75 INSTALL_UNOP (op_not, octave_bool, not); |
4965
|
76 INSTALL_UNOP (op_uplus, octave_bool, uplus); |
|
77 INSTALL_UNOP (op_uminus, octave_bool, uminus); |
3538
|
78 INSTALL_UNOP (op_transpose, octave_bool, transpose); |
|
79 INSTALL_UNOP (op_hermitian, octave_bool, hermitian); |
3203
|
80 |
3538
|
81 INSTALL_BINOP (op_eq, octave_bool, octave_bool, eq); |
|
82 INSTALL_BINOP (op_ne, octave_bool, octave_bool, ne); |
3797
|
83 INSTALL_BINOP (op_el_and, octave_bool, octave_bool, el_and); |
|
84 INSTALL_BINOP (op_el_or, octave_bool, octave_bool, el_or); |
4915
|
85 |
|
86 INSTALL_CATOP (octave_bool, octave_bool, b_b); |
|
87 INSTALL_CATOP (octave_bool, octave_scalar, b_s); |
|
88 INSTALL_CATOP (octave_scalar, octave_bool, s_b); |
4964
|
89 |
|
90 INSTALL_ASSIGNCONV (octave_bool, octave_bool, octave_bool_matrix); |
2928
|
91 } |
|
92 |
|
93 /* |
|
94 ;;; Local Variables: *** |
|
95 ;;; mode: C++ *** |
|
96 ;;; End: *** |
|
97 */ |