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
boolMatrix.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2013 John W. Eaton
4 Copyright (C) 2010 VZLU Prague
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_boolMatrix_h)
25 #define octave_boolMatrix_h 1
26 
27 #include "Array.h"
28 
29 #include "mx-defs.h"
30 #include "mx-op-decl.h"
31 
32 class
33 OCTAVE_API
34 boolMatrix : public Array<bool>
35 {
36 public:
37 
38  boolMatrix (void) : Array<bool> () { }
39 
41  : Array<bool> (dim_vector (r, c)) { }
42 
44  : Array<bool> (dim_vector (r, c), val) { }
45 
46  boolMatrix (const dim_vector& dv) : Array<bool> (dv) { }
47 
48  boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { }
49 
50  boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { }
51 
52  boolMatrix (const boolMatrix& a) : Array<bool> (a) { }
53 
55  {
57  return *this;
58  }
59 
60  bool operator == (const boolMatrix& a) const;
61  bool operator != (const boolMatrix& a) const;
62 
63  boolMatrix transpose (void) const { return Array<bool>::transpose (); }
64 
65  // destructive insert/delete/reorder operations
66 
67  boolMatrix& insert (const boolMatrix& a,
69 
70  // unary operations
71 
72  boolMatrix operator ! (void) const;
73 
74  // other operations
75 
76  boolMatrix diag (octave_idx_type k = 0) const;
77 
78  boolMatrix all (int dim = -1) const;
79  boolMatrix any (int dim = -1) const;
80 
81 #if 0
82  // i/o
83 
84  friend std::ostream& operator << (std::ostream& os, const Matrix& a);
85  friend std::istream& operator >> (std::istream& is, Matrix& a);
86 #endif
87 
88  void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false)
89  {
90  Array<bool>::resize (dim_vector (nr, nc), rfv);
91  }
92 };
93 
95 MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API)
96 SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API)
97 MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API)
98 
99 #endif