GNU Octave  4.4.1
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-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_boolNDArray_h)
24 #define octave_boolNDArray_h 1
25 
26 #include "octave-config.h"
27 
28 #include "Array.h"
29 #include "bsxfun-decl.h"
30 #include "mx-defs.h"
31 #include "mx-op-decl.h"
32 
33 class
34 OCTAVE_API
35 boolNDArray : public Array<bool>
36 {
37 public:
38 
40 
41  boolNDArray (void) : Array<bool> () { }
42 
43  boolNDArray (const dim_vector& dv) : Array<bool> (dv) { }
44 
45  boolNDArray (const dim_vector& dv, const bool& val)
46  : Array<bool> (dv, val) { }
47 
48  boolNDArray (const boolNDArray& a) : Array<bool> (a) { }
49 
50  boolNDArray (const Array<bool>& a) : Array<bool> (a) { }
51 
52  boolNDArray& operator = (const boolNDArray& a)
53  {
55  return *this;
56  }
57 
58  // unary operations
59 
60  boolNDArray operator ! (void) const;
61 
62  boolNDArray& invert (void);
63 
64  bool any_element_is_nan (void) const { return false; }
65 
66  // FIXME: this is not quite the right thing.
67 
68  boolNDArray all (int dim = -1) const;
69  boolNDArray any (int dim = -1) const;
70 
71  OCTAVE_DEPRECATED (4.4, "convert to and operate on numeric type instead")
72  NDArray sum (int dim = -1) const;
73 
74  OCTAVE_DEPRECATED (4.4, "convert to and operate on numeric type instead")
75  NDArray cumsum (int dim = -1) const;
76 
77  boolNDArray concat (const boolNDArray& rb,
78  const Array<octave_idx_type>& ra_idx);
79 
80  boolNDArray& insert (const boolNDArray& a, octave_idx_type r,
82  boolNDArray& insert (const boolNDArray& a,
83  const Array<octave_idx_type>& ra_idx);
84 
85  boolNDArray squeeze (void) const { return Array<bool>::squeeze (); }
86 
88  const dim_vector& dimensions,
89  int start_dimension = 0);
90 
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 (void) const;
100  // bool all_integers (double& max_val, double& min_val) const;
101 
102  boolNDArray diag (octave_idx_type k = 0) const;
103 
104  boolNDArray diag (octave_idx_type m, octave_idx_type n) const;
105 };
106 
109 
110 NDS_BOOL_OP_DECLS (boolNDArray, bool, OCTAVE_API)
111 NDS_CMP_OP_DECLS (boolNDArray, bool, OCTAVE_API)
112 
113 SND_BOOL_OP_DECLS (bool, boolNDArray, OCTAVE_API)
114 SND_CMP_OP_DECLS (bool, boolNDArray, OCTAVE_API)
115 
116 extern OCTAVE_API boolNDArray&
118 extern OCTAVE_API boolNDArray&
120 
121 BSXFUN_OP_DECL (and, boolNDArray, OCTAVE_API);
122 BSXFUN_OP_DECL (or, boolNDArray, OCTAVE_API);
123 
124 #endif
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:175
boolNDArray(const dim_vector &dv)
Definition: boolNDArray.h:43
const octave_base_value const Array< octave_idx_type > & ra_idx
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:218
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
Definition: Array.cc:116
for large enough k
Definition: lu.cc:617
#define SND_BOOL_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:199
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:653
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:226
the second is matched to the second specifier and placed in the second column and so forth If there are more words than specifiers then the process is repeated until all words have been processed or the limit imposed by any(non-whitespace) text in the format that is not one of these specifiers is considered a literal. If there is a literal between two format specifiers then that same literal must appear in the input stream between the matching words. The following specifiers are valid
Definition: file-io.cc:1499
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
OCTAVE_EXPORT octave_value_list or class The return code an ordinary file in Octave s or(after appending @samp{.m}) a function file in Octave 's ode
Definition: variables.cc:593
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:172
#define NDS_CMP_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:164
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
#define SND_CMP_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:191
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition: Array-util.cc:58
boolMatrix matrix_type
Definition: boolNDArray.h:39
idx type
Definition: ov.cc:3114
boolNDArray(void)
Definition: boolNDArray.h:41
OCTAVE_API boolNDArray & mx_el_and_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:145
boolNDArray(const dim_vector &dv, const bool &val)
Definition: boolNDArray.h:45
boolNDArray(const Array< bool > &a)
Definition: boolNDArray.h:50
octave_value operator!(const octave_value &a)
Definition: ov.h:1573
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
bool any_element_is_nan(void) const
Definition: boolNDArray.h:64
boolNDArray(const boolNDArray &a)
Definition: boolNDArray.h:48
Array< T > & operator=(const Array< T > &a)
Definition: Array.h:311
dim_vector dv
Definition: sub2ind.cc:263
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition: bsxfun-decl.h:27
OCTAVE_API boolNDArray & mx_el_or_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:157
more on
Definition: toplev.cc:236