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
intNDArray.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-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_intNDArray_h)
24 #define octave_intNDArray_h 1
25 
26 #include "octave-config.h"
27 
28 #include "MArray.h"
29 #include "boolNDArray.h"
30 class NDArray;
31 
32 template <typename T>
33 class
34 intNDArray : public MArray<T>
35 {
36 public:
37 
38  using typename MArray<T>::element_type;
39 
40  intNDArray (void) : MArray<T> () { }
41 
42  intNDArray (T val) : MArray<T> (dim_vector (1, 1), val) { }
43 
44  intNDArray (const dim_vector& dv) : MArray<T> (dv) { }
45 
47  : MArray<T> (dv, val) { }
48 
49  template <typename U>
50  intNDArray (const Array<U>& a) : MArray<T> (a) { }
51 
52  template <typename U>
53  intNDArray (const MArray<U>& a) : MArray<T> (a) { }
54 
55  template <typename U>
56  intNDArray (const intNDArray<U>& a) : MArray<T> (a) { }
57 
59  {
61  return *this;
62  }
63 
64  boolNDArray operator ! (void) const;
65 
66  bool any_element_is_nan (void) const { return false; }
67  bool any_element_not_one_or_zero (void) const;
68 
69  intNDArray diag (octave_idx_type k = 0) const;
70 
72 
74  {
76  return *this;
77  }
78 
79  // FIXME: this is not quite the right thing.
80 
81  boolNDArray all (int dim = -1) const;
82  boolNDArray any (int dim = -1) const;
83 
84  intNDArray max (int dim = -1) const;
85  intNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
86  intNDArray min (int dim = -1) const;
87  intNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
88 
89  intNDArray cummax (int dim = -1) const;
90  intNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const;
91  intNDArray cummin (int dim = -1) const;
92  intNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const;
93 
94  intNDArray prod (int dim) const;
95  intNDArray sum (int dim) const;
96  NDArray dsum (int dim) const;
97  intNDArray cumsum (int dim) const;
98 
99  intNDArray diff (octave_idx_type order = 1, int dim = -1) const;
100 
101  intNDArray abs (void) const;
102  intNDArray signum (void) const;
103 
104  intNDArray squeeze (void) const
105  { return intNDArray<T> (MArray<T>::squeeze ()); }
106 
107  intNDArray transpose (void) const
108  { return intNDArray<T> (MArray<T>::transpose ()); }
109 
110  intNDArray concat (const intNDArray<T>& rb,
112 
113  intNDArray& insert (const intNDArray<T>& a,
115  intNDArray& insert (const intNDArray<T>& a,
117 
119  const dim_vector& dimensions,
120  int start_dimension = 0);
121 
123  const dim_vector& dimensions);
124 };
125 
126 // i/o
127 
128 template <typename T>
129 std::ostream& operator << (std::ostream& os, const intNDArray<T>& a);
130 
131 template <typename T>
132 std::istream& operator >> (std::istream& is, intNDArray<T>& a);
133 
134 #endif
dim_vector dimensions
Definition: Array.h:214
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:176
NDArray cumsum(int dim=-1) const
Definition: dNDArray.cc:650
const octave_base_value const Array< octave_idx_type > & ra_idx
MArray squeeze(void) const
Definition: MArray.h:101
intNDArray squeeze(void) const
Definition: intNDArray.h:104
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
intNDArray(const dim_vector &dv, T val)
Definition: intNDArray.h:46
intNDArray(const intNDArray< U > &a)
Definition: intNDArray.h:56
NDArray & operator=(const NDArray &a)
Definition: dNDArray.h:70
intNDArray(void)
Definition: intNDArray.h:40
for large enough k
Definition: lu.cc:606
NDArray prod(int dim=-1) const
Definition: dNDArray.cc:656
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:655
MArray< T > transpose(void) const
Definition: MArray.h:103
intNDArray(const Array< U > &a)
Definition: intNDArray.h:50
intNDArray & changesign(void)
Definition: intNDArray.h:73
Template for N-dimensional array classes with like-type math operators.
Definition: MArray.h:32
intNDArray(T val)
Definition: intNDArray.h:42
void changesign(void)
Definition: MArray.cc:204
intNDArray transpose(void) const
Definition: intNDArray.h:107
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
bool any_element_not_one_or_zero(void) const
Definition: dNDArray.cc:567
intNDArray(const dim_vector &dv)
Definition: intNDArray.h:44
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
NDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: dNDArray.cc:793
double signum(double x)
Definition: lo-mappers.h:259
NDArray cummax(int dim=-1) const
Definition: dNDArray.cc:704
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
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:126
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:228
boolNDArray all(int dim=-1) const
Definition: dNDArray.cc:632
intNDArray(const MArray< U > &a)
Definition: intNDArray.h:53
NDArray cummin(int dim=-1) const
Definition: dNDArray.cc:716
NDArray sum(int dim=-1) const
Definition: dNDArray.cc:662
NDArray diag(octave_idx_type k=0) const
Definition: dNDArray.cc:846
bool any_element_is_nan(void) const
Definition: intNDArray.h:66
T element_type
Definition: Array.h:199
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
std::istream & operator>>(std::istream &is, intNDArray< T > &a)
Definition: intNDArray.cc:156
octave_value operator!(const octave_value &a)
Definition: ov.h:1484
write the output to stdout if nargout is
Definition: load-save.cc:1576
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
dim_vector dv
Definition: sub2ind.cc:263
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
NDArray diff(octave_idx_type order=1, int dim=-1) const
Definition: dNDArray.cc:728
Array< double > index(const idx_vector &i) const
Indexing without resizing.
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:205