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 |
|
17 along with this program; see the file COPYING. If not, write to the Free |
|
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
19 |
|
20 */ |
|
21 |
|
22 #ifdef HAVE_CONFIG_H |
|
23 #include <config.h> |
|
24 #endif |
|
25 |
|
26 #include "gripes.h" |
|
27 #include "oct-obj.h" |
|
28 #include "ov.h" |
|
29 #include "ov-typeinfo.h" |
|
30 #include "ov-bool-mat.h" |
|
31 #include "boolMatrix.h" |
|
32 #include "ov-scalar.h" |
|
33 #include "ops.h" |
|
34 |
|
35 #include "ov-re-sparse.h" |
|
36 #include "smx-bm-sbm.h" |
|
37 #include "smx-sbm-bm.h" |
|
38 |
|
39 // sparse bool matrix by bool matrix ops. |
|
40 |
|
41 DEFBINOP_FN (eq, sparse_bool_matrix, bool_matrix, mx_el_eq) |
|
42 DEFBINOP_FN (ne, sparse_bool_matrix, bool_matrix, mx_el_ne) |
|
43 |
|
44 DEFBINOP_FN (el_and, sparse_bool_matrix, bool_matrix, mx_el_and) |
|
45 DEFBINOP_FN (el_or, sparse_bool_matrix, bool_matrix, mx_el_or) |
|
46 |
|
47 DEFCATOP (sbm_bm, sparse_bool_matrix, bool_matrix) |
|
48 { |
|
49 CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&); |
|
50 |
|
51 SparseBoolMatrix tmp (v2.bool_matrix_value ()); |
|
52 return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx)); |
|
53 } |
|
54 |
|
55 DEFCATOP (sbm_m, sparse_bool_matrix, matrix) |
|
56 { |
|
57 CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_matrix&); |
|
58 |
|
59 SparseMatrix tmp (v2.matrix_value ()); |
|
60 return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); |
|
61 } |
|
62 |
|
63 DEFCATOP (sm_bm, sparse_matrix, bool_matrix) |
|
64 { |
|
65 CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool_matrix&); |
|
66 |
|
67 SparseMatrix tmp (v2.matrix_value ()); |
|
68 return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); |
|
69 } |
|
70 |
|
71 DEFASSIGNOP (assign, sparse_bool_matrix, bool_matrix) |
|
72 { |
|
73 CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&); |
|
74 |
|
75 v1.assign (idx, SparseBoolMatrix (v2.bool_matrix_value ())); |
|
76 return octave_value (); |
|
77 } |
|
78 |
|
79 void |
|
80 install_sbm_bm_ops (void) |
|
81 { |
|
82 INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool_matrix, eq); |
|
83 INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool_matrix, ne); |
|
84 |
|
85 INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool_matrix, |
|
86 el_and); |
|
87 INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool_matrix, |
|
88 el_or); |
|
89 |
|
90 INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool_matrix, sbm_bm); |
|
91 INSTALL_CATOP (octave_sparse_matrix, octave_bool_matrix, sm_bm); |
|
92 INSTALL_CATOP (octave_sparse_bool_matrix, octave_matrix, sbm_m); |
|
93 |
|
94 INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, |
|
95 octave_bool_matrix, assign); |
|
96 } |
|
97 |
|
98 /* |
|
99 ;;; Local Variables: *** |
|
100 ;;; mode: C++ *** |
|
101 ;;; End: *** |
|
102 */ |