Mercurial > octave-nkf
comparison src/OPERATORS/op-bm-sbm.cc @ 5164:57077d0ddc8e
[project @ 2005-02-25 19:55:24 by jwe]
author | jwe |
---|---|
date | Fri, 25 Feb 2005 19:55:28 +0000 |
parents | |
children | 4c8a2e4e0717 |
comparison
equal
deleted
inserted
replaced
5163:9f3299378193 | 5164:57077d0ddc8e |
---|---|
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 // bool matrix by sparse bool matrix ops. | |
40 | |
41 DEFBINOP_FN (eq, bool_matrix, sparse_bool_matrix, mx_el_eq) | |
42 DEFBINOP_FN (ne, bool_matrix, sparse_bool_matrix, mx_el_ne) | |
43 | |
44 DEFBINOP_FN (el_and, bool_matrix, sparse_bool_matrix, mx_el_and) | |
45 DEFBINOP_FN (el_or, bool_matrix, sparse_bool_matrix, mx_el_or) | |
46 | |
47 DEFCATOP (bm_sbm, bool_matrix, sparse_bool_matrix) | |
48 { | |
49 CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_bool_matrix&); | |
50 SparseBoolMatrix tmp (v1.bool_matrix_value ()); | |
51 return octave_value (tmp. concat (v2.sparse_bool_matrix_value (), | |
52 ra_idx)); | |
53 } | |
54 | |
55 DEFCATOP (m_sbm, matrix, sparse_bool_matrix) | |
56 { | |
57 CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_bool_matrix&); | |
58 SparseMatrix tmp (v1.matrix_value ()); | |
59 return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx)); | |
60 } | |
61 | |
62 DEFCATOP (bm_sm, bool_matrix, sparse_matrix) | |
63 { | |
64 CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_matrix&); | |
65 SparseMatrix tmp (v1.matrix_value ()); | |
66 return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx)); | |
67 } | |
68 | |
69 DEFCONV (sparse_bool_matrix_conv, bool_matrix, sparse_bool_matrix) | |
70 { | |
71 CAST_CONV_ARG (const octave_bool_matrix&); | |
72 return new octave_sparse_bool_matrix | |
73 (SparseBoolMatrix (v.bool_matrix_value ())); | |
74 } | |
75 | |
76 void | |
77 install_bm_sbm_ops (void) | |
78 { | |
79 INSTALL_BINOP (op_eq, octave_bool_matrix, octave_sparse_bool_matrix, eq); | |
80 INSTALL_BINOP (op_ne, octave_bool_matrix, octave_sparse_bool_matrix, ne); | |
81 | |
82 INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_sparse_bool_matrix, | |
83 el_and); | |
84 INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_sparse_bool_matrix, | |
85 el_or); | |
86 | |
87 INSTALL_CATOP (octave_bool_matrix, octave_sparse_bool_matrix, bm_sbm); | |
88 INSTALL_CATOP (octave_bool_matrix, octave_sparse_matrix, bm_sm); | |
89 INSTALL_CATOP (octave_matrix, octave_sparse_bool_matrix, m_sbm); | |
90 | |
91 INSTALL_ASSIGNCONV (octave_bool_matrix, octave_sparse_bool_matrix, | |
92 octave_sparse_bool_matrix); | |
93 | |
94 INSTALL_WIDENOP (octave_bool_matrix, octave_sparse_bool_matrix, | |
95 sparse_bool_matrix_conv); | |
96 } | |
97 | |
98 /* | |
99 ;;; Local Variables: *** | |
100 ;;; mode: C++ *** | |
101 ;;; End: *** | |
102 */ |