GNU Octave  4.2.1
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
boolNDArray.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2003-2017 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://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 
30 #include "mx-defs.h"
31 #include "mx-op-decl.h"
32 #include "bsxfun-decl.h"
33 
34 class
35 OCTAVE_API
36 boolNDArray : public Array<bool>
37 {
38 public:
39 
41 
42  boolNDArray (void) : Array<bool> () { }
43 
44  boolNDArray (const dim_vector& dv) : Array<bool> (dv) { }
45 
46  boolNDArray (const dim_vector& dv, const bool& val)
47  : Array<bool> (dv, val) { }
48 
49  boolNDArray (const boolNDArray& a) : Array<bool> (a) { }
50 
51  boolNDArray (const Array<bool>& a) : Array<bool> (a) { }
52 
53  boolNDArray& operator = (const boolNDArray& a)
54  {
56  return *this;
57  }
58 
59  // unary operations
60 
61  boolNDArray operator ! (void) const;
62 
63  boolNDArray& invert (void);
64 
65  bool any_element_is_nan (void) const { return false; }
66 
67  // FIXME: this is not quite the right thing.
68 
69  boolNDArray all (int dim = -1) const;
70  boolNDArray any (int dim = -1) const;
71 
72  NDArray sum (int dim = -1) const;
73  NDArray cumsum (int dim = -1) const;
74 
75  boolNDArray concat (const boolNDArray& rb,
77 
78  boolNDArray& insert (const boolNDArray& a, octave_idx_type r,
80  boolNDArray& insert (const boolNDArray& a,
82 
83  boolNDArray squeeze (void) const { return Array<bool>::squeeze (); }
84 
86  const dim_vector& dimensions,
87  int start_dimension = 0);
88 
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  boolNDArray diag (octave_idx_type k = 0) const;
101 
103 };
104 
106 NDND_CMP_OP_DECLS (boolNDArray, boolNDArray, OCTAVE_API)
107 
108 NDS_BOOL_OP_DECLS (boolNDArray, bool, OCTAVE_API)
109 NDS_CMP_OP_DECLS (boolNDArray, bool, OCTAVE_API)
110 
111 SND_BOOL_OP_DECLS (bool, boolNDArray, OCTAVE_API)
112 SND_CMP_OP_DECLS (bool, boolNDArray, OCTAVE_API)
113 
114 extern OCTAVE_API boolNDArray&
115 mx_el_and_assign (boolNDArray& m, const boolNDArray& a);
116 extern OCTAVE_API boolNDArray&
117 mx_el_or_assign (boolNDArray& m, const boolNDArray& a);
118 
119 BSXFUN_OP_DECL (and, boolNDArray, OCTAVE_API);
120 BSXFUN_OP_DECL (or, boolNDArray, OCTAVE_API);
121 
122 #endif
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:176
boolNDArray(const dim_vector &dv)
Definition: boolNDArray.h:44
const octave_base_value const Array< octave_idx_type > & ra_idx
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:582
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:218
for large enough k
Definition: lu.cc:606
#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:655
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:226
boolNDArray squeeze(void) const
Definition: boolNDArray.h:83
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:172
bool any_element_is_nan(void) const
Definition: boolNDArray.h:65
#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:398
#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:59
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
Definition: Array.cc:125
boolMatrix matrix_type
Definition: boolNDArray.h:40
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
Restrict the maximum order of the solution method This option must be between and
Definition: DASPK-opts.cc:739
boolNDArray(void)
Definition: boolNDArray.h:42
OCTAVE_API boolNDArray & mx_el_and_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:146
boolNDArray(const dim_vector &dv, const bool &val)
Definition: boolNDArray.h:46
boolNDArray(const Array< bool > &a)
Definition: boolNDArray.h:51
octave_value operator!(const octave_value &a)
Definition: ov.h:1484
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
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:1491
boolNDArray(const boolNDArray &a)
Definition: boolNDArray.h:49
Array< T > & operator=(const Array< T > &a)
Definition: Array.h:309
dim_vector dv
Definition: sub2ind.cc:263
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition: bsxfun-decl.h:29
OCTAVE_API boolNDArray & mx_el_or_assign(boolNDArray &m, const boolNDArray &a)
Definition: boolNDArray.cc:158