GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
fCNDArray.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2003-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_fCNDArray_h)
27 #define octave_fCNDArray_h 1
28 
29 #include "octave-config.h"
30 
31 #include "MArray.h"
32 #include "bsxfun-decl.h"
33 #include "mx-defs.h"
34 #include "mx-op-decl.h"
35 
36 class
39 {
40 public:
41 
43 
45 
47  : MArray<FloatComplex> (dv, val) { }
48 
50  : MArray<FloatComplex> (a) { }
51 
52  template <typename U>
54 
55  template <typename U>
57 
59 
61  {
63  return *this;
64  }
65 
66  ~FloatComplexNDArray () = default;
67 
68  // unary operations
69 
71 
72  // FIXME: this is not quite the right thing.
73 
74  OCTAVE_API bool any_element_is_nan () const;
75  OCTAVE_API bool any_element_is_inf_or_nan () const;
76  OCTAVE_API bool all_elements_are_real () const;
77  OCTAVE_API bool all_integers (float& max_val, float& min_val) const;
78  OCTAVE_API bool too_large_for_float () const;
79 
80  OCTAVE_API boolNDArray all (int dim = -1) const;
81  OCTAVE_API boolNDArray any (int dim = -1) const;
82 
83  OCTAVE_API FloatComplexNDArray cumprod (int dim = -1) const;
84  OCTAVE_API FloatComplexNDArray cumsum (int dim = -1) const;
85  OCTAVE_API FloatComplexNDArray prod (int dim = -1) const;
86  OCTAVE_API ComplexNDArray dprod (int dim = -1) const;
87  OCTAVE_API FloatComplexNDArray sum (int dim = -1) const;
88  OCTAVE_API ComplexNDArray dsum (int dim = -1) const;
89  OCTAVE_API FloatComplexNDArray sumsq (int dim = -1) const;
94 
95  OCTAVE_API FloatComplexNDArray max (int dim = -1) const;
97  max (Array<octave_idx_type>& index, int dim = -1) const;
98  OCTAVE_API FloatComplexNDArray min (int dim = -1) const;
100  min (Array<octave_idx_type>& index, int dim = -1) const;
101 
102  OCTAVE_API FloatComplexNDArray cummax (int dim = -1) const;
104  cummax (Array<octave_idx_type>& index, int dim = -1) const;
105  OCTAVE_API FloatComplexNDArray cummin (int dim = -1) const;
107  cummin (Array<octave_idx_type>& index, int dim = -1) const;
108 
110  diff (octave_idx_type order = 1, int dim = -1) const;
111 
113  insert (const NDArray& a, octave_idx_type r, octave_idx_type c);
117  insert (const FloatComplexNDArray& a, const Array<octave_idx_type>& ra_idx);
118 
119  OCTAVE_API FloatNDArray abs () const;
120  OCTAVE_API boolNDArray isnan () const;
121  OCTAVE_API boolNDArray isinf () const;
123 
125 
126  OCTAVE_API FloatComplexNDArray fourier (int dim = 1) const;
127  OCTAVE_API FloatComplexNDArray ifourier (int dim = 1) const;
128 
129  OCTAVE_API FloatComplexNDArray fourier2d () const;
130  OCTAVE_API FloatComplexNDArray ifourier2d () const;
131 
132  OCTAVE_API FloatComplexNDArray fourierNd () const;
133  OCTAVE_API FloatComplexNDArray ifourierNd () const;
134 
136  { return MArray<FloatComplex>::squeeze (); }
137 
138  static OCTAVE_API void
140  const dim_vector& dimensions, int start_dimension = 0);
141 
144 
145  // i/o
146 
147  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
148  const FloatComplexNDArray& a);
149  friend OCTAVE_API std::istream& operator >> (std::istream& is,
151 
152  // bool all_elements_are_real () const;
153  // bool all_integers (float& max_val, float& min_val) const;
154 
156 
158  diag (octave_idx_type m, octave_idx_type n) const;
159 
161  {
163  return *this;
164  }
165 
166 };
167 
169 
171 
174 
177 
180 
182 
183 extern OCTAVE_API FloatComplexNDArray& operator *= (FloatComplexNDArray& a,
184  float s);
185 extern OCTAVE_API FloatComplexNDArray& operator /= (FloatComplexNDArray& a,
186  float s);
187 
190 
192 
193 #endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:177
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition: Array-util.cc:60
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:418
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:130
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
#define BSXFUN_STDREL_DECLS(ARRAY, API)
Definition: bsxfun-decl.h:53
#define BSXFUN_STDOP_DECLS(ARRAY, API)
Definition: bsxfun-decl.h:38
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition: bsxfun-decl.h:29
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:130
~FloatComplexNDArray()=default
FloatComplexNDArray(const dim_vector &dv, const FloatComplex &val)
Definition: fCNDArray.h:46
FloatComplexNDArray(const Array< U > &a)
Definition: fCNDArray.h:56
FloatComplexNDArray(const MArray< U > &a)
Definition: fCNDArray.h:53
FloatComplexNDArray(const dim_vector &dv)
Definition: fCNDArray.h:44
FloatComplexNDArray squeeze() const
Definition: fCNDArray.h:135
FloatComplexNDArray(const FloatComplexNDArray &a)
Definition: fCNDArray.h:49
FloatComplexNDArray & changesign()
Definition: fCNDArray.h:160
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:81
MArray squeeze() const
Definition: MArray.h:97
void changesign()
Definition: MArray.cc:217
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
FloatComplexNDArray max(FloatComplex d, const FloatComplexNDArray &m)
Definition: fCNDArray.cc:647
FloatComplexNDArray conj(const FloatComplexNDArray &a)
Definition: fCNDArray.cc:514
FloatComplexNDArray min(FloatComplex d, const FloatComplexNDArray &m)
Definition: fCNDArray.cc:647
bool isfinite(double x)
Definition: lo-mappers.h:192
bool isinf(double x)
Definition: lo-mappers.h:203
bool isnan(bool)
Definition: lo-mappers.h:178
bool too_large_for_float(double x)
Definition: lo-utils.cc:56
#define OCTAVE_API
Definition: main.cc:55
T octave_idx_type m
Definition: mx-inlines.cc:781
octave_idx_type n
Definition: mx-inlines.cc:761
T * r
Definition: mx-inlines.cc:781
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:226
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:218
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:172
#define SND_CMP_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:191
#define MINMAX_DECLS(T, S, API)
Definition: mx-op-decl.h:288
#define NDS_CMP_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:164
#define SND_BOOL_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:199
std::complex< float > FloatComplex
Definition: oct-cmplx.h:34
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
const octave_base_value const Array< octave_idx_type > & ra_idx
octave_value operator!(const octave_value &a)
Definition: ov.h:1633
template int8_t abs(int8_t)