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 "boolMatrix.h" |
|
33 #include "ov-scalar.h" |
|
34 #include "ops.h" |
|
35 |
|
36 #include "ov-re-sparse.h" |
|
37 #include "smx-bm-sbm.h" |
|
38 #include "smx-sbm-bm.h" |
|
39 |
|
40 // sparse bool matrix by bool matrix ops. |
|
41 |
|
42 DEFBINOP_FN (eq, sparse_bool_matrix, bool_matrix, mx_el_eq) |
|
43 DEFBINOP_FN (ne, sparse_bool_matrix, bool_matrix, mx_el_ne) |
|
44 |
|
45 DEFBINOP_FN (el_and, sparse_bool_matrix, bool_matrix, mx_el_and) |
|
46 DEFBINOP_FN (el_or, sparse_bool_matrix, bool_matrix, mx_el_or) |
|
47 |
|
48 DEFCATOP (sbm_bm, sparse_bool_matrix, bool_matrix) |
|
49 { |
|
50 CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&); |
|
51 |
|
52 SparseBoolMatrix tmp (v2.bool_matrix_value ()); |
|
53 return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx)); |
|
54 } |
|
55 |
|
56 DEFCATOP (sbm_m, sparse_bool_matrix, matrix) |
|
57 { |
|
58 CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_matrix&); |
|
59 |
|
60 SparseMatrix tmp (v2.matrix_value ()); |
|
61 return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); |
|
62 } |
|
63 |
|
64 DEFCATOP (sm_bm, sparse_matrix, bool_matrix) |
|
65 { |
|
66 CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool_matrix&); |
|
67 |
|
68 SparseMatrix tmp (v2.matrix_value ()); |
|
69 return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); |
|
70 } |
|
71 |
|
72 DEFASSIGNOP (assign, sparse_bool_matrix, bool_matrix) |
|
73 { |
|
74 CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&); |
|
75 |
|
76 v1.assign (idx, SparseBoolMatrix (v2.bool_matrix_value ())); |
|
77 return octave_value (); |
|
78 } |
|
79 |
|
80 void |
|
81 install_sbm_bm_ops (void) |
|
82 { |
|
83 INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool_matrix, eq); |
|
84 INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool_matrix, ne); |
|
85 |
|
86 INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool_matrix, |
|
87 el_and); |
|
88 INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool_matrix, |
|
89 el_or); |
|
90 |
|
91 INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool_matrix, sbm_bm); |
|
92 INSTALL_CATOP (octave_sparse_matrix, octave_bool_matrix, sm_bm); |
|
93 INSTALL_CATOP (octave_sparse_bool_matrix, octave_matrix, sbm_m); |
|
94 |
|
95 INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, |
|
96 octave_bool_matrix, assign); |
|
97 } |
|
98 |
|
99 /* |
|
100 ;;; Local Variables: *** |
|
101 ;;; mode: C++ *** |
|
102 ;;; End: *** |
|
103 */ |