5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include "gripes.h" |
|
28 #include "oct-obj.h" |
|
29 #include "ov.h" |
|
30 #include "ov-typeinfo.h" |
|
31 #include "ov-bool-mat.h" |
|
32 #include "ov-scalar.h" |
|
33 #include "ops.h" |
|
34 |
|
35 #include "ov-re-sparse.h" |
|
36 #include "ov-bool-sparse.h" |
|
37 |
|
38 // unary sparse bool matrix ops. |
|
39 |
|
40 DEFUNOP_OP (not, sparse_bool_matrix, !) |
|
41 |
|
42 DEFUNOP (uplus, sparse_bool_matrix) |
|
43 { |
|
44 CAST_UNOP_ARG (const octave_sparse_bool_matrix&); |
|
45 return octave_value (v.sparse_matrix_value ()); |
|
46 } |
|
47 |
|
48 DEFUNOP (uminus, sparse_bool_matrix) |
|
49 { |
|
50 CAST_UNOP_ARG (const octave_sparse_bool_matrix&); |
|
51 return octave_value ( - v.sparse_matrix_value ()); |
|
52 } |
|
53 |
|
54 DEFUNOP (transpose, sparse_bool_matrix) |
|
55 { |
|
56 CAST_UNOP_ARG (const octave_sparse_bool_matrix&); |
|
57 return octave_value (v.sparse_bool_matrix_value().transpose ()); |
|
58 } |
|
59 |
|
60 // sparse bool matrix by sparse bool matrix ops. |
|
61 |
|
62 DEFBINOP_FN (eq, sparse_bool_matrix, sparse_bool_matrix, mx_el_eq) |
|
63 DEFBINOP_FN (ne, sparse_bool_matrix, sparse_bool_matrix, mx_el_ne) |
|
64 DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and) |
|
65 DEFBINOP_FN (el_or, sparse_bool_matrix, sparse_bool_matrix, mx_el_or) |
|
66 |
|
67 DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix, |
|
68 sparse_bool_matrix, sparse_bool_matrix, concat) |
|
69 DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix, |
|
70 sparse_matrix, concat) |
|
71 DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix, |
|
72 sparse_matrix, concat) |
|
73 |
|
74 DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix, |
|
75 assign) |
|
76 |
7004
|
77 CONVDECL (bool_matrix_to_double_matrix) |
|
78 { |
|
79 CAST_CONV_ARG (const octave_sparse_bool_matrix&); |
|
80 |
|
81 return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ())); |
|
82 } |
|
83 |
|
84 DEFDBLCONVFN (, sparse_bool_matrix, bool_array) |
|
85 |
5164
|
86 void |
|
87 install_sbm_sbm_ops (void) |
|
88 { |
|
89 INSTALL_UNOP (op_not, octave_sparse_bool_matrix, not); |
|
90 INSTALL_UNOP (op_uplus, octave_sparse_bool_matrix, uplus); |
|
91 INSTALL_UNOP (op_uminus, octave_sparse_bool_matrix, uminus); |
|
92 INSTALL_UNOP (op_transpose, octave_sparse_bool_matrix, transpose); |
|
93 INSTALL_UNOP (op_hermitian, octave_sparse_bool_matrix, transpose); |
|
94 |
|
95 INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, |
|
96 octave_sparse_bool_matrix, eq); |
|
97 INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, |
|
98 octave_sparse_bool_matrix, ne); |
|
99 |
|
100 INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, |
|
101 octave_sparse_bool_matrix, el_and); |
|
102 INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, |
|
103 octave_sparse_bool_matrix, el_or); |
|
104 |
|
105 INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix, |
|
106 sbm_sbm); |
|
107 INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_matrix, sbm_sm); |
|
108 INSTALL_CATOP (octave_sparse_matrix, octave_sparse_bool_matrix, sm_sbm); |
|
109 |
|
110 INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, |
7004
|
111 octave_sparse_bool_matrix, assign); |
|
112 |
|
113 INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix, |
|
114 bool_matrix_to_double_matrix); |
5164
|
115 } |
|
116 |
|
117 /* |
|
118 ;;; Local Variables: *** |
|
119 ;;; mode: C++ *** |
|
120 ;;; End: *** |
|
121 */ |