GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
boolMatrix.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_boolMatrix_h)
27 #define octave_boolMatrix_h 1
28 
29 #include "octave-config.h"
30 
31 #include "Array.h"
32 #include "boolNDArray.h"
33 #include "mx-defs.h"
34 #include "mx-op-decl.h"
35 
36 class
37 OCTAVE_API
38 boolMatrix : public boolNDArray
39 {
40 public:
41 
42  boolMatrix (void) = default;
43 
44  boolMatrix (const boolMatrix& a) = default;
45 
46  boolMatrix& operator = (const boolMatrix& a) = default;
47 
48  ~boolMatrix (void) = default;
49 
51  : boolNDArray (dim_vector (r, c)) { }
52 
54  : boolNDArray (dim_vector (r, c), val) { }
55 
56  boolMatrix (const dim_vector& dv) : boolNDArray (dv.redim (2)) { }
57 
58  boolMatrix (const dim_vector& dv, bool val)
59  : boolNDArray (dv.redim (2), val) { }
60 
61  boolMatrix (const Array<bool>& a) : boolNDArray (a.as_matrix ()) { }
62 
63  bool operator == (const boolMatrix& a) const;
64  bool operator != (const boolMatrix& a) const;
65 
66  boolMatrix transpose (void) const { return Array<bool>::transpose (); }
67 
68  // destructive insert/delete/reorder operations
69 
70  boolMatrix& insert (const boolMatrix& a,
72 
73  // unary operations
74 
75  boolMatrix operator ! (void) const;
76 
77  // other operations
78 
79  boolMatrix diag (octave_idx_type k = 0) 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)
98 
99 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:281
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1011
Array< T > transpose(void) const
Size of the specified dimension.
Definition: Array.cc:1599
Definition: dMatrix.h:42
boolMatrix(const dim_vector &dv)
Definition: boolMatrix.h:56
boolMatrix transpose(void) const
Definition: boolMatrix.h:66
~boolMatrix(void)=default
boolMatrix(octave_idx_type r, octave_idx_type c)
Definition: boolMatrix.h:50
boolMatrix(const Array< bool > &a)
Definition: boolMatrix.h:61
boolMatrix(octave_idx_type r, octave_idx_type c, bool val)
Definition: boolMatrix.h:53
void resize(octave_idx_type nr, octave_idx_type nc, bool rfv=false)
Definition: boolMatrix.h:88
boolMatrix(void)=default
boolMatrix(const dim_vector &dv, bool val)
Definition: boolMatrix.h:58
boolMatrix(const boolMatrix &a)=default
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:601
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:585
T * r
Definition: mx-inlines.cc:773
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:123
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:98
#define MM_CMP_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:140
#define MM_BOOL_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:148
octave_value operator!(const octave_value &a)
Definition: ov.h:1536