GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
lo-specfun.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-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_lo_specfun_h)
27 #define octave_lo_specfun_h 1
28 
29 #include "octave-config.h"
30 
31 #include "mx-fwd.h"
32 
33 #include "Array.h"
34 #include "oct-cmplx.h"
35 
37 
39 
40 inline double acosh (double x) { return std::acosh (x); }
41 inline float acosh (float x) { return std::acoshf (x); }
42 inline Complex acosh (const Complex& x) { return std::acosh (x); }
43 inline FloatComplex acosh (const FloatComplex& x) { return std::acosh (x); }
44 
45 extern OCTAVE_API Complex airy (const Complex& z, bool deriv, bool scaled,
47 extern OCTAVE_API ComplexMatrix airy (const ComplexMatrix& z, bool deriv,
48  bool scaled, Array<octave_idx_type>& ierr);
49 extern OCTAVE_API ComplexNDArray airy (const ComplexNDArray& z, bool deriv,
50  bool scaled, Array<octave_idx_type>& ierr);
51 extern OCTAVE_API FloatComplex airy (const FloatComplex& z, bool deriv,
52  bool scaled, octave_idx_type& ierr);
54  bool deriv, bool scaled, Array<octave_idx_type>& ierr);
56  bool deriv, bool scaled, Array<octave_idx_type>& ierr);
57 
58 inline double asinh (double x) { return std::asinh (x); }
59 inline float asinh (float x) { return std::asinhf (x); }
60 inline Complex asinh (const Complex& x) { return std::asinh (x); }
61 inline FloatComplex asinh (const FloatComplex& x) { return std::asinh (x); }
62 
63 inline double atanh (double x) { return std::atanh (x); }
64 inline float atanh (float x) { return std::atanhf (x); }
65 inline Complex atanh (const Complex& x) { return std::atanh (x); }
66 inline FloatComplex atanh (const FloatComplex& x) { return std::atanh (x); }
67 
68 extern OCTAVE_API Complex besselj (double alpha, const Complex& x, bool scaled,
70 extern OCTAVE_API Complex bessely (double alpha, const Complex& x, bool scaled,
72 extern OCTAVE_API Complex besseli (double alpha, const Complex& x, bool scaled,
74 extern OCTAVE_API Complex besselk (double alpha, const Complex& x, bool scaled,
76 extern OCTAVE_API Complex besselh1 (double alpha, const Complex& x, bool scaled,
78 extern OCTAVE_API Complex besselh2 (double alpha, const Complex& x, bool scaled,
80 
81 extern OCTAVE_API ComplexMatrix besselj (double alpha, const ComplexMatrix& x,
82  bool scaled, Array<octave_idx_type>& ierr);
83 extern OCTAVE_API ComplexMatrix bessely (double alpha, const ComplexMatrix& x,
84  bool scaled, Array<octave_idx_type>& ierr);
85 extern OCTAVE_API ComplexMatrix besseli (double alpha, const ComplexMatrix& x,
86  bool scaled, Array<octave_idx_type>& ierr);
87 extern OCTAVE_API ComplexMatrix besselk (double alpha, const ComplexMatrix& x,
88  bool scaled, Array<octave_idx_type>& ierr);
89 extern OCTAVE_API ComplexMatrix besselh1 (double alpha, const ComplexMatrix& x,
90  bool scaled, Array<octave_idx_type>& ierr);
91 extern OCTAVE_API ComplexMatrix besselh2 (double alpha, const ComplexMatrix& x,
92  bool scaled, Array<octave_idx_type>& ierr);
93 
94 extern OCTAVE_API ComplexMatrix besselj (const Matrix& alpha, const Complex& x,
95  bool scaled, Array<octave_idx_type>& ierr);
96 extern OCTAVE_API ComplexMatrix bessely (const Matrix& alpha, const Complex& x,
97  bool scaled, Array<octave_idx_type>& ierr);
98 extern OCTAVE_API ComplexMatrix besseli (const Matrix& alpha, const Complex& x,
99  bool scaled, Array<octave_idx_type>& ierr);
100 extern OCTAVE_API ComplexMatrix besselk (const Matrix& alpha, const Complex& x,
101  bool scaled, Array<octave_idx_type>& ierr);
102 extern OCTAVE_API ComplexMatrix besselh1 (const Matrix& alpha, const Complex& x,
103  bool scaled, Array<octave_idx_type>& ierr);
104 extern OCTAVE_API ComplexMatrix besselh2 (const Matrix& alpha, const Complex& x,
105  bool scaled, Array<octave_idx_type>& ierr);
106 
107 extern OCTAVE_API ComplexMatrix besselj (const Matrix& alpha,
108  const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
109 extern OCTAVE_API ComplexMatrix bessely (const Matrix& alpha,
110  const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
111 extern OCTAVE_API ComplexMatrix besseli (const Matrix& alpha,
112  const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
113 extern OCTAVE_API ComplexMatrix besselk (const Matrix& alpha,
114  const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
115 extern OCTAVE_API ComplexMatrix besselh1 (const Matrix& alpha,
116  const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
117 extern OCTAVE_API ComplexMatrix besselh2 (const Matrix& alpha,
118  const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
119 
120 extern OCTAVE_API ComplexNDArray besselj (double alpha, const ComplexNDArray& x,
121  bool scaled, Array<octave_idx_type>& ierr);
122 extern OCTAVE_API ComplexNDArray bessely (double alpha, const ComplexNDArray& x,
123  bool scaled, Array<octave_idx_type>& ierr);
124 extern OCTAVE_API ComplexNDArray besseli (double alpha, const ComplexNDArray& x,
125  bool scaled, Array<octave_idx_type>& ierr);
126 extern OCTAVE_API ComplexNDArray besselk (double alpha, const ComplexNDArray& x,
127  bool scaled, Array<octave_idx_type>& ierr);
128 extern OCTAVE_API ComplexNDArray besselh1 (double alpha,
129  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
130 extern OCTAVE_API ComplexNDArray besselh2 (double alpha,
131  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
132 
133 extern OCTAVE_API ComplexNDArray besselj (const NDArray& alpha,
134  const Complex& x, bool scaled, Array<octave_idx_type>& ierr);
135 extern OCTAVE_API ComplexNDArray bessely (const NDArray& alpha,
136  const Complex& x, bool scaled, Array<octave_idx_type>& ierr);
137 extern OCTAVE_API ComplexNDArray besseli (const NDArray& alpha,
138  const Complex& x, bool scaled, Array<octave_idx_type>& ierr);
139 extern OCTAVE_API ComplexNDArray besselk (const NDArray& alpha,
140  const Complex& x, bool scaled, Array<octave_idx_type>& ierr);
141 extern OCTAVE_API ComplexNDArray besselh1 (const NDArray& alpha,
142  const Complex& x, bool scaled, Array<octave_idx_type>& ierr);
143 extern OCTAVE_API ComplexNDArray besselh2 (const NDArray& alpha,
144  const Complex& x, bool scaled, Array<octave_idx_type>& ierr);
145 
146 extern OCTAVE_API ComplexNDArray besselj (const NDArray& alpha,
147  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
148 extern OCTAVE_API ComplexNDArray bessely (const NDArray& alpha,
149  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
150 extern OCTAVE_API ComplexNDArray besseli (const NDArray& alpha,
151  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
152 extern OCTAVE_API ComplexNDArray besselk (const NDArray& alpha,
153  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
154 extern OCTAVE_API ComplexNDArray besselh1 (const NDArray& alpha,
155  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
156 extern OCTAVE_API ComplexNDArray besselh2 (const NDArray& alpha,
157  const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
158 
159 extern OCTAVE_API ComplexMatrix besselj (const RowVector& alpha,
160  const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
161 extern OCTAVE_API ComplexMatrix bessely (const RowVector& alpha,
162  const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
163 extern OCTAVE_API ComplexMatrix besseli (const RowVector& alpha,
164  const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
165 extern OCTAVE_API ComplexMatrix besselk (const RowVector& alpha,
166  const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
167 extern OCTAVE_API ComplexMatrix besselh1 (const RowVector& alpha,
168  const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
169 extern OCTAVE_API ComplexMatrix besselh2 (const RowVector& alpha,
170  const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
171 
172 extern OCTAVE_API FloatComplex besselj (float alpha, const FloatComplex& x,
173  bool scaled, octave_idx_type& ierr);
174 extern OCTAVE_API FloatComplex bessely (float alpha, const FloatComplex& x,
175  bool scaled, octave_idx_type& ierr);
176 extern OCTAVE_API FloatComplex besseli (float alpha, const FloatComplex& x,
177  bool scaled, octave_idx_type& ierr);
178 extern OCTAVE_API FloatComplex besselk (float alpha, const FloatComplex& x,
179  bool scaled, octave_idx_type& ierr);
180 extern OCTAVE_API FloatComplex besselh1 (float alpha, const FloatComplex& x,
181  bool scaled, octave_idx_type& ierr);
182 extern OCTAVE_API FloatComplex besselh2 (float alpha, const FloatComplex& x,
183  bool scaled, octave_idx_type& ierr);
184 
185 extern OCTAVE_API FloatComplexMatrix besselj (float alpha,
186  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
187 extern OCTAVE_API FloatComplexMatrix bessely (float alpha,
188  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
189 extern OCTAVE_API FloatComplexMatrix besseli (float alpha,
190  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
191 extern OCTAVE_API FloatComplexMatrix besselk (float alpha,
192  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
193 extern OCTAVE_API FloatComplexMatrix besselh1 (float alpha,
194  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
195 extern OCTAVE_API FloatComplexMatrix besselh2 (float alpha,
196  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
197 
198 extern OCTAVE_API FloatComplexMatrix besselj (const FloatMatrix& alpha,
199  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
200 extern OCTAVE_API FloatComplexMatrix bessely (const FloatMatrix& alpha,
201  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
202 extern OCTAVE_API FloatComplexMatrix besseli (const FloatMatrix& alpha,
203  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
204 extern OCTAVE_API FloatComplexMatrix besselk (const FloatMatrix& alpha,
205  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
207  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
209  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
210 
211 extern OCTAVE_API FloatComplexMatrix besselj (const FloatMatrix& alpha,
212  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
213 extern OCTAVE_API FloatComplexMatrix bessely (const FloatMatrix& alpha,
214  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
215 extern OCTAVE_API FloatComplexMatrix besseli (const FloatMatrix& alpha,
216  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
217 extern OCTAVE_API FloatComplexMatrix besselk (const FloatMatrix& alpha,
218  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
220  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
222  const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr);
223 
224 extern OCTAVE_API FloatComplexNDArray besselj (float alpha,
225  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
226 extern OCTAVE_API FloatComplexNDArray bessely (float alpha,
227  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
228 extern OCTAVE_API FloatComplexNDArray besseli (float alpha,
229  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
230 extern OCTAVE_API FloatComplexNDArray besselk (float alpha,
231  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
232 extern OCTAVE_API FloatComplexNDArray besselh1 (float alpha,
233  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
234 extern OCTAVE_API FloatComplexNDArray besselh2 (float alpha,
235  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
236 
238  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
240  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
242  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
244  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
246  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
248  const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr);
249 
251  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
253  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
255  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
257  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
259  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
261  const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr);
262 
264  const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
266  const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
268  const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
270  const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
272  const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
274  const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr);
275 
276 extern OCTAVE_API Complex biry (const Complex& z, bool deriv, bool scaled,
278 extern OCTAVE_API ComplexMatrix biry (const ComplexMatrix& z, bool deriv,
279  bool scaled, Array<octave_idx_type>& ierr);
280 extern OCTAVE_API ComplexNDArray biry (const ComplexNDArray& z, bool deriv,
281  bool scaled, Array<octave_idx_type>& ierr);
282 extern OCTAVE_API FloatComplex biry (const FloatComplex& z, bool deriv,
283  bool scaled, octave_idx_type& ierr);
285  bool deriv, bool scaled, Array<octave_idx_type>& ierr);
287  bool deriv, bool scaled, Array<octave_idx_type>& ierr);
288 
289 inline double cbrt (double x) { return std::cbrt (x); }
290 inline float cbrt (float x) { return std::cbrtf (x); }
291 
292 extern OCTAVE_API double dawson (double x);
293 extern OCTAVE_API float dawson (float x);
294 extern OCTAVE_API Complex dawson (const Complex& x);
296 
297 extern OCTAVE_API void ellipj (double u, double m, double& sn, double& cn,
298  double& dn, double& err);
299 extern OCTAVE_API void ellipj (const Complex& u, double m, Complex& sn,
300  Complex& cn, Complex& dn, double& err);
301 
302 inline double erf (double x) { return std::erf (x); }
303 inline float erf (float x) { return std::erff (x); }
304 extern OCTAVE_API Complex erf (const Complex& x);
305 extern OCTAVE_API FloatComplex erf (const FloatComplex& x);
306 
307 inline double erfc (double x) { return std::erfc (x); }
308 inline float erfc (float x) { return std::erfcf (x); }
309 extern OCTAVE_API Complex erfc (const Complex& x);
310 extern OCTAVE_API FloatComplex erfc (const FloatComplex& x);
311 
312 extern OCTAVE_API double erfcinv (double x);
313 extern OCTAVE_API float erfcinv (float x);
314 
315 extern OCTAVE_API double erfcx (double x);
316 extern OCTAVE_API float erfcx (float x);
317 extern OCTAVE_API Complex erfcx (const Complex& x);
318 extern OCTAVE_API FloatComplex erfcx (const FloatComplex& x);
319 
320 extern OCTAVE_API double erfi (double x);
321 extern OCTAVE_API float erfi (float x);
322 extern OCTAVE_API Complex erfi (const Complex& x);
323 extern OCTAVE_API FloatComplex erfi (const FloatComplex& x);
324 
325 extern OCTAVE_API double erfinv (double x);
326 extern OCTAVE_API float erfinv (float x);
327 
328 inline double expm1 (double x) { return std::expm1 (x); }
329 inline float expm1 (float x) { return std::expm1f (x); }
330 extern OCTAVE_API Complex expm1 (const Complex& x);
331 extern OCTAVE_API FloatComplex expm1 (const FloatComplex& x);
332 
333 extern OCTAVE_API double gamma (double x);
334 extern OCTAVE_API float gamma (float x);
335 
336 inline double lgamma (double x) { return std::lgamma (x); }
337 inline float lgamma (float x) { return std::lgammaf (x); }
338 
339 inline double log1p (double x) { return std::log1p (x); }
340 inline float log1p (float x) { return std::log1pf (x); }
341 extern OCTAVE_API Complex log1p (const Complex& x);
342 extern OCTAVE_API FloatComplex log1p (const FloatComplex& x);
343 
344 extern OCTAVE_API double psi (double x);
345 extern OCTAVE_API float psi (float x);
346 extern OCTAVE_API Complex psi (const Complex& x);
347 extern OCTAVE_API FloatComplex psi (const FloatComplex& x);
348 extern OCTAVE_API double psi (octave_idx_type n, double z);
349 extern OCTAVE_API float psi (octave_idx_type n, float z);
350 
351 extern OCTAVE_API Complex rc_lgamma (double x);
352 extern OCTAVE_API FloatComplex rc_lgamma (float x);
353 
354 extern OCTAVE_API Complex rc_log1p (double x);
355 extern OCTAVE_API FloatComplex rc_log1p (float x);
356 
357 OCTAVE_END_NAMESPACE(math)
358 OCTAVE_END_NAMESPACE(octave)
359 
360 #endif
Definition: dMatrix.h:42
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE const F77_INT F77_INT & ierr
F77_RET_T const F77_DBLE * x
double erfc(double x)
Definition: lo-specfun.h:307
Complex besselj(double alpha, const Complex &x, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:788
double erfinv(double x)
Definition: lo-specfun.cc:1823
double erfi(double x)
Definition: lo-specfun.cc:1731
Complex besselh2(double alpha, const Complex &x, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:793
double gamma(double x)
Definition: lo-specfun.cc:1873
double dawson(double x)
Definition: lo-specfun.cc:1467
double psi(double x)
Definition: lo-specfun.cc:2061
double erfcinv(double x)
Definition: lo-specfun.cc:1697
Complex rc_log1p(double x)
Definition: lo-specfun.cc:2215
Complex bessely(double alpha, const Complex &x, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:789
Complex besselk(double alpha, const Complex &x, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:791
double cbrt(double x)
Definition: lo-specfun.h:289
Complex besselh1(double alpha, const Complex &x, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:792
double asinh(double x)
Definition: lo-specfun.h:58
Complex rc_lgamma(double x)
Definition: lo-specfun.cc:2177
double erf(double x)
Definition: lo-specfun.h:302
double atanh(double x)
Definition: lo-specfun.h:63
double log1p(double x)
Definition: lo-specfun.h:339
Complex airy(const Complex &z, bool deriv, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:129
double acosh(double x)
Definition: lo-specfun.h:40
double erfcx(double x)
Definition: lo-specfun.cc:1710
double lgamma(double x)
Definition: lo-specfun.h:336
void ellipj(double u, double m, double &sn, double &cn, double &dn, double &err)
Definition: lo-specfun.cc:1487
Complex besseli(double alpha, const Complex &x, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:790
double expm1(double x)
Definition: lo-specfun.h:328
Complex biry(const Complex &z, bool deriv, bool scaled, octave_idx_type &ierr)
Definition: lo-specfun.cc:1351
#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
std::complex< double > Complex
Definition: oct-cmplx.h:33
std::complex< float > FloatComplex
Definition: oct-cmplx.h:34