GNU Octave  4.0.0
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
CNDArray.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2003-2015 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_CNDArray_h)
24 #define octave_CNDArray_h 1
25 
26 #include "MArray.h"
27 
28 #include "mx-defs.h"
29 #include "mx-op-decl.h"
30 #include "bsxfun-decl.h"
31 
32 class
33 OCTAVE_API
35 {
36 public:
37 
38  ComplexNDArray (void) : MArray<Complex> () { }
39 
40  ComplexNDArray (const dim_vector& dv) : MArray<Complex> (dv) { }
41 
42  ComplexNDArray (const dim_vector& dv, const Complex& val)
43  : MArray<Complex> (dv, val) { }
44 
46 
47  template <class U>
48  ComplexNDArray (const MArray<U>& a) : MArray<Complex> (a) { }
49 
50  template <class U>
51  ComplexNDArray (const Array<U>& a) : MArray<Complex> (a) { }
52 
53  ComplexNDArray (const charNDArray&);
54 
56  {
58  return *this;
59  }
60 
61  // unary operations
62 
63  boolNDArray operator ! (void) const;
64 
65  // FIXME: this is not quite the right thing.
66 
67  bool any_element_is_nan (void) const;
68  bool any_element_is_inf_or_nan (void) const;
69  bool all_elements_are_real (void) const;
70  bool all_integers (double& max_val, double& min_val) const;
71  bool too_large_for_float (void) const;
72 
73  boolNDArray all (int dim = -1) const;
74  boolNDArray any (int dim = -1) const;
75 
76  ComplexNDArray cumprod (int dim = -1) const;
77  ComplexNDArray cumsum (int dim = -1) const;
78  ComplexNDArray prod (int dim = -1) const;
79  ComplexNDArray sum (int dim = -1) const;
80  ComplexNDArray xsum (int dim = -1) const;
81  ComplexNDArray sumsq (int dim = -1) const;
84  ComplexNDArray concat (const NDArray& rb,
86 
87  ComplexNDArray max (int dim = -1) const;
88  ComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
89  ComplexNDArray min (int dim = -1) const;
90  ComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
91 
92  ComplexNDArray cummax (int dim = -1) const;
93  ComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const;
94  ComplexNDArray cummin (int dim = -1) const;
95  ComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const;
96 
97  ComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const;
98 
99  ComplexNDArray& insert (const NDArray& a,
105 
106  NDArray abs (void) const;
107  boolNDArray isnan (void) const;
108  boolNDArray isinf (void) const;
109  boolNDArray isfinite (void) const;
110 
111  friend OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a);
112 
113  ComplexNDArray fourier (int dim = 1) const;
114  ComplexNDArray ifourier (int dim = 1) const;
115 
116  ComplexNDArray fourier2d (void) const;
117  ComplexNDArray ifourier2d (void) const;
118 
119  ComplexNDArray fourierNd (void) const;
120  ComplexNDArray ifourierNd (void) const;
121 
122  ComplexNDArray squeeze (void) const { return MArray<Complex>::squeeze (); }
123 
125  const dim_vector& dimensions,
126  int start_dimension = 0);
127 
129  const dim_vector& dimensions);
130 
131  // i/o
132 
133  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
134  const ComplexNDArray& a);
135  friend OCTAVE_API std::istream& operator >> (std::istream& is,
136  ComplexNDArray& a);
137 
138  // bool all_elements_are_real (void) const;
139  // bool all_integers (double& max_val, double& min_val) const;
140 
141  ComplexNDArray diag (octave_idx_type k = 0) const;
142 
144 
146  {
148  return *this;
149  }
150 
151 };
152 
153 extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a);
154 
155 MINMAX_DECLS (ComplexNDArray, Complex, OCTAVE_API)
156 
158 NDS_BOOL_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API)
159 
160 SND_CMP_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API)
161 SND_BOOL_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API)
162 
163 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API)
164 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API)
165 
166 MARRAY_FORWARD_DEFS (MArray, ComplexNDArray, Complex)
167 
168 extern OCTAVE_API ComplexNDArray& operator *= (ComplexNDArray& a, double s);
169 extern OCTAVE_API ComplexNDArray& operator /= (ComplexNDArray& a, double s);
170 
171 BSXFUN_STDOP_DECLS (ComplexNDArray, OCTAVE_API)
172 BSXFUN_STDREL_DECLS (ComplexNDArray, OCTAVE_API)
173 
174 BSXFUN_OP_DECL (pow, ComplexNDArray, OCTAVE_API)
175 
176 #endif
dim_vector dimensions
Definition: Array.h:127
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:178
ComplexMatrix ifourier(void) const
Definition: CMatrix.cc:1292
bool all_integers(double &max_val, double &min_val) const
Definition: CNDArray.cc:536
OCTAVE_API ComplexNDArray min(Complex d, const ComplexNDArray &m)
Definition: CNDArray.cc:883
ComplexNDArray(const ComplexNDArray &a)
Definition: CNDArray.h:45
const octave_base_value const Array< octave_idx_type > & ra_idx
bool any_element_is_nan(void) const
Definition: CNDArray.cc:512
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
MArray squeeze(void) const
Definition: MArray.h:81
#define BSXFUN_STDREL_DECLS(ARRAY, API)
Definition: bsxfun-decl.h:51
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:216
#define SND_BOOL_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:197
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:664
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:224
ComplexNDArray ifourierNd(void) const
Definition: CNDArray.cc:176
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:170
void changesign(void)
Definition: MArray.cc:208
ComplexMatrix prod(int dim=-1) const
Definition: CMatrix.cc:3143
bool too_large_for_float(void) const
Definition: CNDArray.cc:586
#define NDS_CMP_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:162
#define SND_CMP_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:189
ComplexMatrix cumprod(int dim=-1) const
Definition: CMatrix.cc:3131
bool all_elements_are_real(void) const
Definition: CNDArray.cc:526
ComplexMatrix cumsum(int dim=-1) const
Definition: CMatrix.cc:3137
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition: Array-util.cc:59
ComplexNDArray(const MArray< U > &a)
Definition: CNDArray.h:48
boolMatrix all(int dim=-1) const
Definition: CMatrix.cc:3119
ComplexNDArray cummin(int dim=-1) const
Definition: CNDArray.cc:711
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
ComplexNDArray & changesign(void)
Definition: CNDArray.h:145
boolMatrix any(int dim=-1) const
Definition: CMatrix.cc:3125
ComplexNDArray squeeze(void) const
Definition: CNDArray.h:122
ComplexMatrix fourier(void) const
Definition: CMatrix.cc:1263
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:55
ComplexNDArray xsum(int dim=-1) const
Definition: CNDArray.cc:628
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:236
ComplexMatrix sumsq(int dim=-1) const
Definition: CMatrix.cc:3155
bool any_element_is_inf_or_nan(void) const
Definition: CNDArray.cc:518
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:400
ComplexNDArray fourierNd(void) const
Definition: CNDArray.cc:161
Handles the reference counting for all the derived classes.
Definition: Array.h:45
ComplexNDArray(void)
Definition: CNDArray.h:38
OCTAVE_API ComplexNDArray max(Complex d, const ComplexNDArray &m)
Definition: CNDArray.cc:883
boolNDArray isfinite(void) const
Definition: CNDArray.cc:741
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexMatrix sum(int dim=-1) const
Definition: CMatrix.cc:3149
ComplexNDArray diff(octave_idx_type order=1, int dim=-1) const
Definition: CNDArray.cc:640
ComplexMatrix ifourier2d(void) const
Definition: CMatrix.cc:1335
boolNDArray isinf(void) const
Definition: CNDArray.cc:735
ComplexNDArray(const dim_vector &dv, const Complex &val)
Definition: CNDArray.h:42
#define BSXFUN_STDOP_DECLS(ARRAY, API)
Definition: bsxfun-decl.h:36
ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:3167
octave_value operator!(const octave_value &a)
Definition: ov.h:1293
std::complex< double > Complex
Definition: oct-cmplx.h:29
#define MINMAX_DECLS(T, S, API)
Definition: mx-op-decl.h:286
T abs(T x)
Definition: pr-output.cc:3062
ComplexNDArray cummax(int dim=-1) const
Definition: CNDArray.cc:699
ComplexNDArray(const dim_vector &dv)
Definition: CNDArray.h:40
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:65
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition: bsxfun-decl.h:27
Array< Complex > index(const idx_vector &i) const
Indexing without resizing.
boolNDArray isnan(void) const
Definition: CNDArray.cc:729
ComplexMatrix fourier2d(void) const
Definition: CMatrix.cc:1321
ComplexNDArray(const Array< U > &a)
Definition: CNDArray.h:51
OCTAVE_API ComplexNDArray conj(const ComplexNDArray &a)
Definition: CNDArray.cc:747