5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
7016
|
4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
|
5 |
|
6 This file is part of Octave. |
5164
|
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. |
5164
|
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/>. |
5164
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include <config.h> |
|
26 #endif |
|
27 |
|
28 #include "gripes.h" |
|
29 #include "oct-obj.h" |
|
30 #include "ov.h" |
|
31 #include "ov-typeinfo.h" |
|
32 #include "ov-bool-mat.h" |
|
33 #include "ov-scalar.h" |
|
34 #include "ops.h" |
|
35 |
|
36 #include "ov-re-sparse.h" |
|
37 #include "ov-bool-sparse.h" |
|
38 |
|
39 // unary sparse bool matrix ops. |
|
40 |
|
41 DEFUNOP_OP (not, sparse_bool_matrix, !) |
|
42 |
|
43 DEFUNOP (uplus, sparse_bool_matrix) |
|
44 { |
|
45 CAST_UNOP_ARG (const octave_sparse_bool_matrix&); |
|
46 return octave_value (v.sparse_matrix_value ()); |
|
47 } |
|
48 |
|
49 DEFUNOP (uminus, sparse_bool_matrix) |
|
50 { |
|
51 CAST_UNOP_ARG (const octave_sparse_bool_matrix&); |
|
52 return octave_value ( - v.sparse_matrix_value ()); |
|
53 } |
|
54 |
|
55 DEFUNOP (transpose, sparse_bool_matrix) |
|
56 { |
|
57 CAST_UNOP_ARG (const octave_sparse_bool_matrix&); |
|
58 return octave_value (v.sparse_bool_matrix_value().transpose ()); |
|
59 } |
|
60 |
|
61 // sparse bool matrix by sparse bool matrix ops. |
|
62 |
|
63 DEFBINOP_FN (eq, sparse_bool_matrix, sparse_bool_matrix, mx_el_eq) |
|
64 DEFBINOP_FN (ne, sparse_bool_matrix, sparse_bool_matrix, mx_el_ne) |
|
65 DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and) |
|
66 DEFBINOP_FN (el_or, sparse_bool_matrix, sparse_bool_matrix, mx_el_or) |
|
67 |
|
68 DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix, |
|
69 sparse_bool_matrix, sparse_bool_matrix, concat) |
|
70 DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix, |
|
71 sparse_matrix, concat) |
|
72 DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix, |
|
73 sparse_matrix, concat) |
|
74 |
|
75 DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix, |
|
76 assign) |
|
77 |
7004
|
78 CONVDECL (bool_matrix_to_double_matrix) |
|
79 { |
|
80 CAST_CONV_ARG (const octave_sparse_bool_matrix&); |
|
81 |
|
82 return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ())); |
|
83 } |
|
84 |
|
85 DEFDBLCONVFN (, sparse_bool_matrix, bool_array) |
|
86 |
5164
|
87 void |
|
88 install_sbm_sbm_ops (void) |
|
89 { |
|
90 INSTALL_UNOP (op_not, octave_sparse_bool_matrix, not); |
|
91 INSTALL_UNOP (op_uplus, octave_sparse_bool_matrix, uplus); |
|
92 INSTALL_UNOP (op_uminus, octave_sparse_bool_matrix, uminus); |
|
93 INSTALL_UNOP (op_transpose, octave_sparse_bool_matrix, transpose); |
|
94 INSTALL_UNOP (op_hermitian, octave_sparse_bool_matrix, transpose); |
|
95 |
|
96 INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, |
|
97 octave_sparse_bool_matrix, eq); |
|
98 INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, |
|
99 octave_sparse_bool_matrix, ne); |
|
100 |
|
101 INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, |
|
102 octave_sparse_bool_matrix, el_and); |
|
103 INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, |
|
104 octave_sparse_bool_matrix, el_or); |
|
105 |
|
106 INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix, |
|
107 sbm_sbm); |
|
108 INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_matrix, sbm_sm); |
|
109 INSTALL_CATOP (octave_sparse_matrix, octave_sparse_bool_matrix, sm_sbm); |
|
110 |
|
111 INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, |
7004
|
112 octave_sparse_bool_matrix, assign); |
|
113 |
|
114 INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix, |
|
115 bool_matrix_to_double_matrix); |
5164
|
116 } |
|
117 |
|
118 /* |
|
119 ;;; Local Variables: *** |
|
120 ;;; mode: C++ *** |
|
121 ;;; End: *** |
|
122 */ |