GNU Octave  4.0.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-2015 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 #include "boolNDArray.h"
29 
30 #include "mx-defs.h"
31 #include "mx-op-decl.h"
32 
33 class
34 OCTAVE_API
35 boolMatrix : public boolNDArray
36 {
37 public:
38 
39  boolMatrix (void) : boolNDArray () { }
40 
42  : boolNDArray (dim_vector (r, c)) { }
43 
45  : boolNDArray (dim_vector (r, c), val) { }
46 
47  boolMatrix (const dim_vector& dv) : boolNDArray (dv.redim (2)) { }
48 
49  boolMatrix (const dim_vector& dv, bool val)
50  : boolNDArray (dv.redim (2), val) { }
51 
52  boolMatrix (const Array<bool>& a) : boolNDArray (a.as_matrix ()) { }
53 
54  boolMatrix (const boolMatrix& a) : boolNDArray (a) { }
55 
56  bool operator == (const boolMatrix& a) const;
57  bool operator != (const boolMatrix& a) const;
58 
59  boolMatrix transpose (void) const { return Array<bool>::transpose (); }
60 
61  // destructive insert/delete/reorder operations
62 
63  boolMatrix& insert (const boolMatrix& a,
65 
66  // unary operations
67 
68  boolMatrix operator ! (void) const;
69 
70  // other operations
71 
72  boolMatrix diag (octave_idx_type k = 0) const;
73 
74 #if 0
75  // i/o
76 
77  friend std::ostream& operator << (std::ostream& os, const Matrix& a);
78  friend std::istream& operator >> (std::istream& is, Matrix& a);
79 #endif
80 
81  void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false)
82  {
83  Array<bool>::resize (dim_vector (nr, nc), rfv);
84  }
85 };
86 
88 MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API)
89 SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API)
90 MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API)
91 
92 #endif
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
boolMatrix(const dim_vector &dv, bool val)
Definition: boolMatrix.h:49
boolMatrix(const dim_vector &dv)
Definition: boolMatrix.h:47
boolMatrix(octave_idx_type r, octave_idx_type c)
Definition: boolMatrix.h:41
boolMatrix(void)
Definition: boolMatrix.h:39
boolMatrix transpose(void) const
Definition: boolMatrix.h:59
boolMatrix(octave_idx_type r, octave_idx_type c, bool val)
Definition: boolMatrix.h:44
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:120
#define MM_CMP_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:137
#define MM_BOOL_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:145
Array< T > transpose(void) const
Definition: Array.cc:1607
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
Definition: dMatrix.h:35
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:95
boolMatrix(const Array< bool > &a)
Definition: boolMatrix.h:52
octave_value operator!(const octave_value &a)
Definition: ov.h:1293
void resize(octave_idx_type nr, octave_idx_type nc, bool rfv=false)
Definition: boolMatrix.h:81
boolMatrix(const boolMatrix &a)
Definition: boolMatrix.h:54