GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
boolSparse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2013 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
5 
6 This file is part of Octave.
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
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
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
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
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 SparseMatrix;
32 
33 class
34 OCTAVE_API
36 {
37 public:
38 
39  SparseBoolMatrix (void) : Sparse<bool> () { }
40 
42  : Sparse<bool> (r, c) { }
43 
45  : Sparse<bool> (r, c, val) { }
46 
48  : Sparse<bool> (dv, nz) { }
49 
50  SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { }
51 
53 
55  : Sparse<bool> (a, dv) { }
56 
57  explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { }
58 
59  explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { }
60 
61  explicit SparseBoolMatrix (const PermMatrix& a) : Sparse<bool> (a) { };
62 
64  const idx_vector& c, octave_idx_type nr = -1,
65  octave_idx_type nc = -1, bool sum_terms = true,
66  octave_idx_type nzm = -1)
67  : Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { }
68 
70  octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { }
71 
73  {
75  return *this;
76  }
77 
78  bool operator == (const SparseBoolMatrix& a) const;
79  bool operator != (const SparseBoolMatrix& a) const;
80 
82  { return Sparse<bool>::transpose (); }
83 
84  // destructive insert/delete/reorder operations
85 
88 
90  const Array<octave_idx_type>& indx);
91 
93  const Array<octave_idx_type>& ra_idx);
94 
96 
97  boolMatrix matrix_value (void) const;
98 
99  SparseBoolMatrix squeeze (void) const;
100 
101  SparseBoolMatrix index (const idx_vector& i, bool resize_ok) const;
102 
103  SparseBoolMatrix index (const idx_vector& i, const idx_vector& j,
104  bool resize_ok) const;
105 
106  SparseBoolMatrix reshape (const dim_vector& new_dims) const;
107 
109  bool inv = false) const;
110 
112 
113  // unary operations
114 
115  SparseBoolMatrix operator ! (void) const;
116 
117  // other operations
118 
119  SparseBoolMatrix all (int dim = -1) const;
120  SparseBoolMatrix any (int dim = -1) const;
121  SparseMatrix sum (int dim = -1) const;
122 
123  // i/o
124 
125  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
126  const SparseBoolMatrix& a);
127  friend OCTAVE_API std::istream& operator >> (std::istream& is,
128  SparseBoolMatrix& a);
129 };
130 
131 SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API)
132 SPARSE_SMS_BOOL_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API)
133 
134 SPARSE_SSM_EQNE_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API)
135 SPARSE_SSM_BOOL_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API)
136 
137 SPARSE_SMSM_EQNE_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API)
138 SPARSE_SMSM_BOOL_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API)
139 
140 #endif