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 // bool matrix by sparse bool matrix ops. |
|
41 |
|
42 DEFBINOP_FN (eq, bool_matrix, sparse_bool_matrix, mx_el_eq) |
|
43 DEFBINOP_FN (ne, bool_matrix, sparse_bool_matrix, mx_el_ne) |
|
44 |
|
45 DEFBINOP_FN (el_and, bool_matrix, sparse_bool_matrix, mx_el_and) |
|
46 DEFBINOP_FN (el_or, bool_matrix, sparse_bool_matrix, mx_el_or) |
|
47 |
|
48 DEFCATOP (bm_sbm, bool_matrix, sparse_bool_matrix) |
|
49 { |
|
50 CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_bool_matrix&); |
|
51 SparseBoolMatrix tmp (v1.bool_matrix_value ()); |
|
52 return octave_value (tmp. concat (v2.sparse_bool_matrix_value (), |
|
53 ra_idx)); |
|
54 } |
|
55 |
|
56 DEFCATOP (m_sbm, matrix, sparse_bool_matrix) |
|
57 { |
|
58 CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_bool_matrix&); |
|
59 SparseMatrix tmp (v1.matrix_value ()); |
|
60 return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx)); |
|
61 } |
|
62 |
|
63 DEFCATOP (bm_sm, bool_matrix, sparse_matrix) |
|
64 { |
|
65 CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_matrix&); |
|
66 SparseMatrix tmp (v1.matrix_value ()); |
|
67 return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx)); |
|
68 } |
|
69 |
|
70 DEFCONV (sparse_bool_matrix_conv, bool_matrix, sparse_bool_matrix) |
|
71 { |
|
72 CAST_CONV_ARG (const octave_bool_matrix&); |
|
73 return new octave_sparse_bool_matrix |
|
74 (SparseBoolMatrix (v.bool_matrix_value ())); |
|
75 } |
|
76 |
|
77 void |
|
78 install_bm_sbm_ops (void) |
|
79 { |
|
80 INSTALL_BINOP (op_eq, octave_bool_matrix, octave_sparse_bool_matrix, eq); |
|
81 INSTALL_BINOP (op_ne, octave_bool_matrix, octave_sparse_bool_matrix, ne); |
|
82 |
|
83 INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_sparse_bool_matrix, |
|
84 el_and); |
|
85 INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_sparse_bool_matrix, |
|
86 el_or); |
|
87 |
|
88 INSTALL_CATOP (octave_bool_matrix, octave_sparse_bool_matrix, bm_sbm); |
|
89 INSTALL_CATOP (octave_bool_matrix, octave_sparse_matrix, bm_sm); |
|
90 INSTALL_CATOP (octave_matrix, octave_sparse_bool_matrix, m_sbm); |
|
91 |
|
92 INSTALL_ASSIGNCONV (octave_bool_matrix, octave_sparse_bool_matrix, |
|
93 octave_sparse_bool_matrix); |
|
94 |
|
95 INSTALL_WIDENOP (octave_bool_matrix, octave_sparse_bool_matrix, |
|
96 sparse_bool_matrix_conv); |
|
97 } |
|
98 |
|
99 /* |
|
100 ;;; Local Variables: *** |
|
101 ;;; mode: C++ *** |
|
102 ;;; End: *** |
|
103 */ |