GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
boolNDArray.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2003-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_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 (void) : 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  // unary operations
62 
64 
65  OCTAVE_API boolNDArray& invert (void);
66 
67  bool any_element_is_nan (void) const { return false; }
68 
69  // FIXME: this is not quite the right thing.
70 
71  OCTAVE_API boolNDArray all (int dim = -1) const;
72  OCTAVE_API boolNDArray any (int dim = -1) const;
73 
75  concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx);
76 
78  insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c);
80  insert (const boolNDArray& a, const Array<octave_idx_type>& ra_idx);
81 
82  boolNDArray squeeze (void) const { return Array<bool>::squeeze (); }
83 
84  static OCTAVE_API void
86  const dim_vector& dimensions, int start_dimension = 0);
87 
90  const dim_vector& dimensions);
91 
92  // i/o
93 
94  // friend std::ostream& operator << (std::ostream& os, const NDArray& a);
95  // friend std::istream& operator >> (std::istream& is, NDArray& a);
96 
97  // bool all_elements_are_real (void) const;
98  // bool all_integers (double& max_val, double& min_val) const;
99 
100  OCTAVE_API boolNDArray diag (octave_idx_type k = 0) const;
101 
103 };
104 
107 
110 
113 
114 extern OCTAVE_API boolNDArray&
116 extern OCTAVE_API boolNDArray&
118 
121 
122 #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
OCTAVE_API boolNDArray & mx_el_and_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:132
OCTAVE_API boolNDArray & mx_el_or_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:144
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition: bsxfun-decl.h:29
OCTARRAY_API Array< T, Alloc > squeeze(void) 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
boolNDArray squeeze(void) const
Definition: boolNDArray.h:82
boolNDArray(const dim_vector &dv)
Definition: boolNDArray.h:46
boolNDArray(const dim_vector &dv, const bool &val)
Definition: boolNDArray.h:48
bool any_element_is_nan(void) const
Definition: boolNDArray.h:67
boolNDArray(const Array< bool > &a)
Definition: boolNDArray.h:53
boolMatrix matrix_type
Definition: boolNDArray.h:42
boolNDArray(void)
Definition: boolNDArray.h:44
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
#define OCTAVE_API
Definition: main.in.cc:55
class OCTAVE_API boolNDArray
Definition: mx-fwd.h:42
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773
#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:1838