5164
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 2004, 2005, 2006, 2007 David Bateman |
7016
|
4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
|
5 |
|
6 This file is part of Octave. |
5164
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
5164
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
5164
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_boolSparse_h) |
|
25 #define octave_boolSparse_h 1 |
|
26 |
|
27 #include "Sparse.h" |
|
28 #include "MSparse-defs.h" |
|
29 #include "Sparse-op-defs.h" |
|
30 |
|
31 class |
6108
|
32 OCTAVE_API |
5164
|
33 SparseBoolMatrix : public Sparse<bool> |
|
34 { |
|
35 public: |
|
36 |
|
37 SparseBoolMatrix (void) : Sparse<bool> () { } |
|
38 |
5275
|
39 SparseBoolMatrix (octave_idx_type r, octave_idx_type c) : Sparse<bool> (r, c) { } |
5164
|
40 |
5275
|
41 explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val) |
5164
|
42 : Sparse<bool> (r, c, val) { } |
|
43 |
6823
|
44 SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) : |
|
45 Sparse<bool> (dv, nz) { } |
|
46 |
5164
|
47 SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { } |
|
48 |
|
49 SparseBoolMatrix (const SparseBoolMatrix& a) : Sparse<bool> (a) { } |
|
50 |
|
51 SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv) |
|
52 : Sparse<bool> (a, dv) { } |
|
53 |
|
54 explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { } |
|
55 |
|
56 explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { } |
|
57 |
5275
|
58 explicit SparseBoolMatrix (const Array<bool> a, const Array<octave_idx_type>& r, |
|
59 const Array<octave_idx_type>& c, octave_idx_type nr = -1, |
|
60 octave_idx_type nc = -1, bool sum_terms = true) |
5164
|
61 : Sparse<bool> (a, r, c, nr, nc, sum_terms) { } |
|
62 |
|
63 explicit SparseBoolMatrix (const Array<bool> a, const Array<double>& r, |
5275
|
64 const Array<double>& c, octave_idx_type nr = -1, |
|
65 octave_idx_type nc = -1, bool sum_terms = true) |
5164
|
66 : Sparse<bool> (a, r, c, nr, nc, sum_terms) { } |
|
67 |
5275
|
68 SparseBoolMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { } |
5164
|
69 |
|
70 SparseBoolMatrix& operator = (const SparseBoolMatrix& a) |
|
71 { |
|
72 Sparse<bool>::operator = (a); |
|
73 return *this; |
|
74 } |
|
75 |
|
76 bool operator == (const SparseBoolMatrix& a) const; |
|
77 bool operator != (const SparseBoolMatrix& a) const; |
|
78 |
|
79 SparseBoolMatrix transpose (void) const |
|
80 { return Sparse<bool>::transpose (); } |
|
81 |
|
82 // destructive insert/delete/reorder operations |
|
83 |
5275
|
84 SparseBoolMatrix& insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c); |
5164
|
85 |
6823
|
86 SparseBoolMatrix& insert (const SparseBoolMatrix& a, const Array<octave_idx_type>& indx); |
|
87 |
5164
|
88 SparseBoolMatrix concat (const SparseBoolMatrix& rb, |
5275
|
89 const Array<octave_idx_type>& ra_idx); |
5164
|
90 |
|
91 boolMatrix matrix_value (void) const; |
|
92 |
|
93 SparseBoolMatrix squeeze (void) const; |
|
94 |
|
95 SparseBoolMatrix index (idx_vector& i, int resize_ok) const; |
|
96 |
|
97 SparseBoolMatrix index (idx_vector& i, idx_vector& j, int resize_ok) const; |
|
98 |
|
99 SparseBoolMatrix index (Array<idx_vector>& ra_idx, int resize_ok) const; |
|
100 |
|
101 SparseBoolMatrix reshape (const dim_vector& new_dims) const; |
|
102 |
5275
|
103 SparseBoolMatrix permute (const Array<octave_idx_type>& vec, bool inv = false) const; |
5164
|
104 |
5275
|
105 SparseBoolMatrix ipermute (const Array<octave_idx_type>& vec) const; |
5164
|
106 |
|
107 // unary operations |
|
108 |
|
109 SparseBoolMatrix operator ! (void) const; |
|
110 |
|
111 // other operations |
|
112 |
|
113 SparseBoolMatrix all (int dim = -1) const; |
|
114 SparseBoolMatrix any (int dim = -1) const; |
|
115 |
|
116 // i/o |
|
117 |
6108
|
118 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const SparseBoolMatrix& a); |
|
119 friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseBoolMatrix& a); |
5164
|
120 }; |
|
121 |
6708
|
122 SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) |
|
123 SPARSE_SMS_BOOL_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) |
5164
|
124 |
6708
|
125 SPARSE_SSM_EQNE_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) |
|
126 SPARSE_SSM_BOOL_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) |
5164
|
127 |
6708
|
128 SPARSE_SMSM_EQNE_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) |
|
129 SPARSE_SMSM_BOOL_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) |
5164
|
130 |
|
131 #endif |
|
132 |
|
133 /* |
|
134 ;;; Local Variables: *** |
|
135 ;;; mode: C++ *** |
|
136 ;;; End: *** |
|
137 */ |