GNU Octave  9.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 Friends Macros Pages
boolNDArray.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2003-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_boolNDArray_h)
27 #define octave_boolNDArray_h 1
28 
29 #include "octave-config.h"
30 
31 #include "Array.h"
32 #include "bsxfun-decl.h"
33 #include "mx-defs.h"
34 #include "mx-op-decl.h"
35 
36 class
38 boolNDArray : public Array<bool>
39 {
40 public:
41 
43 
44  boolNDArray () : Array<bool> () { }
45 
46  boolNDArray (const dim_vector& dv) : Array<bool> (dv) { }
47 
48  boolNDArray (const dim_vector& dv, const bool& val)
49  : Array<bool> (dv, val) { }
50 
51  boolNDArray (const boolNDArray& a) : Array<bool> (a) { }
52 
53  boolNDArray (const Array<bool>& a) : Array<bool> (a) { }
54 
55  boolNDArray& operator = (const boolNDArray& a)
56  {
58  return *this;
59  }
60 
61  ~boolNDArray () = default;
62 
63  // unary operations
64 
66 
67  OCTAVE_API boolNDArray& invert ();
68 
69  bool any_element_is_nan () const { return false; }
70 
71  // FIXME: this is not quite the right thing.
72 
73  OCTAVE_API boolNDArray all (int dim = -1) const;
74  OCTAVE_API boolNDArray any (int dim = -1) const;
75 
77  concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx);
78 
80  insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c);
82  insert (const boolNDArray& a, const Array<octave_idx_type>& ra_idx);
83 
84  boolNDArray squeeze () const { return Array<bool>::squeeze (); }
85 
86  static OCTAVE_API void
88  const dim_vector& dimensions, int start_dimension = 0);
89 
92  const dim_vector& dimensions);
93 
94  // i/o
95 
96  // friend std::ostream& operator << (std::ostream& os, const NDArray& a);
97  // friend std::istream& operator >> (std::istream& is, NDArray& a);
98 
99  // bool all_elements_are_real () const;
100  // bool all_integers (double& max_val, double& min_val) const;
101 
102  OCTAVE_API boolNDArray diag (octave_idx_type k = 0) const;
103 
105 };
106 
109 
112 
115 
116 extern OCTAVE_API boolNDArray&
118 extern OCTAVE_API boolNDArray&
120 
123 
124 #endif
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:177
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition: Array-util.cc:60
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:418
boolNDArray & mx_el_or_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:144
boolNDArray & mx_el_and_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:132
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition: bsxfun-decl.h:29
Array< T, Alloc > squeeze() const
Chop off leading singleton dimensions.
Definition: Array-base.cc:139
Array< T, Alloc > & operator=(const Array< T, Alloc > &a)
Definition: Array.h:361
boolNDArray(const boolNDArray &a)
Definition: boolNDArray.h:51
bool any_element_is_nan() const
Definition: boolNDArray.h:69
~boolNDArray()=default
boolNDArray squeeze() const
Definition: boolNDArray.h:84
boolNDArray(const dim_vector &dv)
Definition: boolNDArray.h:46
boolNDArray(const dim_vector &dv, const bool &val)
Definition: boolNDArray.h:48
boolNDArray(const Array< bool > &a)
Definition: boolNDArray.h:53
boolMatrix matrix_type
Definition: boolNDArray.h:42
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
#define OCTAVE_API
Definition: main.cc:55
T octave_idx_type m
Definition: mx-inlines.cc:781
octave_idx_type n
Definition: mx-inlines.cc:761
T * r
Definition: mx-inlines.cc:781
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:226
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:218
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:172
#define SND_CMP_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:191
#define NDS_CMP_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:164
#define SND_BOOL_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:199
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value operator!(const octave_value &a)
Definition: ov.h:1633