GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
CNDArray.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2003-2026 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_CNDArray_h)
27#define octave_CNDArray_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
36class OCTAVE_API ComplexNDArray : public MArray<Complex>
37{
38public:
39
41
42 ComplexNDArray (const dim_vector& dv) : MArray<Complex> (dv) { }
43
44 ComplexNDArray (const dim_vector& dv, const Complex& val)
45 : MArray<Complex> (dv, val) { }
46
48
49 template <typename U>
50 ComplexNDArray (const MArray<U>& a) : MArray<Complex> (a) { }
51
52 template <typename U>
53 ComplexNDArray (const Array<U>& a) : MArray<Complex> (a) { }
54
56
58 {
60 return *this;
61 }
62
63 ~ComplexNDArray () = default;
64
65 // unary operations
66
68
69 // other operations
70
71 OCTAVE_API bool any_element_is_nan () const;
72 OCTAVE_API bool any_element_is_inf_or_nan () const;
73 OCTAVE_API bool all_elements_are_real () const;
74 OCTAVE_API bool all_integers (double& max_val, double& min_val) const;
75 OCTAVE_API bool too_large_for_float () const;
76
77 OCTAVE_API boolNDArray all (int dim = -1) const;
78 OCTAVE_API boolNDArray any (int dim = -1) const;
79
80 OCTAVE_API ComplexNDArray flip (int dim = -1) const;
81 OCTAVE_API ComplexNDArray cumprod (int dim = -1, bool nanflag = false) const;
82 OCTAVE_API ComplexNDArray cumsum (int dim = -1, bool nanflag = false) const;
83 OCTAVE_API ComplexNDArray prod (int dim = -1, bool nanflag = false) const;
84 OCTAVE_API ComplexNDArray sum (int dim = -1, bool nanflag = false) const;
85 OCTAVE_API ComplexNDArray xsum (int dim = -1, bool nanflag = false) const;
86 OCTAVE_API ComplexNDArray sumsq (int dim = -1, bool nanflag = false) const;
90 concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx);
91
93 max (int dim = -1, bool nanflag = true, bool realabs = false) const;
95 bool nanflag = true, bool realabs = false) const;
97 min (int dim = -1, bool nanflag = true, bool realabs = false) const;
99 bool nanflag = true, bool realabs = false) const;
100
102 cummax (int dim = -1, bool nanflag = true, bool realabs = false) const;
104 cummax (Array<octave_idx_type>& index, int dim = -1,
105 bool nanflag = true, bool realabs = false) const;
107 cummin (int dim = -1, bool nanflag = true, bool realabs = false) const;
109 cummin (Array<octave_idx_type>& index, int dim = -1,
110 bool nanflag = true, bool realabs = false) const;
111
113 diff (octave_idx_type order = 1, int dim = -1) const;
114
121
122 OCTAVE_API NDArray abs () const;
126
128
129 OCTAVE_API ComplexNDArray fourier (int dim = 1) const;
130 OCTAVE_API ComplexNDArray ifourier (int dim = 1) const;
131
132 OCTAVE_API ComplexNDArray fourier2d () const;
133 OCTAVE_API ComplexNDArray ifourier2d () const;
134
135 OCTAVE_API ComplexNDArray fourierNd () const;
136 OCTAVE_API ComplexNDArray ifourierNd () const;
137
139
140 static OCTAVE_API void
142 const dim_vector& dimensions,
143 int start_dimension = 0);
144
147 const dim_vector& dimensions);
148
149 // i/o
150
151 friend OCTAVE_API std::ostream& operator << (std::ostream& os,
152 const ComplexNDArray& a);
153 friend OCTAVE_API std::istream& operator >> (std::istream& is,
154 ComplexNDArray& a);
155
156 // bool all_elements_are_real () const;
157 // bool all_integers (double& max_val, double& min_val) const;
158
160
162
164 {
166 return *this;
167 }
168
169};
170
172
174
177
180
183
185
186extern OCTAVE_API ComplexNDArray& operator *= (ComplexNDArray& a, double s);
187extern OCTAVE_API ComplexNDArray& operator /= (ComplexNDArray& a, double s);
188
191
193
194#endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition Array-util.cc:60
ComplexColumnVector conj(const ComplexColumnVector &a)
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition CNDArray.cc:424
ComplexNDArray conj(const ComplexNDArray &a)
Definition CNDArray.cc:518
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition MArray.h:137
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
#define BSXFUN_STDREL_DECLS(ARRAY, API)
Definition bsxfun-decl.h:64
#define BSXFUN_STDOP_DECLS(ARRAY, API)
Definition bsxfun-decl.h:45
#define BSXFUN_OP_DECL(OP, ARRAY, API)
Definition bsxfun-decl.h:29
charNDArray max(char d, const charNDArray &m)
Definition chNDArray.cc:230
charNDArray min(char d, const charNDArray &m)
Definition chNDArray.cc:207
N Dimensional Array with copy-on-write semantics.
Definition Array-base.h:130
Array< T, Alloc > & insert(const Array< T, Alloc > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
Array< T, Alloc > diag(octave_idx_type k=0) const
Get the kth super or subdiagonal.
octave_idx_type compute_index(octave_idx_type i, octave_idx_type j) const
ComplexNDArray(const Array< U > &a)
Definition CNDArray.h:53
ComplexNDArray squeeze() const
Definition CNDArray.h:138
ComplexNDArray & changesign()
Definition CNDArray.h:163
ComplexNDArray(const dim_vector &dv, const Complex &val)
Definition CNDArray.h:44
ComplexNDArray(const ComplexNDArray &a)
Definition CNDArray.h:47
~ComplexNDArray()=default
ComplexNDArray(const MArray< U > &a)
Definition CNDArray.h:50
ComplexNDArray(const dim_vector &dv)
Definition CNDArray.h:42
Template for N-dimensional array classes with like-type math operators.
Definition MArray.h:61
MArray< T > & operator=(const MArray< T > &a)
Definition MArray.h:84
MArray squeeze() const
Definition MArray.h:102
void changesign()
Definition MArray.cc:217
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:92
bool too_large_for_float(double x)
Definition lo-utils.cc:56
#define OCTAVE_API
Definition main.in.cc:55
bool isfinite(double x)
Definition mappers.h:229
bool isinf(double x)
Definition mappers.h:212
bool isnan(bool)
Definition mappers.h:192
#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< double > Complex
Definition oct-cmplx.h:33
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:1646
template int8_t abs(int8_t)