GNU Octave  8.1.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-2023 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 (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  OCTAVE_API bool operator == (const boolMatrix& a) const;
64  OCTAVE_API bool operator != (const boolMatrix& a) const;
65 
66  boolMatrix transpose (void) const { return Array<bool>::transpose (); }
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 
75  OCTAVE_API boolMatrix operator ! (void) const;
76 
77  // other operations
78 
79  OCTAVE_API boolMatrix diag (octave_idx_type k = 0) const;
80 
81 #if 0
82  // i/o
83 
84  friend OCTAVE_API std::ostream&
85  operator << (std::ostream& os, const Matrix& a);
86  friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a);
87 #endif
88 
89  void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false)
90  {
91  Array<bool>::resize (dim_vector (nr, nc), rfv);
92  }
93 };
94 
99 
100 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
OCTARRAY_API Array< T, Alloc > transpose(void) const
Size of the specified dimension.
Definition: Array-base.cc:1625
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1032
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:89
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: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.in.cc:55
class OCTAVE_API boolMatrix
Definition: mx-fwd.h:35
T * r
Definition: mx-inlines.cc:773
#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:1838