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