GNU Octave  3.8.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-2013 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 #include "CMatrix.h"
28 
29 #include "mx-defs.h"
30 #include "mx-op-decl.h"
31 #include "bsxfun-decl.h"
32 
33 class
34 OCTAVE_API
36 {
37 public:
38 
40 
41  ComplexNDArray (void) : MArray<Complex> () { }
42 
43  ComplexNDArray (const dim_vector& dv) : MArray<Complex> (dv) { }
44 
45  ComplexNDArray (const dim_vector& dv, const Complex& val)
46  : MArray<Complex> (dv, val) { }
47 
49 
51 
52  template <class U>
53  ComplexNDArray (const MArray<U>& a) : MArray<Complex> (a) { }
54 
55  template <class U>
56  ComplexNDArray (const Array<U>& a) : MArray<Complex> (a) { }
57 
58  ComplexNDArray (const charNDArray&);
59 
61  {
63  return *this;
64  }
65 
66  // unary operations
67 
68  boolNDArray operator ! (void) const;
69 
70  // FIXME: this is not quite the right thing.
71 
72  bool any_element_is_nan (void) const;
73  bool any_element_is_inf_or_nan (void) const;
74  bool all_elements_are_real (void) const;
75  bool all_integers (double& max_val, double& min_val) const;
76  bool too_large_for_float (void) const;
77 
78  boolNDArray all (int dim = -1) const;
79  boolNDArray any (int dim = -1) const;
80 
81  ComplexNDArray cumprod (int dim = -1) const;
82  ComplexNDArray cumsum (int dim = -1) const;
83  ComplexNDArray prod (int dim = -1) const;
84  ComplexNDArray sum (int dim = -1) const;
85  ComplexNDArray xsum (int dim = -1) const;
86  ComplexNDArray sumsq (int dim = -1) const;
88  const Array<octave_idx_type>& ra_idx);
89  ComplexNDArray concat (const NDArray& rb,
90  const Array<octave_idx_type>& ra_idx);
91 
92  ComplexNDArray max (int dim = -1) const;
93  ComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
94  ComplexNDArray min (int dim = -1) const;
95  ComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
96 
97  ComplexNDArray cummax (int dim = -1) const;
98  ComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const;
99  ComplexNDArray cummin (int dim = -1) const;
100  ComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const;
101 
102  ComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const;
103 
104  ComplexNDArray& insert (const NDArray& a,
109  const Array<octave_idx_type>& ra_idx);
110 
111  NDArray abs (void) const;
112  boolNDArray isnan (void) const;
113  boolNDArray isinf (void) const;
114  boolNDArray isfinite (void) const;
115 
116  friend OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a);
117 
118  ComplexNDArray fourier (int dim = 1) const;
119  ComplexNDArray ifourier (int dim = 1) const;
120 
121  ComplexNDArray fourier2d (void) const;
122  ComplexNDArray ifourier2d (void) const;
123 
124  ComplexNDArray fourierNd (void) const;
125  ComplexNDArray ifourierNd (void) const;
126 
127  ComplexMatrix matrix_value (void) const;
128 
129  ComplexNDArray squeeze (void) const { return MArray<Complex>::squeeze (); }
130 
131  static void increment_index (Array<octave_idx_type>& ra_idx,
132  const dim_vector& dimensions,
133  int start_dimension = 0);
134 
136  const dim_vector& dimensions);
137 
138  // i/o
139 
140  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
141  const ComplexNDArray& a);
142  friend OCTAVE_API std::istream& operator >> (std::istream& is,
143  ComplexNDArray& a);
144 
145  // bool all_elements_are_real (void) const;
146  // bool all_integers (double& max_val, double& min_val) const;
147 
148  ComplexNDArray diag (octave_idx_type k = 0) const;
149 
151 
153  {
155  return *this;
156  }
157 
158 };
159 
160 extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a);
161 
162 MINMAX_DECLS (ComplexNDArray, Complex, OCTAVE_API)
163 
165 NDS_BOOL_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API)
166 
167 SND_CMP_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API)
168 SND_BOOL_OP_DECLS (Complex, ComplexNDArray, OCTAVE_API)
169 
170 NDND_CMP_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API)
171 NDND_BOOL_OP_DECLS (ComplexNDArray, ComplexNDArray, OCTAVE_API)
172 
173 MARRAY_FORWARD_DEFS (MArray, ComplexNDArray, Complex)
174 
175 extern OCTAVE_API ComplexNDArray& operator *= (ComplexNDArray& a, double s);
176 extern OCTAVE_API ComplexNDArray& operator /= (ComplexNDArray& a, double s);
177 
178 BSXFUN_STDOP_DECLS (ComplexNDArray, OCTAVE_API)
179 BSXFUN_STDREL_DECLS (ComplexNDArray, OCTAVE_API)
180 
181 BSXFUN_OP_DECL (pow, ComplexNDArray, OCTAVE_API)
182 
183 #endif