GNU Octave  9.1.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-2024 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
38 boolMatrix : public boolNDArray
39 {
40 public:
41 
42  boolMatrix () = default;
43 
44  boolMatrix (const boolMatrix& a) = default;
45 
46  boolMatrix& operator = (const boolMatrix& a) = default;
47 
48  ~boolMatrix () = 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  OCTAVE_API bool operator == (const boolMatrix& a) const;
64  OCTAVE_API bool operator != (const boolMatrix& a) const;
65 
67 
68  // destructive insert/delete/reorder operations
69 
71  insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c);
72 
73  // unary operations
74 
76 
77  // other operations
78 
79  OCTAVE_API boolMatrix diag (octave_idx_type k = 0) const;
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 
91 
92 #endif
Array< T, Alloc > transpose() const
Size of the specified dimension.
Definition: Array-base.cc:1623
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1023
boolMatrix(const dim_vector &dv)
Definition: boolMatrix.h:56
~boolMatrix()=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
boolMatrix transpose() const
Definition: boolMatrix.h:66
void resize(octave_idx_type nr, octave_idx_type nc, bool rfv=false)
Definition: boolMatrix.h:81
boolMatrix(const dim_vector &dv, bool val)
Definition: boolMatrix.h:58
boolMatrix(const boolMatrix &a)=default
boolMatrix()=default
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:536
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:520
#define OCTAVE_API
Definition: main.cc:55
T * r
Definition: mx-inlines.cc:781
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:122
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:97
#define MM_CMP_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:139
#define MM_BOOL_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:147
octave_value operator!(const octave_value &a)
Definition: ov.h:1633