Mercurial > octave
annotate liboctave/numeric/lo-specfun.cc @ 22135:407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
* f77-fcn.h (F77_DBLE_CMPLX, F77_CMPLX): Use C types instead of
typedefs for std::complex<T> types.
(F77_CMPLX_ARG, F77_CONST_CMPLX_ARG, F77_DBLE_CMPLX_ARG,
F77_CONST_DBLE_CMPLX_ARG): New macros.
* dot.cc, ordschur.cc, qz.cc, CColVector.cc, CMatrix.cc,
CRowVector.cc, CSparse.cc, dSparse.cc, fCColVector.cc, fCMatrix.cc,
fCRowVector.cc, f77-fcn.h, EIG.cc, aepbalance.cc, chol.cc,
eigs-base.cc, fEIG.cc, gepbalance.cc, hess.cc, lo-specfun.cc, lu.cc,
oct-convn.cc, qr.cc, qrp.cc, schur.cc, svd.cc: Use new macros for
passing complex arguments to Fortran function. Always pass pointers
to complex arguments.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 18 Jul 2016 09:38:57 -0400 |
parents | 59cadee1c74b |
children | e43d83253e28 |
rev | line source |
---|---|
3146 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19410
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
4 Copyright (C) 2007-2010 D. Martin |
10391
59e34bcdff13
implement built-in erfcx
Jaroslav Hajek <highegg@gmail.com>
parents:
10352
diff
changeset
|
5 Copyright (C) 2010 Jaroslav Hajek |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10414
diff
changeset
|
6 Copyright (C) 2010 VZLU Prague |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
7 Copyright (C) 2015 Carnë Draug |
3146 | 8 |
9 This file is part of Octave. | |
10 | |
11 Octave is free software; you can redistribute it and/or modify it | |
12 under the terms of the GNU General Public License as published by the | |
7016 | 13 Free Software Foundation; either version 3 of the License, or (at your |
14 option) any later version. | |
3146 | 15 |
16 Octave is distributed in the hope that it will be useful, but WITHOUT | |
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
19 for more details. | |
20 | |
21 You should have received a copy of the GNU General Public License | |
7016 | 22 along with Octave; see the file COPYING. If not, see |
23 <http://www.gnu.org/licenses/>. | |
3146 | 24 |
25 */ | |
26 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21723
diff
changeset
|
27 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21231
diff
changeset
|
28 # include "config.h" |
3146 | 29 #endif |
30 | |
31 #include "Range.h" | |
3220 | 32 #include "CColVector.h" |
33 #include "CMatrix.h" | |
34 #include "dRowVector.h" | |
3146 | 35 #include "dMatrix.h" |
4844 | 36 #include "dNDArray.h" |
37 #include "CNDArray.h" | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
38 #include "fCColVector.h" |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
39 #include "fCMatrix.h" |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
40 #include "fRowVector.h" |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
41 #include "fMatrix.h" |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
42 #include "fNDArray.h" |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
43 #include "fCNDArray.h" |
3146 | 44 #include "f77-fcn.h" |
45 #include "lo-error.h" | |
3220 | 46 #include "lo-ieee.h" |
47 #include "lo-specfun.h" | |
3146 | 48 #include "mx-inlines.cc" |
5701 | 49 #include "lo-mappers.h" |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
50 #include "lo-math.h" |
3146 | 51 |
15696
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15271
diff
changeset
|
52 #include "Faddeeva.hh" |
2fac72a256ce
Add complex erf,erfc,erfcx,erfi,dawson routines from Faddeeva package.
Steven G. Johnson <stevenj@alum.mit.edu>
parents:
15271
diff
changeset
|
53 |
3146 | 54 extern "C" |
55 { | |
4552 | 56 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
57 F77_FUNC (zbesj, ZBESJ) (const F77_DBLE&, const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
58 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
59 F77_DBLE*, F77_DBLE*, F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
60 F77_INT&); |
3146 | 61 |
4552 | 62 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
63 F77_FUNC (zbesy, ZBESY) (const F77_DBLE&, const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
64 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
65 F77_DBLE*, F77_DBLE*, F77_INT&, F77_DBLE*, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
66 F77_DBLE*, F77_INT&); |
3220 | 67 |
4552 | 68 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
69 F77_FUNC (zbesi, ZBESI) (const F77_DBLE&, const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
70 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
71 F77_DBLE*, F77_DBLE*, F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
72 F77_INT&); |
3146 | 73 |
4552 | 74 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
75 F77_FUNC (zbesk, ZBESK) (const F77_DBLE&, const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
76 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
77 F77_DBLE*, F77_DBLE*, F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
78 F77_INT&); |
3220 | 79 |
4552 | 80 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
81 F77_FUNC (zbesh, ZBESH) (const F77_DBLE&, const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
82 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
83 const F77_INT&, F77_DBLE*, F77_DBLE*, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
84 F77_INT&, F77_INT&); |
4552 | 85 |
86 F77_RET_T | |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
87 F77_FUNC (cbesj, cBESJ) (const F77_CMPLX*, const F77_REAL&, |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
88 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
89 F77_CMPLX*, F77_INT&, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
90 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
91 F77_RET_T |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
92 F77_FUNC (cbesy, CBESY) (const F77_CMPLX*, const F77_REAL&, |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
93 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
94 F77_CMPLX*, F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
95 F77_CMPLX*, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
96 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
97 F77_RET_T |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
98 F77_FUNC (cbesi, CBESI) (const F77_CMPLX*, const F77_REAL&, |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
99 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
100 F77_CMPLX*, F77_INT&, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
101 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
102 F77_RET_T |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
103 F77_FUNC (cbesk, CBESK) (const F77_CMPLX*, const F77_REAL&, |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
104 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
105 F77_CMPLX*, F77_INT&, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
106 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
107 F77_RET_T |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
108 F77_FUNC (cbesh, CBESH) (const F77_CMPLX*, const F77_REAL&, |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
109 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
110 const F77_INT&, F77_CMPLX*, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
111 F77_INT&, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
112 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
113 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
114 F77_FUNC (zairy, ZAIRY) (const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
115 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
116 F77_DBLE&, F77_DBLE&, F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
117 F77_INT&); |
3146 | 118 |
4552 | 119 F77_RET_T |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
120 F77_FUNC (cairy, CAIRY) (const F77_CMPLX*, const F77_INT&, |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
121 const F77_INT&, F77_CMPLX*, |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
122 F77_INT&, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
123 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
124 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
125 F77_FUNC (zbiry, ZBIRY) (const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
126 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
127 F77_DBLE&, F77_DBLE&, F77_INT&); |
4552 | 128 |
129 F77_RET_T | |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
130 F77_FUNC (cbiry, CBIRY) (const F77_CMPLX*, const F77_INT&, const F77_INT&, |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
131 const F77_CMPLX*, F77_INT&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
132 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
133 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
134 F77_FUNC (xdacosh, XDACOSH) (const F77_DBLE&, F77_DBLE&); |
3220 | 135 |
4552 | 136 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
137 F77_FUNC (xacosh, XACOSH) (const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
138 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
139 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
140 F77_FUNC (xdasinh, XDASINH) (const F77_DBLE&, F77_DBLE&); |
3146 | 141 |
4552 | 142 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
143 F77_FUNC (xasinh, XASINH) (const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
144 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
145 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
146 F77_FUNC (xdatanh, XDATANH) (const F77_DBLE&, F77_DBLE&); |
3146 | 147 |
4552 | 148 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
149 F77_FUNC (xatanh, XATANH) (const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
150 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
151 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
152 F77_FUNC (xderf, XDERF) (const F77_DBLE&, F77_DBLE&); |
3146 | 153 |
4552 | 154 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
155 F77_FUNC (xerf, XERF) (const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
156 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
157 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
158 F77_FUNC (xderfc, XDERFC) (const F77_DBLE&, F77_DBLE&); |
3146 | 159 |
4552 | 160 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
161 F77_FUNC (xerfc, XERFC) (const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
162 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
163 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
164 F77_FUNC (xdbetai, XDBETAI) (const F77_DBLE&, const F77_DBLE&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
165 const F77_DBLE&, F77_DBLE&); |
3146 | 166 |
4552 | 167 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
168 F77_FUNC (xbetai, XBETAI) (const F77_REAL&, const F77_REAL&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
169 const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
170 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
171 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
172 F77_FUNC (xdgamma, XDGAMMA) (const F77_DBLE&, F77_DBLE&); |
3146 | 173 |
4552 | 174 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
175 F77_FUNC (xgamma, XGAMMA) (const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
176 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
177 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
178 F77_FUNC (xgammainc, XGAMMAINC) (const F77_DBLE&, const F77_DBLE&, F77_DBLE&); |
3146 | 179 |
4552 | 180 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
181 F77_FUNC (xsgammainc, XSGAMMAINC) (const F77_REAL&, const F77_REAL&, F77_REAL&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
182 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
183 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
184 F77_FUNC (dlgams, DLGAMS) (const F77_DBLE&, F77_DBLE&, F77_DBLE&); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
185 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
186 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
187 F77_FUNC (algams, ALGAMS) (const F77_REAL&, F77_REAL&, F77_REAL&); |
20161
65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
Carnë Draug <carandraug@octave.org>
parents:
20156
diff
changeset
|
188 |
65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
Carnë Draug <carandraug@octave.org>
parents:
20156
diff
changeset
|
189 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
190 F77_FUNC (psifn, PSIFN) (const F77_REAL*, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
191 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
192 F77_REAL*, F77_INT*, F77_INT*); |
20161
65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
Carnë Draug <carandraug@octave.org>
parents:
20156
diff
changeset
|
193 |
65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
Carnë Draug <carandraug@octave.org>
parents:
20156
diff
changeset
|
194 F77_RET_T |
22133
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
195 F77_FUNC (dpsifn, DPSIFN) (const F77_DBLE*, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
196 const F77_INT&, const F77_INT&, |
59cadee1c74b
new macros for F77 data types
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
197 F77_DBLE*, F77_INT*, F77_INT*); |
3146 | 198 } |
199 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
200 namespace octave |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
201 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
202 namespace math |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
203 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
204 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
205 acosh (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
206 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
207 #if defined (HAVE_ACOSH) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
208 return ::acosh (x); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
209 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
210 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
211 F77_XFCN (xdacosh, XDACOSH, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
212 return retval; |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
213 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
214 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
215 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
216 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
217 acosh (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
218 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
219 #if defined (HAVE_ACOSHF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
220 return acoshf (x); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
221 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
222 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
223 F77_XFCN (xacosh, XACOSH, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
224 return retval; |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
225 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
226 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
227 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
228 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
229 acosh (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
230 { |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
231 #if defined (HAVE_COMPLEX_STD_ACOSH) |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
232 return std::acosh (x); |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
233 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
234 return log (x + sqrt (x + 1.0) * sqrt (x - 1.0)); |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
235 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
236 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
237 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
238 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
239 acosh (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
240 { |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
241 #if defined (HAVE_COMPLEX_STD_ACOSH) |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
242 return std::acosh (x); |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
243 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
244 return log (x + sqrt (x + 1.0f) * sqrt (x - 1.0f)); |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
245 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
246 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
247 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
248 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
249 asinh (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
250 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
251 #if defined (HAVE_ASINH) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
252 return ::asinh (x); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
253 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
254 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
255 F77_XFCN (xdasinh, XDASINH, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
256 return retval; |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
257 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
258 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
259 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
260 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
261 asinh (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
262 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
263 #if defined (HAVE_ASINHF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
264 return asinhf (x); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
265 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
266 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
267 F77_XFCN (xasinh, XASINH, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
268 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
269 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
270 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
271 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
272 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
273 asinh (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
274 { |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
275 #if defined (HAVE_COMPLEX_STD_ASINH) |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
276 return std::asinh (x); |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
277 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
278 return log (x + sqrt (x*x + 1.0)); |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
279 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
280 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
281 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
282 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
283 asinh (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
284 { |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
285 #if defined (HAVE_COMPLEX_STD_ASINH) |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
286 return std::asinh (x); |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
287 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
288 return log (x + sqrt (x*x + 1.0f)); |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
289 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
290 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
291 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
292 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
293 atanh (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
294 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
295 #if defined (HAVE_ATANH) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
296 return ::atanh (x); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
297 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
298 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
299 F77_XFCN (xdatanh, XDATANH, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
300 return retval; |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
301 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
302 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
303 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
304 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
305 atanh (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
306 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
307 #if defined (HAVE_ATANHF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
308 return atanhf (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
309 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
310 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
311 F77_XFCN (xatanh, XATANH, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
312 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
313 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
314 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
315 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
316 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
317 atanh (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
318 { |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
319 #if defined (HAVE_COMPLEX_STD_ATANH) |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
320 return std::atanh (x); |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
321 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
322 return log ((1.0 + x) / (1.0 - x)) / 2.0; |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
323 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
324 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
325 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
326 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
327 atanh (const FloatComplex& x) |
17708
f10b7a578e2c
Correct return values of gamma() (see Numerical, item 3 on Projects page).
Craig Hudson <c_hudson_phd@hotmail.com>
parents:
17502
diff
changeset
|
328 { |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
329 #if defined (HAVE_COMPLEX_STD_ATANH) |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
330 return std::atanh (x); |
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
331 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
332 return log ((1.0f + x) / (1.0f - x)) / 2.0f; |
21945
e9765b62d4e8
Use C++11 standard complex trig functions when available (bug #44310, bug #45507)
Mike Miller <mtmiller@octave.org>
parents:
21942
diff
changeset
|
333 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
334 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
335 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
336 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
337 erf (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
338 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
339 #if defined (HAVE_ERF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
340 return ::erf (x); |
11327
ef0e995f8c0f
correctly compute gamma for negative integer values when tgamma is available
Marco Atzeri <marco_atzeri@yahoo.it>
parents:
10902
diff
changeset
|
341 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
342 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
343 F77_XFCN (xderf, XDERF, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
344 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
345 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
346 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
347 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
348 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
349 erf (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
350 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
351 #if defined (HAVE_ERFF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
352 return erff (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
353 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
354 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
355 F77_XFCN (xerf, XERF, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
356 return retval; |
11327
ef0e995f8c0f
correctly compute gamma for negative integer values when tgamma is available
Marco Atzeri <marco_atzeri@yahoo.it>
parents:
10902
diff
changeset
|
357 #endif |
17708
f10b7a578e2c
Correct return values of gamma() (see Numerical, item 3 on Projects page).
Craig Hudson <c_hudson_phd@hotmail.com>
parents:
17502
diff
changeset
|
358 } |
6969 | 359 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
360 // Complex error function from the Faddeeva package |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
361 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
362 erf (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
363 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
364 return Faddeeva::erf (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
365 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
366 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
367 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
368 erf (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
369 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
370 Complex xd (real (x), imag (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
371 Complex ret = Faddeeva::erf (xd, std::numeric_limits<float>::epsilon ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
372 return FloatComplex (real (ret), imag (ret)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
373 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
374 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
375 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
376 erfc (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
377 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
378 #if defined (HAVE_ERFC) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
379 return ::erfc (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
380 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
381 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
382 F77_XFCN (xderfc, XDERFC, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
383 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
384 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
385 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
386 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
387 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
388 erfc (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
389 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
390 #if defined (HAVE_ERFCF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
391 return erfcf (x); |
6969 | 392 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
393 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
394 F77_XFCN (xerfc, XERFC, (x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
395 return retval; |
6969 | 396 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
397 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
398 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
399 // Complex complementary error function from the Faddeeva package |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
400 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
401 erfc (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
402 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
403 return Faddeeva::erfc (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
404 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
405 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
406 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
407 erfc (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
408 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
409 Complex xd (real (x), imag (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
410 Complex ret = Faddeeva::erfc (xd, std::numeric_limits<float>::epsilon ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
411 return FloatComplex (real (ret), imag (ret)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
412 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
413 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
414 // Real and complex scaled complementary error function from Faddeeva package |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
415 float erfcx (float x) { return Faddeeva::erfcx(x); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
416 double erfcx (double x) { return Faddeeva::erfcx(x); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
417 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
418 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
419 erfcx (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
420 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
421 return Faddeeva::erfcx (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
422 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
423 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
424 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
425 erfcx (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
426 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
427 Complex xd (real (x), imag (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
428 Complex ret = Faddeeva::erfcx (xd, std::numeric_limits<float>::epsilon ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
429 return FloatComplex (real (ret), imag (ret)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
430 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
431 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
432 // Real and complex imaginary error function from Faddeeva package |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
433 float erfi (float x) { return Faddeeva::erfi(x); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
434 double erfi (double x) { return Faddeeva::erfi(x); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
435 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
436 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
437 erfi (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
438 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
439 return Faddeeva::erfi (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
440 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
441 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
442 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
443 erfi (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
444 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
445 Complex xd (real (x), imag (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
446 Complex ret = Faddeeva::erfi (xd, std::numeric_limits<float>::epsilon ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
447 return FloatComplex (real (ret), imag (ret)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
448 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
449 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
450 // Real and complex Dawson function (= scaled erfi) from Faddeeva package |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
451 float dawson (float x) { return Faddeeva::Dawson(x); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
452 double dawson (double x) { return Faddeeva::Dawson(x); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
453 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
454 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
455 dawson (const Complex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
456 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
457 return Faddeeva::Dawson (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
458 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
459 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
460 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
461 dawson (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
462 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
463 Complex xd (real (x), imag (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
464 Complex ret = Faddeeva::Dawson (xd, std::numeric_limits<float>::epsilon ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
465 return FloatComplex (real (ret), imag (ret)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
466 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
467 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
468 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
469 gamma (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
470 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
471 double result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
472 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
473 // Special cases for (near) compatibility with Matlab instead of |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
474 // tgamma. Matlab does not have -0. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
475 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
476 if (x == 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
477 result = (octave::math::negative_sign (x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
478 ? -octave::numeric_limits<double>::Inf () |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
479 : octave::numeric_limits<double>::Inf ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
480 else if ((x < 0 && octave::math::x_nint (x) == x) || octave::math::isinf (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
481 result = octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
482 else if (octave::math::isnan (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
483 result = octave::numeric_limits<double>::NaN (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
484 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
485 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
486 #if defined (HAVE_TGAMMA) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
487 result = tgamma (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
488 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
489 F77_XFCN (xdgamma, XDGAMMA, (x, result)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
490 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
491 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
492 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
493 return result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
494 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
495 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
496 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
497 lgamma (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
498 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
499 #if defined (HAVE_LGAMMA) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
500 return ::lgamma (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
501 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
502 double result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
503 double sgngam; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
504 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
505 if (octave::math::isnan (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
506 result = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
507 else if ((x <= 0 && octave::math::x_nint (x) == x) || octave::math::isinf (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
508 result = octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
509 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
510 F77_XFCN (dlgams, DLGAMS, (x, result, sgngam)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
511 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
512 return result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
513 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
514 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
515 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
516 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
517 rc_lgamma (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
518 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
519 double result; |
7601
8a939b217863
Treat negative values to lgamma and beta correctly
David Bateman <dbateman@free.fr>
parents:
7176
diff
changeset
|
520 |
8a939b217863
Treat negative values to lgamma and beta correctly
David Bateman <dbateman@free.fr>
parents:
7176
diff
changeset
|
521 #if defined (HAVE_LGAMMA_R) |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
522 int sgngam; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
523 result = lgamma_r (x, &sgngam); |
11327
ef0e995f8c0f
correctly compute gamma for negative integer values when tgamma is available
Marco Atzeri <marco_atzeri@yahoo.it>
parents:
10902
diff
changeset
|
524 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
525 double sgngam = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
526 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
527 if (octave::math::isnan (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
528 result = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
529 else if ((x <= 0 && octave::math::x_nint (x) == x) || octave::math::isinf (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
530 result = octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
531 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
532 F77_XFCN (dlgams, DLGAMS, (x, result, sgngam)); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
533 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
534 #endif |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
535 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
536 if (sgngam < 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
537 return result + Complex (0., M_PI); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
538 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
539 return result; |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
540 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
541 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
542 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
543 gamma (float x) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
544 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
545 float result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
546 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
547 // Special cases for (near) compatibility with Matlab instead of |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
548 // tgamma. Matlab does not have -0. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
549 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
550 if (x == 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
551 result = (octave::math::negative_sign (x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
552 ? -octave::numeric_limits<float>::Inf () |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
553 : octave::numeric_limits<float>::Inf ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
554 else if ((x < 0 && octave::math::x_nint (x) == x) || octave::math::isinf (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
555 result = octave::numeric_limits<float>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
556 else if (octave::math::isnan (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
557 result = octave::numeric_limits<float>::NaN (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
558 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
559 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
560 #if defined (HAVE_TGAMMA) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
561 result = tgammaf (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
562 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
563 F77_XFCN (xgamma, XGAMMA, (x, result)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
564 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
565 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
566 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
567 return result; |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
568 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
569 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
570 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
571 lgamma (float x) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
572 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
573 #if defined (HAVE_LGAMMAF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
574 return lgammaf (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
575 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
576 float result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
577 float sgngam; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
578 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
579 if (octave::math::isnan (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
580 result = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
581 else if ((x <= 0 && octave::math::x_nint (x) == x) || octave::math::isinf (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
582 result = octave::numeric_limits<float>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
583 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
584 F77_XFCN (algams, ALGAMS, (x, result, sgngam)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
585 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
586 return result; |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
587 #endif |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
588 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
589 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
590 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
591 rc_lgamma (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
592 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
593 float result; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
594 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
595 #if defined (HAVE_LGAMMAF_R) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
596 int sgngam; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
597 result = lgammaf_r (x, &sgngam); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
598 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
599 float sgngam = 0.0f; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
600 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
601 if (octave::math::isnan (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
602 result = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
603 else if ((x <= 0 && octave::math::x_nint (x) == x) || octave::math::isinf (x)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
604 result = octave::numeric_limits<float>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
605 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
606 F77_XFCN (algams, ALGAMS, (x, result, sgngam)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
607 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
608 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
609 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
610 if (sgngam < 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
611 return result + FloatComplex (0., M_PI); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
612 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
613 return result; |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7601
diff
changeset
|
614 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
615 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
616 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
617 expm1 (double x) |
10414
2a8b1db1e2ca
implement built-in cbrt
Jaroslav Hajek <highegg@gmail.com>
parents:
10391
diff
changeset
|
618 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
619 #if defined (HAVE_EXPM1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
620 return ::expm1 (x); |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
621 #else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
622 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
623 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
624 double ax = fabs (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
625 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
626 if (ax < 0.1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
627 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
628 ax /= 16; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
629 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
630 // use Taylor series to calculate exp(x)-1. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
631 double t = ax; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
632 double s = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
633 for (int i = 2; i < 7; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
634 s += (t *= ax/i); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
635 s += ax; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
636 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
637 // use the identity (a+1)^2-1 = a*(a+2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
638 double e = s; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
639 for (int i = 0; i < 4; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
640 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
641 s *= e + 2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
642 e *= e + 2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
643 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
644 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
645 retval = (x > 0) ? s : -s / (1+s); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
646 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
647 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
648 retval = exp (x) - 1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
649 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
650 return retval; |
21231
5f318c8ec634
eliminate feature tests from lo-specfun.h
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
651 #endif |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
652 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
653 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
654 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
655 expm1 (const Complex& x) |
3220 | 656 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
657 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
658 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
659 if (std:: abs (x) < 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
660 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
661 double im = x.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
662 double u = expm1 (x.real ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
663 double v = sin (im/2); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
664 v = -2*v*v; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
665 retval = Complex (u*v + u + v, (u+1) * sin (im)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
666 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
667 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
668 retval = std::exp (x) - Complex (1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
669 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
670 return retval; |
3220 | 671 } |
672 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
673 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
674 expm1 (float x) |
3220 | 675 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
676 #if defined (HAVE_EXPM1F) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
677 return expm1f (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
678 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
679 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
680 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
681 float ax = fabs (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
682 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
683 if (ax < 0.1) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
684 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
685 ax /= 16; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
686 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
687 // use Taylor series to calculate exp(x)-1. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
688 float t = ax; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
689 float s = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
690 for (int i = 2; i < 7; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
691 s += (t *= ax/i); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
692 s += ax; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
693 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
694 // use the identity (a+1)^2-1 = a*(a+2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
695 float e = s; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
696 for (int i = 0; i < 4; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
697 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
698 s *= e + 2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
699 e *= e + 2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
700 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
701 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
702 retval = (x > 0) ? s : -s / (1+s); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
703 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
704 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
705 retval = exp (x) - 1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
706 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
707 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
708 #endif |
3220 | 709 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
710 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
711 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
712 expm1 (const FloatComplex& x) |
4911 | 713 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
714 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
715 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
716 if (std:: abs (x) < 1) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
717 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
718 float im = x.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
719 float u = expm1 (x.real ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
720 float v = sin (im/2); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
721 v = -2*v*v; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
722 retval = FloatComplex (u*v + u + v, (u+1) * sin (im)); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
723 } |
3220 | 724 else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
725 retval = std::exp (x) - FloatComplex (1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
726 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
727 return retval; |
3220 | 728 } |
729 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
730 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
731 log1p (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
732 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
733 #if defined (HAVE_LOG1P) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
734 return ::log1p (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
735 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
736 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
737 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
738 double ax = fabs (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
739 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
740 if (ax < 0.2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
741 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
742 // approximation log (1+x) ~ 2*sum ((x/(2+x)).^ii ./ ii), ii = 1:2:2n+1 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
743 double u = x / (2 + x), t = 1, s = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
744 for (int i = 2; i < 12; i += 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
745 s += (t *= u*u) / (i+1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
746 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
747 retval = 2 * (s + 1) * u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
748 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
749 else |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
750 retval = std::log (1 + x); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
751 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
752 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
753 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
754 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
755 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
756 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
757 log1p (const Complex& x) |
3146 | 758 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
759 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
760 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
761 double r = x.real (), i = x.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
762 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
763 if (fabs (r) < 0.5 && fabs (i) < 0.5) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
764 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
765 double u = 2*r + r*r + i*i; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
766 retval = Complex (log1p (u / (1+sqrt (u+1))), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
767 atan2 (1 + r, i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
768 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
769 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
770 retval = std::log (Complex (1) + x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
771 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
772 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
773 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
774 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
775 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
776 T |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
777 xcbrt (T x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
778 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
779 static const T one_third = 0.3333333333333333333f; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
780 if (octave::math::finite (x)) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
781 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
782 // Use pow. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
783 T y = std::pow (std::abs (x), one_third) * signum (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
784 // Correct for better accuracy. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
785 return (x / (y*y) + y + y) / 3; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
786 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
787 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
788 return x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
789 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
790 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
791 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
792 cbrt (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
793 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
794 #if defined (HAVE_CBRT) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
795 return ::cbrt (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
796 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
797 return xxcbrt (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
798 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
799 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
800 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
801 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
802 log1p (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
803 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
804 #if defined (HAVE_LOG1PF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
805 return log1pf (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
806 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
807 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
808 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
809 float ax = fabs (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
810 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
811 if (ax < 0.2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
812 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
813 // approximation log (1+x) ~ 2*sum ((x/(2+x)).^ii ./ ii), ii = 1:2:2n+1 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
814 float u = x / (2 + x), t = 1.0f, s = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
815 for (int i = 2; i < 12; i += 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
816 s += (t *= u*u) / (i+1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
817 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
818 retval = 2 * (s + 1.0f) * u; |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
819 } |
3220 | 820 else |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
821 retval = std::log (1.0f + x); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
822 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
823 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
824 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
825 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
826 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
827 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
828 log1p (const FloatComplex& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
829 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
830 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
831 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
832 float r = x.real (), i = x.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
833 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
834 if (fabs (r) < 0.5 && fabs (i) < 0.5) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
835 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
836 float u = 2*r + r*r + i*i; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
837 retval = FloatComplex (log1p (u / (1+sqrt (u+1))), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
838 atan2 (1 + r, i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
839 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
840 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
841 retval = std::log (FloatComplex (1) + x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
842 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
843 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
844 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
845 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
846 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
847 cbrt (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
848 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
849 #if defined (HAVE_CBRTF) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
850 return cbrtf (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
851 #else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
852 return xxcbrt (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
853 #endif |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
854 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
855 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
856 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
857 zbesj (const Complex& z, double alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
858 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
859 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
860 zbesy (const Complex& z, double alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
861 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
862 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
863 zbesi (const Complex& z, double alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
864 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
865 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
866 zbesk (const Complex& z, double alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
867 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
868 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
869 zbesh1 (const Complex& z, double alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
870 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
871 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
872 zbesh2 (const Complex& z, double alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
873 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
874 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
875 bessel_return_value (const Complex& val, octave_idx_type ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
876 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
877 static const Complex inf_val |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
878 = Complex (octave::numeric_limits<double>::Inf (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
879 octave::numeric_limits<double>::Inf ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
880 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
881 static const Complex nan_val |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
882 = Complex (octave::numeric_limits<double>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
883 octave::numeric_limits<double>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
884 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
885 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
886 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
887 switch (ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
888 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
889 case 0: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
890 case 3: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
891 retval = val; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
892 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
893 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
894 case 2: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
895 retval = inf_val; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
896 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
897 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
898 default: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
899 retval = nan_val; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
900 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
901 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
902 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
903 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
904 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
905 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
906 static inline bool |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
907 is_integer_value (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
908 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
909 return x == static_cast<double> (static_cast<long> (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
910 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
911 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
912 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
913 zbesj (const Complex& z, double alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
914 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
915 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
916 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
917 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
918 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
919 double yr = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
920 double yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
921 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
922 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
923 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
924 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
925 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
926 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
927 F77_FUNC (zbesj, ZBESJ) (zr, zi, alpha, 2, 1, &yr, &yi, nz, ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
928 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
929 if (kode != 2) |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
930 { |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
931 double expz = exp (std::abs (zi)); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
932 yr *= expz; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
933 yi *= expz; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
934 } |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
935 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
936 if (zi == 0.0 && zr >= 0.0) |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
937 yi = 0.0; |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
938 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
939 retval = bessel_return_value (Complex (yr, yi), ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
940 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
941 else if (is_integer_value (alpha)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
942 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
943 // zbesy can overflow as z->0, and cause troubles for generic case below |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
944 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
945 Complex tmp = zbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
946 if ((static_cast<long> (alpha)) & 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
947 tmp = - tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
948 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
949 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
950 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
951 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
952 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
953 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
954 Complex tmp = cos (M_PI * alpha) * zbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
955 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
956 if (ierr == 0 || ierr == 3) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
957 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
958 tmp -= sin (M_PI * alpha) * zbesy (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
959 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
960 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
961 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
962 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
963 retval = Complex (octave::numeric_limits<double>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
964 octave::numeric_limits<double>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
965 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
966 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
967 return retval; |
3220 | 968 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
969 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
970 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
971 zbesy (const Complex& z, double alpha, int kode, octave_idx_type& ierr) |
4911 | 972 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
973 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
974 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
975 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
976 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
977 double yr = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
978 double yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
979 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
980 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
981 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
982 double wr, wi; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
983 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
984 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
985 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
986 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
987 ierr = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
988 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
989 if (zr == 0.0 && zi == 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
990 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
991 yr = -octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
992 yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
993 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
994 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
995 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
996 F77_FUNC (zbesy, ZBESY) (zr, zi, alpha, 2, 1, &yr, &yi, nz, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
997 &wr, &wi, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
998 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
999 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1000 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1001 double expz = exp (std::abs (zi)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1002 yr *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1003 yi *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1004 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1005 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1006 if (zi == 0.0 && zr >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1007 yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1008 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1009 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1010 return bessel_return_value (Complex (yr, yi), ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1011 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1012 else if (is_integer_value (alpha - 0.5)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1013 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1014 // zbesy can overflow as z->0, and cause troubles for generic case below |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1015 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1016 Complex tmp = zbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1017 if ((static_cast<long> (alpha - 0.5)) & 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1018 tmp = - tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1019 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1020 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1021 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1022 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1023 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1024 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1025 Complex tmp = cos (M_PI * alpha) * zbesy (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1026 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1027 if (ierr == 0 || ierr == 3) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1028 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1029 tmp += sin (M_PI * alpha) * zbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1030 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1031 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1032 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1033 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1034 retval = Complex (octave::numeric_limits<double>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1035 octave::numeric_limits<double>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1036 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1037 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1038 return retval; |
4911 | 1039 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1040 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1041 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1042 zbesi (const Complex& z, double alpha, int kode, octave_idx_type& ierr) |
3220 | 1043 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1044 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1045 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1046 if (alpha >= 0.0) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1047 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1048 double yr = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1049 double yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1050 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1051 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1052 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1053 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1054 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1055 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1056 F77_FUNC (zbesi, ZBESI) (zr, zi, alpha, 2, 1, &yr, &yi, nz, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1057 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1058 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1059 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1060 double expz = exp (std::abs (zr)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1061 yr *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1062 yi *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1063 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1064 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1065 if (zi == 0.0 && zr >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1066 yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1067 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1068 retval = bessel_return_value (Complex (yr, yi), ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1069 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1070 else if (is_integer_value (alpha)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1071 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1072 // zbesi can overflow as z->0, and cause troubles for generic case below |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1073 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1074 Complex tmp = zbesi (z, alpha, kode, ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1075 retval = bessel_return_value (tmp, ierr); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1076 } |
3220 | 1077 else |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1078 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1079 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1080 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1081 Complex tmp = zbesi (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1082 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1083 if (ierr == 0 || ierr == 3) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1084 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1085 Complex tmp2 = (2.0 / M_PI) * sin (M_PI * alpha) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1086 * zbesk (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1087 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1088 if (kode == 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1089 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1090 // Compensate for different scaling factor of besk. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1091 tmp2 *= exp (-z - std::abs (z.real ())); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1092 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1093 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1094 tmp += tmp2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1095 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1096 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1097 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1098 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1099 retval = Complex (octave::numeric_limits<double>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1100 octave::numeric_limits<double>::NaN ()); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1101 } |
3146 | 1102 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1103 return retval; |
3146 | 1104 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1105 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1106 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1107 zbesk (const Complex& z, double alpha, int kode, octave_idx_type& ierr) |
3220 | 1108 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1109 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1110 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1111 if (alpha >= 0.0) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1112 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1113 double yr = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1114 double yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1115 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1116 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1117 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1118 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1119 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1120 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1121 ierr = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1122 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1123 if (zr == 0.0 && zi == 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1124 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1125 yr = octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1126 yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1127 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1128 else |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1129 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1130 F77_FUNC (zbesk, ZBESK) (zr, zi, alpha, 2, 1, &yr, &yi, nz, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1131 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1132 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1133 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1134 Complex expz = exp (-z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1135 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1136 double rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1137 double iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1138 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1139 double tmp = yr*rexpz - yi*iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1140 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1141 yi = yr*iexpz + yi*rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1142 yr = tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1143 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1144 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1145 if (zi == 0.0 && zr >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1146 yi = 0.0; |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1147 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
1148 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1149 retval = bessel_return_value (Complex (yr, yi), ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1150 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1151 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1152 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1153 Complex tmp = zbesk (z, -alpha, kode, ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1154 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1155 retval = bessel_return_value (tmp, ierr); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1156 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1157 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1158 return retval; |
3220 | 1159 } |
1160 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1161 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1162 zbesh1 (const Complex& z, double alpha, int kode, octave_idx_type& ierr) |
3220 | 1163 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1164 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1165 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1166 if (alpha >= 0.0) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1167 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1168 double yr = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1169 double yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1170 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1171 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1172 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1173 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1174 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1175 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1176 F77_FUNC (zbesh, ZBESH) (zr, zi, alpha, 2, 1, 1, &yr, &yi, nz, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1177 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1178 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1179 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1180 Complex expz = exp (Complex (0.0, 1.0) * z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1181 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1182 double rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1183 double iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1184 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1185 double tmp = yr*rexpz - yi*iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1186 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1187 yi = yr*iexpz + yi*rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1188 yr = tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1189 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1190 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1191 retval = bessel_return_value (Complex (yr, yi), ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1192 } |
3220 | 1193 else |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1194 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1195 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1196 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1197 static const Complex eye = Complex (0.0, 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1198 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1199 Complex tmp = exp (M_PI * alpha * eye) * zbesh1 (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1200 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1201 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1202 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1203 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1204 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1205 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1206 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1207 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1208 zbesh2 (const Complex& z, double alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1209 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1210 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1211 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1212 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1213 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1214 double yr = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1215 double yi = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1216 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1217 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1218 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1219 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1220 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1221 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1222 F77_FUNC (zbesh, ZBESH) (zr, zi, alpha, 2, 2, 1, &yr, &yi, nz, ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1223 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1224 if (kode != 2) |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1225 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1226 Complex expz = exp (-Complex (0.0, 1.0) * z); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1227 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1228 double rexpz = real (expz); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1229 double iexpz = imag (expz); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1230 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1231 double tmp = yr*rexpz - yi*iexpz; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1232 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1233 yi = yr*iexpz + yi*rexpz; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1234 yr = tmp; |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1235 } |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1236 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1237 retval = bessel_return_value (Complex (yr, yi), ierr); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
1238 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1239 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1240 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1241 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1242 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1243 static const Complex eye = Complex (0.0, 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1244 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1245 Complex tmp = exp (-M_PI * alpha * eye) * zbesh2 (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1246 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1247 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1248 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1249 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1250 return retval; |
3220 | 1251 } |
3146 | 1252 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1253 typedef Complex (*dptr) (const Complex&, double, int, octave_idx_type&); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1254 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1255 static inline Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1256 do_bessel (dptr f, const char *, double alpha, const Complex& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1257 bool scaled, octave_idx_type& ierr) |
3220 | 1258 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1259 Complex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1260 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1261 retval = f (x, alpha, (scaled ? 2 : 1), ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1262 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1263 return retval; |
3220 | 1264 } |
3146 | 1265 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1266 static inline ComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1267 do_bessel (dptr f, const char *, double alpha, const ComplexMatrix& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1268 bool scaled, Array<octave_idx_type>& ierr) |
3220 | 1269 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1270 octave_idx_type nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1271 octave_idx_type nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1272 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1273 ComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1274 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1275 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1276 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1277 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1278 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1279 retval(i,j) = f (x(i,j), alpha, (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1280 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1281 return retval; |
3146 | 1282 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1283 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1284 static inline ComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1285 do_bessel (dptr f, const char *, const Matrix& alpha, const Complex& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1286 bool scaled, Array<octave_idx_type>& ierr) |
3220 | 1287 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1288 octave_idx_type nr = alpha.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1289 octave_idx_type nc = alpha.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1290 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1291 ComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1292 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1293 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1294 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1295 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1296 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1297 retval(i,j) = f (x, alpha(i,j), (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1298 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1299 return retval; |
3220 | 1300 } |
1301 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1302 static inline ComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1303 do_bessel (dptr f, const char *fn, const Matrix& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1304 const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1305 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1306 ComplexMatrix retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1307 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1308 octave_idx_type x_nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1309 octave_idx_type x_nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1310 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1311 octave_idx_type alpha_nr = alpha.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1312 octave_idx_type alpha_nc = alpha.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1313 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1314 if (x_nr != alpha_nr || x_nc != alpha_nc) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1315 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1316 ("%s: the sizes of alpha and x must conform", fn); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1317 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1318 octave_idx_type nr = x_nr; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1319 octave_idx_type nc = x_nc; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1320 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1321 retval.resize (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1322 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1323 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1324 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1325 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1326 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1327 retval(i,j) = f (x(i,j), alpha(i,j), (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1328 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1329 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1330 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1331 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1332 static inline ComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1333 do_bessel (dptr f, const char *, double alpha, const ComplexNDArray& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1334 bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1335 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1336 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1337 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1338 ComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1339 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1340 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1341 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1342 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1343 retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1344 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1345 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1346 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1347 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1348 static inline ComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1349 do_bessel (dptr f, const char *, const NDArray& alpha, const Complex& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1350 bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1351 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1352 dim_vector dv = alpha.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1353 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1354 ComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1355 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1356 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1357 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1358 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1359 retval(i) = f (x, alpha(i), (scaled ? 2 : 1), ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1360 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1361 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1362 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1363 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1364 static inline ComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1365 do_bessel (dptr f, const char *fn, const NDArray& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1366 const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1367 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1368 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1369 ComplexNDArray retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1370 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1371 if (dv != alpha.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1372 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1373 ("%s: the sizes of alpha and x must conform", fn); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1374 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1375 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1376 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1377 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1378 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1379 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1380 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1381 retval(i) = f (x(i), alpha(i), (scaled ? 2 : 1), ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1382 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1383 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1384 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1385 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1386 static inline ComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1387 do_bessel (dptr f, const char *, const RowVector& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1388 const ComplexColumnVector& x, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1389 Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1390 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1391 octave_idx_type nr = x.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1392 octave_idx_type nc = alpha.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1393 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1394 ComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1395 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1396 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1397 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1398 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1399 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1400 retval(i,j) = f (x(i), alpha(j), (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1401 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1402 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1403 } |
3146 | 1404 |
3220 | 1405 #define SS_BESSEL(name, fcn) \ |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1406 Complex \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1407 name (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1408 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1409 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1410 } |
3220 | 1411 |
1412 #define SM_BESSEL(name, fcn) \ | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1413 ComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1414 name (double alpha, const ComplexMatrix& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1415 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1416 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1417 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1418 } |
3220 | 1419 |
1420 #define MS_BESSEL(name, fcn) \ | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1421 ComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1422 name (const Matrix& alpha, const Complex& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1423 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1424 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1425 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1426 } |
3220 | 1427 |
1428 #define MM_BESSEL(name, fcn) \ | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1429 ComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1430 name (const Matrix& alpha, const ComplexMatrix& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1431 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1432 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1433 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1434 } |
3220 | 1435 |
4844 | 1436 #define SN_BESSEL(name, fcn) \ |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1437 ComplexNDArray \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1438 name (double alpha, const ComplexNDArray& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1439 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1440 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1441 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1442 } |
4844 | 1443 |
1444 #define NS_BESSEL(name, fcn) \ | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1445 ComplexNDArray \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1446 name (const NDArray& alpha, const Complex& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1447 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1448 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1449 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1450 } |
4844 | 1451 |
1452 #define NN_BESSEL(name, fcn) \ | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1453 ComplexNDArray \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1454 name (const NDArray& alpha, const ComplexNDArray& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1455 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1456 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1457 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1458 } |
4844 | 1459 |
3220 | 1460 #define RC_BESSEL(name, fcn) \ |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1461 ComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1462 name (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1463 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1464 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1465 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1466 } |
3220 | 1467 |
1468 #define ALL_BESSEL(name, fcn) \ | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1469 SS_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1470 SM_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1471 MS_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1472 MM_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1473 SN_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1474 NS_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1475 NN_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1476 RC_BESSEL (name, fcn) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1477 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1478 ALL_BESSEL (besselj, zbesj) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1479 ALL_BESSEL (bessely, zbesy) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1480 ALL_BESSEL (besseli, zbesi) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1481 ALL_BESSEL (besselk, zbesk) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1482 ALL_BESSEL (besselh1, zbesh1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1483 ALL_BESSEL (besselh2, zbesh2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1484 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1485 #undef ALL_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1486 #undef SS_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1487 #undef SM_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1488 #undef MS_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1489 #undef MM_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1490 #undef SN_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1491 #undef NS_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1492 #undef NN_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1493 #undef RC_BESSEL |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1494 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1495 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1496 cbesj (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1497 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1498 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1499 cbesy (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1500 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1501 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1502 cbesi (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1503 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1504 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1505 cbesk (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1506 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1507 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1508 cbesh1 (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1509 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1510 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1511 cbesh2 (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1512 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1513 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1514 bessel_return_value (const FloatComplex& val, octave_idx_type ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1515 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1516 static const FloatComplex inf_val |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1517 = FloatComplex (octave::numeric_limits<float>::Inf (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1518 octave::numeric_limits<float>::Inf ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1519 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1520 static const FloatComplex nan_val |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1521 = FloatComplex (octave::numeric_limits<float>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1522 octave::numeric_limits<float>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1523 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1524 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1525 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1526 switch (ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1527 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1528 case 0: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1529 case 3: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1530 retval = val; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1531 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1532 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1533 case 2: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1534 retval = inf_val; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1535 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1536 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1537 default: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1538 retval = nan_val; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1539 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1540 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1541 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1542 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1543 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1544 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1545 static inline bool |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1546 is_integer_value (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1547 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1548 return x == static_cast<float> (static_cast<long> (x)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1549 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1550 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1551 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1552 cbesj (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1553 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1554 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1555 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1556 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1557 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1558 FloatComplex y = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1559 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1560 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1561 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1562 F77_FUNC (cbesj, CBESJ) (F77_CONST_CMPLX_ARG (&z), alpha, 2, 1, F77_CMPLX_ARG (&y), nz, ierr); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1563 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1564 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1565 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1566 float expz = exp (std::abs (imag (z))); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1567 y *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1568 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1569 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1570 if (imag (z) == 0.0 && real (z) >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1571 y = FloatComplex (y.real (), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1572 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1573 retval = bessel_return_value (y, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1574 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1575 else if (is_integer_value (alpha)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1576 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1577 // zbesy can overflow as z->0, and cause troubles for generic case below |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1578 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1579 FloatComplex tmp = cbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1580 if ((static_cast<long> (alpha)) & 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1581 tmp = - tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1582 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1583 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1584 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1585 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1586 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1587 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1588 FloatComplex tmp = cosf (static_cast<float> (M_PI) * alpha) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1589 * cbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1590 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1591 if (ierr == 0 || ierr == 3) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1592 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1593 tmp -= sinf (static_cast<float> (M_PI) * alpha) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1594 * cbesy (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1595 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1596 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1597 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1598 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1599 retval = FloatComplex (octave::numeric_limits<float>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1600 octave::numeric_limits<float>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1601 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1602 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1603 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1604 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1605 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1606 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1607 cbesy (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1608 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1609 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1610 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1611 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1612 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1613 FloatComplex y = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1614 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1615 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1616 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1617 FloatComplex w; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1618 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1619 ierr = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1620 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1621 if (real (z) == 0.0 && imag (z) == 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1622 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1623 y = FloatComplex (-octave::numeric_limits<float>::Inf (), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1624 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1625 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1626 { |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1627 F77_FUNC (cbesy, CBESY) (F77_CONST_CMPLX_ARG (&z), alpha, 2, 1, F77_CMPLX_ARG (&y), nz, F77_CMPLX_ARG (&w), ierr); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1628 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1629 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1630 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1631 float expz = exp (std::abs (imag (z))); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1632 y *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1633 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1634 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1635 if (imag (z) == 0.0 && real (z) >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1636 y = FloatComplex (y.real (), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1637 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1638 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1639 return bessel_return_value (y, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1640 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1641 else if (is_integer_value (alpha - 0.5)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1642 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1643 // zbesy can overflow as z->0, and cause troubles for generic case below |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1644 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1645 FloatComplex tmp = cbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1646 if ((static_cast<long> (alpha - 0.5)) & 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1647 tmp = - tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1648 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1649 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1650 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1651 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1652 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1653 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1654 FloatComplex tmp = cosf (static_cast<float> (M_PI) * alpha) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1655 * cbesy (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1656 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1657 if (ierr == 0 || ierr == 3) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1658 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1659 tmp += sinf (static_cast<float> (M_PI) * alpha) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1660 * cbesj (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1661 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1662 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1663 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1664 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1665 retval = FloatComplex (octave::numeric_limits<float>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1666 octave::numeric_limits<float>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1667 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1668 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1669 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1670 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1671 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1672 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1673 cbesi (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1674 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1675 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1676 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1677 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1678 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1679 FloatComplex y = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1680 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1681 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1682 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1683 F77_FUNC (cbesi, CBESI) (F77_CONST_CMPLX_ARG (&z), alpha, 2, 1, F77_CMPLX_ARG (&y), nz, ierr); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1684 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1685 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1686 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1687 float expz = exp (std::abs (real (z))); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1688 y *= expz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1689 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1690 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1691 if (imag (z) == 0.0 && real (z) >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1692 y = FloatComplex (y.real (), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1693 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1694 retval = bessel_return_value (y, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1695 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1696 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1697 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1698 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1699 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1700 FloatComplex tmp = cbesi (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1701 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1702 if (ierr == 0 || ierr == 3) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1703 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1704 FloatComplex tmp2 = static_cast<float> (2.0 / M_PI) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1705 * sinf (static_cast<float> (M_PI) * alpha) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1706 * cbesk (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1707 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1708 if (kode == 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1709 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1710 // Compensate for different scaling factor of besk. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1711 tmp2 *= exp (-z - std::abs (z.real ())); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1712 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1713 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1714 tmp += tmp2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1715 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1716 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1717 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1718 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1719 retval = FloatComplex (octave::numeric_limits<float>::NaN (), |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1720 octave::numeric_limits<float>::NaN ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1721 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1722 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1723 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1724 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1725 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1726 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1727 cbesk (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1728 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1729 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1730 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1731 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1732 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1733 FloatComplex y = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1734 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1735 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1736 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1737 ierr = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1738 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1739 if (real (z) == 0.0 && imag (z) == 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1740 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1741 y = FloatComplex (octave::numeric_limits<float>::Inf (), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1742 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1743 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1744 { |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1745 F77_FUNC (cbesk, CBESK) (F77_CONST_CMPLX_ARG (&z), alpha, 2, 1, F77_CMPLX_ARG (&y), nz, ierr); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1746 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1747 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1748 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1749 FloatComplex expz = exp (-z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1750 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1751 float rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1752 float iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1753 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1754 float tmp_r = real (y) * rexpz - imag (y) * iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1755 float tmp_i = real (y) * iexpz + imag (y) * rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1756 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1757 y = FloatComplex (tmp_r, tmp_i); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1758 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1759 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1760 if (imag (z) == 0.0 && real (z) >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1761 y = FloatComplex (y.real (), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1762 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1763 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1764 retval = bessel_return_value (y, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1765 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1766 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1767 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1768 FloatComplex tmp = cbesk (z, -alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1769 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1770 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1771 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1772 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1773 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1774 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1775 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1776 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1777 cbesh1 (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1778 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1779 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1780 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1781 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1782 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1783 FloatComplex y = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1784 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1785 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1786 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1787 F77_FUNC (cbesh, CBESH) (F77_CONST_CMPLX_ARG (&z), alpha, 2, 1, 1, F77_CMPLX_ARG (&y), nz, ierr); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1788 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1789 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1790 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1791 FloatComplex expz = exp (FloatComplex (0.0, 1.0) * z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1792 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1793 float rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1794 float iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1795 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1796 float tmp_r = real (y) * rexpz - imag (y) * iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1797 float tmp_i = real (y) * iexpz + imag (y) * rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1798 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1799 y = FloatComplex (tmp_r, tmp_i); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1800 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1801 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1802 retval = bessel_return_value (y, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1803 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1804 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1805 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1806 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1807 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1808 static const FloatComplex eye = FloatComplex (0.0, 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1809 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1810 FloatComplex tmp = exp (static_cast<float> (M_PI) * alpha * eye) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1811 * cbesh1 (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1812 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1813 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1814 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1815 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1816 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1817 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1818 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1819 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1820 cbesh2 (const FloatComplex& z, float alpha, int kode, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1821 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1822 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1823 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1824 if (alpha >= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1825 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1826 FloatComplex y = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1827 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1828 octave_idx_type nz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1829 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
1830 F77_FUNC (cbesh, CBESH) (F77_CONST_CMPLX_ARG (&z), alpha, 2, 2, 1, F77_CMPLX_ARG (&y), nz, ierr); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1831 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1832 if (kode != 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1833 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1834 FloatComplex expz = exp (-FloatComplex (0.0, 1.0) * z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1835 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1836 float rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1837 float iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1838 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1839 float tmp_r = real (y) * rexpz - imag (y) * iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1840 float tmp_i = real (y) * iexpz + imag (y) * rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1841 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1842 y = FloatComplex (tmp_r, tmp_i); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1843 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1844 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1845 retval = bessel_return_value (y, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1846 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1847 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1848 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1849 alpha = -alpha; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1850 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1851 static const FloatComplex eye = FloatComplex (0.0, 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1852 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1853 FloatComplex tmp = exp (-static_cast<float> (M_PI) * alpha * eye) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1854 * cbesh2 (z, alpha, kode, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1855 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1856 retval = bessel_return_value (tmp, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1857 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1858 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1859 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1860 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1861 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1862 typedef FloatComplex (*fptr) (const FloatComplex&, float, int, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1863 octave_idx_type&); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1864 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1865 static inline FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1866 do_bessel (fptr f, const char *, float alpha, const FloatComplex& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1867 bool scaled, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1868 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1869 FloatComplex retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1870 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1871 retval = f (x, alpha, (scaled ? 2 : 1), ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1872 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1873 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1874 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1875 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1876 static inline FloatComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1877 do_bessel (fptr f, const char *, float alpha, const FloatComplexMatrix& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1878 bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1879 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1880 octave_idx_type nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1881 octave_idx_type nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1882 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1883 FloatComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1884 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1885 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1886 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1887 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1888 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1889 retval(i,j) = f (x(i,j), alpha, (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1890 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1891 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1892 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1893 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1894 static inline FloatComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1895 do_bessel (fptr f, const char *, const FloatMatrix& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1896 const FloatComplex& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1897 bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1898 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1899 octave_idx_type nr = alpha.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1900 octave_idx_type nc = alpha.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1901 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1902 FloatComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1903 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1904 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1905 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1906 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1907 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1908 retval(i,j) = f (x, alpha(i,j), (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1909 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1910 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1911 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1912 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1913 static inline FloatComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1914 do_bessel (fptr f, const char *fn, const FloatMatrix& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1915 const FloatComplexMatrix& x, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1916 Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1917 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1918 FloatComplexMatrix retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1919 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1920 octave_idx_type x_nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1921 octave_idx_type x_nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1922 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1923 octave_idx_type alpha_nr = alpha.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1924 octave_idx_type alpha_nc = alpha.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1925 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1926 if (x_nr != alpha_nr || x_nc != alpha_nc) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1927 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1928 ("%s: the sizes of alpha and x must conform", fn); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1929 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1930 octave_idx_type nr = x_nr; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1931 octave_idx_type nc = x_nc; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1932 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1933 retval.resize (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1934 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1935 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1936 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1937 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1938 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1939 retval(i,j) = f (x(i,j), alpha(i,j), (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1940 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1941 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1942 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1943 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1944 static inline FloatComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1945 do_bessel (fptr f, const char *, float alpha, const FloatComplexNDArray& x, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1946 bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1947 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1948 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1949 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1950 FloatComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1951 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1952 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1953 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1954 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1955 retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1956 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1957 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1958 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1959 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1960 static inline FloatComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1961 do_bessel (fptr f, const char *, const FloatNDArray& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1962 const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1963 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1964 dim_vector dv = alpha.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1965 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1966 FloatComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1967 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1968 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1969 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1970 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1971 retval(i) = f (x, alpha(i), (scaled ? 2 : 1), ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1972 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1973 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1974 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1975 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1976 static inline FloatComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1977 do_bessel (fptr f, const char *fn, const FloatNDArray& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1978 const FloatComplexNDArray& x, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1979 Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1980 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1981 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1982 FloatComplexNDArray retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1983 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1984 if (dv != alpha.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1985 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1986 ("%s: the sizes of alpha and x must conform", fn); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1987 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1988 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1989 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1990 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1991 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1992 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1993 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1994 retval(i) = f (x(i), alpha(i), (scaled ? 2 : 1), ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1995 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1996 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1997 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1998 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1999 static inline FloatComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2000 do_bessel (fptr f, const char *, const FloatRowVector& alpha, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2001 const FloatComplexColumnVector& x, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2002 Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2003 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2004 octave_idx_type nr = x.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2005 octave_idx_type nc = alpha.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2006 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2007 FloatComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2008 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2009 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2010 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2011 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2012 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2013 retval(i,j) = f (x(i), alpha(j), (scaled ? 2 : 1), ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2014 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2015 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2016 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2017 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2018 #define SS_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2019 FloatComplex \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2020 name (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2021 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2022 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2023 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2024 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2025 #define SM_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2026 FloatComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2027 name (float alpha, const FloatComplexMatrix& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2028 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2029 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2030 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2031 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2032 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2033 #define MS_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2034 FloatComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2035 name (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2036 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2037 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2038 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2039 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2040 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2041 #define MM_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2042 FloatComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2043 name (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2044 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2045 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2046 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2047 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2048 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2049 #define SN_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2050 FloatComplexNDArray \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2051 name (float alpha, const FloatComplexNDArray& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2052 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2053 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2054 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2055 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2056 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2057 #define NS_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2058 FloatComplexNDArray \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2059 name (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2060 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2061 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2062 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2063 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2064 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2065 #define NN_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2066 FloatComplexNDArray \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2067 name (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2068 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2069 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2070 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2071 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2072 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2073 #define RC_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2074 FloatComplexMatrix \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2075 name (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2076 Array<octave_idx_type>& ierr) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2077 { \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2078 return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2079 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2080 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2081 #define ALL_BESSEL(name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2082 SS_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2083 SM_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2084 MS_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2085 MM_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2086 SN_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2087 NS_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2088 NN_BESSEL (name, fcn) \ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2089 RC_BESSEL (name, fcn) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2090 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2091 ALL_BESSEL (besselj, cbesj) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2092 ALL_BESSEL (bessely, cbesy) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2093 ALL_BESSEL (besseli, cbesi) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2094 ALL_BESSEL (besselk, cbesk) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2095 ALL_BESSEL (besselh1, cbesh1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2096 ALL_BESSEL (besselh2, cbesh2) |
3220 | 2097 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2098 #undef ALL_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2099 #undef SS_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2100 #undef SM_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2101 #undef MS_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2102 #undef MM_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2103 #undef SN_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2104 #undef NS_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2105 #undef NN_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2106 #undef RC_BESSEL |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2107 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2108 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2109 airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2110 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2111 double ar = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2112 double ai = 0.0; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2113 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2114 octave_idx_type nz; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2115 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2116 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2117 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2118 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2119 octave_idx_type id = deriv ? 1 : 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2120 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2121 F77_FUNC (zairy, ZAIRY) (zr, zi, id, 2, ar, ai, nz, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2122 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2123 if (! scaled) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2124 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2125 Complex expz = exp (- 2.0 / 3.0 * z * sqrt (z)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2126 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2127 double rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2128 double iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2129 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2130 double tmp = ar*rexpz - ai*iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2131 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2132 ai = ar*iexpz + ai*rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2133 ar = tmp; |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2134 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2135 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2136 if (zi == 0.0 && (! scaled || zr >= 0.0)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2137 ai = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2138 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2139 return bessel_return_value (Complex (ar, ai), ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2140 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2141 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2142 Complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2143 biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2144 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2145 double ar = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2146 double ai = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2147 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2148 double zr = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2149 double zi = z.imag (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2150 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2151 octave_idx_type id = deriv ? 1 : 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2152 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2153 F77_FUNC (zbiry, ZBIRY) (zr, zi, id, 2, ar, ai, ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2154 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2155 if (! scaled) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2156 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2157 Complex expz = exp (std::abs (real (2.0 / 3.0 * z * sqrt (z)))); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2158 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2159 double rexpz = real (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2160 double iexpz = imag (expz); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2161 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2162 double tmp = ar*rexpz - ai*iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2163 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2164 ai = ar*iexpz + ai*rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2165 ar = tmp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2166 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2167 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2168 if (zi == 0.0 && (! scaled || zr >= 0.0)) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2169 ai = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2170 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2171 return bessel_return_value (Complex (ar, ai), ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2172 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2173 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2174 ComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2175 airy (const ComplexMatrix& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2176 Array<octave_idx_type>& ierr) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2177 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2178 octave_idx_type nr = z.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2179 octave_idx_type nc = z.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2180 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2181 ComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2182 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2183 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2184 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2185 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2186 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2187 retval(i,j) = airy (z(i,j), deriv, scaled, ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2188 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2189 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2190 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2191 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2192 ComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2193 biry (const ComplexMatrix& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2194 Array<octave_idx_type>& ierr) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2195 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2196 octave_idx_type nr = z.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2197 octave_idx_type nc = z.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2198 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2199 ComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2200 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2201 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2202 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2203 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2204 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2205 retval(i,j) = biry (z(i,j), deriv, scaled, ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2206 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2207 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2208 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2209 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2210 ComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2211 airy (const ComplexNDArray& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2212 Array<octave_idx_type>& ierr) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2213 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2214 dim_vector dv = z.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2215 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2216 ComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2217 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2218 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2219 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2220 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2221 retval(i) = airy (z(i), deriv, scaled, ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2222 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2223 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2224 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2225 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2226 ComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2227 biry (const ComplexNDArray& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2228 Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2229 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2230 dim_vector dv = z.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2231 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2232 ComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2233 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2234 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2235 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2236 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2237 retval(i) = biry (z(i), deriv, scaled, ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2238 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2239 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2240 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2241 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2242 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2243 airy (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2244 { |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2245 FloatComplex a; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2246 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2247 octave_idx_type nz; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2248 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2249 octave_idx_type id = deriv ? 1 : 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2250 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2251 F77_FUNC (cairy, CAIRY) (F77_CONST_CMPLX_ARG (&z), id, 2, F77_CMPLX_ARG (&a), nz, ierr); |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2252 |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2253 float ar = a.real (); |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2254 float ai = a.imag (); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2255 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2256 if (! scaled) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2257 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2258 FloatComplex expz = exp (- 2.0f / 3.0f * z * sqrt (z)); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2259 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2260 float rexpz = real (expz); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2261 float iexpz = imag (expz); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2262 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2263 float tmp = ar*rexpz - ai*iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2264 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2265 ai = ar*iexpz + ai*rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2266 ar = tmp; |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2267 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2268 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2269 if (z.imag () == 0.0 && (! scaled || z.real () >= 0.0)) |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2270 ai = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2271 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2272 return bessel_return_value (FloatComplex (ar, ai), ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2273 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2274 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2275 FloatComplex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2276 biry (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2277 { |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2278 FloatComplex a; |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2279 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2280 octave_idx_type id = deriv ? 1 : 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2281 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2282 F77_FUNC (cbiry, CBIRY) (F77_CONST_CMPLX_ARG (&z), id, 2, F77_CMPLX_ARG (&a), ierr); |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2283 |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2284 float ar = a.real (); |
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2285 float ai = a.imag (); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2286 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2287 if (! scaled) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2288 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2289 FloatComplex expz = exp (std::abs (real (2.0f / 3.0f * z * sqrt (z)))); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2290 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2291 float rexpz = real (expz); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2292 float iexpz = imag (expz); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2293 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2294 float tmp = ar*rexpz - ai*iexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2295 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2296 ai = ar*iexpz + ai*rexpz; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2297 ar = tmp; |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10258
diff
changeset
|
2298 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2299 |
22135
407c66ae1e20
reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents:
22133
diff
changeset
|
2300 if (z.imag () == 0.0 && (! scaled || z.real () >= 0.0)) |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2301 ai = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2302 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2303 return bessel_return_value (FloatComplex (ar, ai), ierr); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2304 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2305 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2306 FloatComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2307 airy (const FloatComplexMatrix& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2308 Array<octave_idx_type>& ierr) |
4506 | 2309 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2310 octave_idx_type nr = z.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2311 octave_idx_type nc = z.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2312 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2313 FloatComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2314 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2315 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2316 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2317 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2318 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2319 retval(i,j) = airy (z(i,j), deriv, scaled, ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2320 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2321 return retval; |
4506 | 2322 } |
3220 | 2323 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2324 FloatComplexMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2325 biry (const FloatComplexMatrix& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2326 Array<octave_idx_type>& ierr) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2327 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2328 octave_idx_type nr = z.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2329 octave_idx_type nc = z.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2330 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2331 FloatComplexMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2332 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2333 ierr.resize (dim_vector (nr, nc)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2334 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2335 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2336 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2337 retval(i,j) = biry (z(i,j), deriv, scaled, ierr(i,j)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2338 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2339 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2340 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2341 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2342 FloatComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2343 airy (const FloatComplexNDArray& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2344 Array<octave_idx_type>& ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2345 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2346 dim_vector dv = z.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2347 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2348 FloatComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2349 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2350 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2351 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2352 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2353 retval(i) = airy (z(i), deriv, scaled, ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2354 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2355 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2356 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2357 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2358 FloatComplexNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2359 biry (const FloatComplexNDArray& z, bool deriv, bool scaled, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2360 Array<octave_idx_type>& ierr) |
4844 | 2361 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2362 dim_vector dv = z.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2363 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2364 FloatComplexNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2365 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2366 ierr.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2367 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2368 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2369 retval(i) = biry (z(i), deriv, scaled, ierr(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2370 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2371 return retval; |
4844 | 2372 } |
2373 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2374 OCTAVE_NORETURN static void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2375 err_betainc_nonconformant (const dim_vector& d1, const dim_vector& d2, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2376 const dim_vector& d3) |
4844 | 2377 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2378 std::string d1_str = d1.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2379 std::string d2_str = d2.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2380 std::string d3_str = d3.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2381 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2382 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2383 ("betainc: nonconformant arguments (x is %s, a is %s, b is %s)", |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2384 d1_str.c_str (), d2_str.c_str (), d3_str.c_str ()); |
4844 | 2385 } |
2386 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2387 OCTAVE_NORETURN static void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2388 err_betaincinv_nonconformant (const dim_vector& d1, const dim_vector& d2, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2389 const dim_vector& d3) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2390 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2391 std::string d1_str = d1.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2392 std::string d2_str = d2.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2393 std::string d3_str = d3.str (); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2394 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2395 (*current_liboctave_error_handler) |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2396 ("betaincinv: nonconformant arguments (x is %s, a is %s, b is %s)", |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2397 d1_str.c_str (), d2_str.c_str (), d3_str.c_str ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2398 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2399 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2400 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2401 betainc (double x, double a, double b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2402 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2403 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2404 F77_XFCN (xdbetai, XDBETAI, (x, a, b, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2405 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2406 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2407 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2408 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2409 betainc (double x, double a, const Array<double>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2410 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2411 dim_vector dv = b.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2412 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2413 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2414 Array<double> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2415 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2416 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2417 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2418 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2419 *pretval++ = betainc (x, a, b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2420 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2421 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2422 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2423 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2424 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2425 betainc (double x, const Array<double>& a, double b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2426 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2427 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2428 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2429 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2430 Array<double> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2431 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2432 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2433 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2434 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2435 *pretval++ = betainc (x, a(i), b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2436 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2437 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2438 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2439 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2440 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2441 betainc (double x, const Array<double>& a, const Array<double>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2442 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2443 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2444 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2445 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2446 if (dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2447 err_betainc_nonconformant (dim_vector (0, 0), dv, b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2448 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2449 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2450 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2451 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2452 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2453 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2454 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2455 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2456 *pretval++ = betainc (x, a(i), b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2457 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2458 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2459 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2460 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2461 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2462 betainc (const Array<double>& x, double a, double b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2463 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2464 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2465 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2466 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2467 Array<double> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2468 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2469 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2470 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2471 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2472 *pretval++ = betainc (x(i), a, b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2473 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2474 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2475 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2476 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2477 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2478 betainc (const Array<double>& x, double a, const Array<double>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2479 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2480 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2481 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2482 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2483 if (dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2484 err_betainc_nonconformant (dv, dim_vector (0, 0), b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2485 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2486 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2487 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2488 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2489 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2490 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2491 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2492 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2493 *pretval++ = betainc (x(i), a, b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2494 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2495 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2496 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2497 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2498 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2499 betainc (const Array<double>& x, const Array<double>& a, double b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2500 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2501 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2502 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2503 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2504 if (dv != a.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2505 err_betainc_nonconformant (dv, a.dims (), dim_vector (0, 0)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2506 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2507 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2508 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2509 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2510 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2511 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2512 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2513 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2514 *pretval++ = betainc (x(i), a(i), b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2515 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2516 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2517 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2518 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2519 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2520 betainc (const Array<double>& x, const Array<double>& a, const Array<double>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2521 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2522 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2523 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2524 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2525 if (dv != a.dims () || dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2526 err_betainc_nonconformant (dv, a.dims (), b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2527 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2528 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2529 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2530 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2531 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2532 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2533 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2534 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2535 *pretval++ = betainc (x(i), a(i), b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2536 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2537 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2538 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2539 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2540 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2541 betainc (float x, float a, float b) |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
2542 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2543 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2544 F77_XFCN (xbetai, XBETAI, (x, a, b, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2545 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2546 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2547 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2548 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2549 betainc (float x, float a, const Array<float>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2550 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2551 dim_vector dv = b.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2552 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2553 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2554 Array<float> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2555 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2556 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2557 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2558 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2559 *pretval++ = betainc (x, a, b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2560 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2561 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2562 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2563 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2564 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2565 betainc (float x, const Array<float>& a, float b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2566 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2567 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2568 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2569 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2570 Array<float> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2571 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2572 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2573 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2574 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2575 *pretval++ = betainc (x, a(i), b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2576 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2577 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2578 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2579 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2580 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2581 betainc (float x, const Array<float>& a, const Array<float>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2582 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2583 Array<float> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2584 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2585 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2586 if (dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2587 err_betainc_nonconformant (dim_vector (0, 0), dv, b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2588 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2589 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2590 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2591 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2592 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2593 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2594 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2595 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2596 *pretval++ = betainc (x, a(i), b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2597 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2598 return retval; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
2599 } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2600 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2601 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2602 betainc (const Array<float>& x, float a, float b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2603 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2604 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2605 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2606 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2607 Array<float> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2608 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2609 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2610 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2611 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2612 *pretval++ = betainc (x(i), a, b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2613 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2614 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2615 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2616 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2617 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2618 betainc (const Array<float>& x, float a, const Array<float>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2619 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2620 Array<float> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2621 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2622 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2623 if (dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2624 err_betainc_nonconformant (dv, dim_vector (0, 0), b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2625 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2626 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2627 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2628 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2629 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2630 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2631 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2632 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2633 *pretval++ = betainc (x(i), a, b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2634 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2635 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2636 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2637 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2638 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2639 betainc (const Array<float>& x, const Array<float>& a, float b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2640 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2641 Array<float> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2642 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2643 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2644 if (dv != a.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2645 err_betainc_nonconformant (dv, a.dims (), dim_vector (0, 0)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2646 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2647 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2648 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2649 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2650 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2651 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2652 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2653 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2654 *pretval++ = betainc (x(i), a(i), b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2655 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2656 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2657 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2658 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2659 Array<float> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2660 betainc (const Array<float>& x, const Array<float>& a, const Array<float>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2661 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2662 Array<float> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2663 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2664 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2665 if (dv != a.dims () || dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2666 err_betainc_nonconformant (dv, a.dims (), b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2667 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2668 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2669 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2670 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2671 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2672 float *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2673 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2674 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2675 *pretval++ = betainc (x(i), a(i), b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2676 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2677 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2678 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2679 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2680 // FIXME: there is still room for improvement here... |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2681 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2682 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2683 gammainc (double x, double a, bool& err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2684 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2685 if (a < 0.0 || x < 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2686 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2687 ("gammainc: A and X must be non-negative"); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2688 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2689 err = false; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2690 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2691 double retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2692 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2693 F77_XFCN (xgammainc, XGAMMAINC, (a, x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2694 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2695 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2696 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2697 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2698 Matrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2699 gammainc (double x, const Matrix& a) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2700 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2701 octave_idx_type nr = a.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2702 octave_idx_type nc = a.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2703 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2704 Matrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2705 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2706 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2707 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2708 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2709 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2710 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2711 retval(i,j) = gammainc (x, a(i,j), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2712 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2713 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2714 return Matrix (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2715 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2716 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2717 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2718 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2719 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2720 Matrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2721 gammainc (const Matrix& x, double a) |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2722 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2723 octave_idx_type nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2724 octave_idx_type nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2725 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2726 Matrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2727 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2728 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2729 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2730 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2731 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2732 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2733 retval(i,j) = gammainc (x(i,j), a, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2734 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2735 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2736 return Matrix (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2737 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2738 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2739 return retval; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2740 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7638
diff
changeset
|
2741 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2742 Matrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2743 gammainc (const Matrix& x, const Matrix& a) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2744 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2745 octave_idx_type nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2746 octave_idx_type nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2747 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2748 octave_idx_type a_nr = a.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2749 octave_idx_type a_nc = a.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2750 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2751 if (nr != a_nr || nc != a_nc) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2752 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2753 ("gammainc: nonconformant arguments (arg 1 is %dx%d, arg 2 is %dx%d)", |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2754 nr, nc, a_nr, a_nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2755 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2756 Matrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2757 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2758 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2759 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2760 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2761 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2762 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2763 retval(i,j) = gammainc (x(i,j), a(i,j), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2764 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2765 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2766 return Matrix (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2767 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2768 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2769 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2770 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2771 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2772 NDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2773 gammainc (double x, const NDArray& a) |
4844 | 2774 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2775 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2776 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2777 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2778 NDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2779 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2780 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2781 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2782 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2783 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2784 retval(i) = gammainc (x, a(i), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2785 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2786 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2787 return NDArray (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2788 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2789 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2790 return retval; |
4844 | 2791 } |
2792 | |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2793 NDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2794 gammainc (const NDArray& x, double a) |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
2795 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2796 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2797 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2798 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2799 NDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2800 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2801 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2802 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2803 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2804 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2805 retval(i) = gammainc (x(i), a, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2806 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2807 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2808 return NDArray (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2809 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2810 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2811 return retval; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
2812 } |
4844 | 2813 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2814 NDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2815 gammainc (const NDArray& x, const NDArray& a) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2816 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2817 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2818 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2819 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2820 if (dv != a.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2821 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2822 std::string x_str = dv.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2823 std::string a_str = a.dims ().str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2824 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2825 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2826 ("gammainc: nonconformant arguments (arg 1 is %s, arg 2 is %s)", |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2827 x_str.c_str (), a_str.c_str ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2828 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2829 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2830 NDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2831 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2832 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2833 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2834 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2835 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2836 retval(i) = gammainc (x(i), a(i), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2837 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2838 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2839 return NDArray (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2840 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2841 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2842 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2843 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2844 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2845 float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2846 gammainc (float x, float a, bool& err) |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2847 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2848 if (a < 0.0 || x < 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2849 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2850 ("gammainc: A and X must be non-negative"); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2851 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2852 err = false; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2853 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2854 float retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2855 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2856 F77_XFCN (xsgammainc, XSGAMMAINC, (a, x, retval)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2857 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2858 return retval; |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2859 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2860 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2861 FloatMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2862 gammainc (float x, const FloatMatrix& a) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2863 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2864 octave_idx_type nr = a.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2865 octave_idx_type nc = a.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2866 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2867 FloatMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2868 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2869 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2870 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2871 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2872 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2873 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2874 retval(i,j) = gammainc (x, a(i,j), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2875 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2876 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2877 return FloatMatrix (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2878 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2879 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2880 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2881 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2882 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2883 FloatMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2884 gammainc (const FloatMatrix& x, float a) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2885 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2886 octave_idx_type nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2887 octave_idx_type nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2888 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2889 FloatMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2890 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2891 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2892 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2893 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2894 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2895 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2896 retval(i,j) = gammainc (x(i,j), a, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2897 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2898 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2899 return FloatMatrix (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2900 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2901 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2902 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2903 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2904 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2905 FloatMatrix |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2906 gammainc (const FloatMatrix& x, const FloatMatrix& a) |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2907 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2908 octave_idx_type nr = x.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2909 octave_idx_type nc = x.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2910 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2911 octave_idx_type a_nr = a.rows (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2912 octave_idx_type a_nc = a.cols (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2913 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2914 if (nr != a_nr || nc != a_nc) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2915 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2916 ("gammainc: nonconformant arguments (arg 1 is %dx%d, arg 2 is %dx%d)", |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2917 nr, nc, a_nr, a_nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2918 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2919 FloatMatrix retval (nr, nc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2920 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2921 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2922 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2923 for (octave_idx_type j = 0; j < nc; j++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2924 for (octave_idx_type i = 0; i < nr; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2925 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2926 retval(i,j) = gammainc (x(i,j), a(i,j), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2927 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2928 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2929 return FloatMatrix (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2930 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2931 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2932 return retval; |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2933 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2934 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2935 FloatNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2936 gammainc (float x, const FloatNDArray& a) |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2937 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2938 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2939 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2940 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2941 FloatNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2942 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2943 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2944 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2945 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2946 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2947 retval(i) = gammainc (x, a(i), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2948 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2949 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2950 return FloatNDArray (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2951 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2952 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2953 return retval; |
9835
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2954 } |
1bb1ed717d2f
implement built-in erfinv
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
2955 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2956 FloatNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2957 gammainc (const FloatNDArray& x, float a) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2958 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2959 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2960 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2961 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2962 FloatNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2963 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2964 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2965 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2966 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2967 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2968 retval(i) = gammainc (x(i), a, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2969 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2970 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2971 return FloatNDArray (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2972 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2973 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2974 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2975 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2976 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2977 FloatNDArray |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2978 gammainc (const FloatNDArray& x, const FloatNDArray& a) |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14197
diff
changeset
|
2979 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2980 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2981 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2982 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2983 if (dv != a.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2984 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2985 std::string x_str = dv.str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2986 std::string a_str = a.dims ().str (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2987 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2988 (*current_liboctave_error_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2989 ("gammainc: nonconformant arguments (arg 1 is %s, arg 2 is %s)", |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2990 x_str.c_str (), a_str.c_str ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2991 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2992 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2993 FloatNDArray retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2994 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2995 bool err; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2996 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2997 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2998 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
2999 retval(i) = gammainc (x(i), a(i), err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3000 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3001 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3002 return FloatNDArray (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3003 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3004 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3005 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3006 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3007 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3008 Complex rc_log1p (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3009 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3010 const double pi = 3.14159265358979323846; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3011 return (x < -1.0 |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3012 ? Complex (std::log (-(1.0 + x)), pi) |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3013 : Complex (log1p (x))); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3014 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3015 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3016 FloatComplex rc_log1p (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3017 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3018 const float pi = 3.14159265358979323846f; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3019 return (x < -1.0f |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3020 ? FloatComplex (std::log (-(1.0f + x)), pi) |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3021 : FloatComplex (log1p (x))); |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14197
diff
changeset
|
3022 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3023 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3024 // This algorithm is due to P. J. Acklam. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3025 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3026 // See http://home.online.no/~pjacklam/notes/invnorm/ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3027 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3028 // The rational approximation has relative accuracy 1.15e-9 in the whole |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3029 // region. For doubles, it is refined by a single step of Halley's 3rd |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3030 // order method. For single precision, the accuracy is already OK, so |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3031 // we skip it to get faster evaluation. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3032 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3033 static double do_erfinv (double x, bool refine) |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14197
diff
changeset
|
3034 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3035 // Coefficients of rational approximation. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3036 static const double a[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3037 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3038 -2.806989788730439e+01, 1.562324844726888e+02, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3039 -1.951109208597547e+02, 9.783370457507161e+01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3040 -2.168328665628878e+01, 1.772453852905383e+00 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3041 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3042 static const double b[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3043 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3044 -5.447609879822406e+01, 1.615858368580409e+02, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3045 -1.556989798598866e+02, 6.680131188771972e+01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3046 -1.328068155288572e+01 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3047 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3048 static const double c[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3049 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3050 -5.504751339936943e-03, -2.279687217114118e-01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3051 -1.697592457770869e+00, -1.802933168781950e+00, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3052 3.093354679843505e+00, 2.077595676404383e+00 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3053 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3054 static const double d[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3055 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3056 7.784695709041462e-03, 3.224671290700398e-01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3057 2.445134137142996e+00, 3.754408661907416e+00 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3058 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3059 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3060 static const double spi2 = 8.862269254527579e-01; // sqrt(pi)/2. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3061 static const double pbreak = 0.95150; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3062 double ax = fabs (x), y; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3063 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3064 // Select case. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3065 if (ax <= pbreak) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3066 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3067 // Middle region. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3068 const double q = 0.5 * x, r = q*q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3069 const double yn = (((((a[0]*r + a[1])*r + a[2])*r + a[3])*r + a[4])*r + a[5])*q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3070 const double yd = ((((b[0]*r + b[1])*r + b[2])*r + b[3])*r + b[4])*r + 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3071 y = yn / yd; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3072 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3073 else if (ax < 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3074 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3075 // Tail region. |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3076 const double q = sqrt (-2*std::log (0.5*(1-ax))); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3077 const double yn = ((((c[0]*q + c[1])*q + c[2])*q + c[3])*q + c[4])*q + c[5]; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3078 const double yd = (((d[0]*q + d[1])*q + d[2])*q + d[3])*q + 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3079 y = yn / yd * octave::math::signum (-x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3080 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3081 else if (ax == 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3082 return octave::numeric_limits<double>::Inf () * octave::math::signum (x); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3083 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3084 return octave::numeric_limits<double>::NaN (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3085 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3086 if (refine) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3087 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3088 // One iteration of Halley's method gives full precision. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3089 double u = (erf (y) - x) * spi2 * exp (y*y); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3090 y -= u / (1 + y*u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3091 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3092 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3093 return y; |
14770
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14197
diff
changeset
|
3094 } |
cb85e836d035
New function: erfcinv (bug #36607)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14197
diff
changeset
|
3095 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3096 double erfinv (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3097 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3098 return do_erfinv (x, true); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3099 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3100 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3101 float erfinv (float x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3102 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3103 return do_erfinv (x, false); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3104 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3105 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3106 // The algorthim for erfcinv is an adaptation of the erfinv algorithm |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3107 // above from P. J. Acklam. It has been modified to run over the |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3108 // different input domain of erfcinv. See the notes for erfinv for an |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3109 // explanation. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3110 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3111 static double do_erfcinv (double x, bool refine) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3112 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3113 // Coefficients of rational approximation. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3114 static const double a[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3115 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3116 -2.806989788730439e+01, 1.562324844726888e+02, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3117 -1.951109208597547e+02, 9.783370457507161e+01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3118 -2.168328665628878e+01, 1.772453852905383e+00 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3119 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3120 static const double b[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3121 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3122 -5.447609879822406e+01, 1.615858368580409e+02, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3123 -1.556989798598866e+02, 6.680131188771972e+01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3124 -1.328068155288572e+01 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3125 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3126 static const double c[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3127 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3128 -5.504751339936943e-03, -2.279687217114118e-01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3129 -1.697592457770869e+00, -1.802933168781950e+00, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3130 3.093354679843505e+00, 2.077595676404383e+00 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3131 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3132 static const double d[] = |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3133 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3134 7.784695709041462e-03, 3.224671290700398e-01, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3135 2.445134137142996e+00, 3.754408661907416e+00 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3136 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3137 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3138 static const double spi2 = 8.862269254527579e-01; // sqrt(pi)/2. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3139 static const double pbreak_lo = 0.04850; // 1-pbreak |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3140 static const double pbreak_hi = 1.95150; // 1+pbreak |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3141 double y; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3142 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3143 // Select case. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3144 if (x >= pbreak_lo && x <= pbreak_hi) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3145 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3146 // Middle region. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3147 const double q = 0.5*(1-x), r = q*q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3148 const double yn = (((((a[0]*r + a[1])*r + a[2])*r + a[3])*r + a[4])*r + a[5])*q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3149 const double yd = ((((b[0]*r + b[1])*r + b[2])*r + b[3])*r + b[4])*r + 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3150 y = yn / yd; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3151 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3152 else if (x > 0.0 && x < 2.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3153 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3154 // Tail region. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3155 const double q = (x < 1 |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3156 ? sqrt (-2*std::log (0.5*x)) |
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3157 : sqrt (-2*std::log (0.5*(2-x)))); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3158 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3159 const double yn = ((((c[0]*q + c[1])*q + c[2])*q + c[3])*q + c[4])*q + c[5]; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3160 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3161 const double yd = (((d[0]*q + d[1])*q + d[2])*q + d[3])*q + 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3162 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3163 y = yn / yd; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3164 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3165 if (x < pbreak_lo) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3166 y = -y; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3167 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3168 else if (x == 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3169 return octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3170 else if (x == 2.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3171 return -octave::numeric_limits<double>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3172 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3173 return octave::numeric_limits<double>::NaN (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3174 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3175 if (refine) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3176 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3177 // One iteration of Halley's method gives full precision. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3178 double u = (erf (y) - (1-x)) * spi2 * exp (y*y); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3179 y -= u / (1 + y*u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3180 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3181 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3182 return y; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3183 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3184 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3185 double erfcinv (double x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3186 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3187 return do_erfcinv (x, true); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3188 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3189 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3190 float erfcinv (float x) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3191 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3192 return do_erfcinv (x, false); |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3193 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3194 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3195 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3196 // Incomplete Beta function ratio |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3197 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3198 // Algorithm based on the one by John Burkardt. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3199 // See http://people.sc.fsu.edu/~jburkardt/cpp_src/asa109/asa109.html |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3200 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3201 // The original code is distributed under the GNU LGPL v3 license. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3202 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3203 // Reference: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3204 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3205 // KL Majumder, GP Bhattacharjee, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3206 // Algorithm AS 63: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3207 // The incomplete Beta Integral, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3208 // Applied Statistics, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3209 // Volume 22, Number 3, 1973, pages 409-411. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3210 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3211 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3212 betain (double x, double p, double q, double beta, bool& err) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3213 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3214 double acu = 0.1E-14, ai, cx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3215 bool indx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3216 int ns; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3217 double pp, psq, qq, rx, temp, term, value, xx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3218 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3219 value = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3220 err = false; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3221 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3222 // Check the input arguments. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3223 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3224 if ((p <= 0.0 || q <= 0.0) || (x < 0.0 || 1.0 < x)) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3225 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3226 err = true; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3227 return value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3228 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3229 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3230 // Special cases. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3231 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3232 if (x == 0.0 || x == 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3233 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3234 return value; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3235 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3236 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3237 // Change tail if necessary and determine S. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3238 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3239 psq = p + q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3240 cx = 1.0 - x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3241 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3242 if (p < psq * x) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3243 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3244 xx = cx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3245 cx = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3246 pp = q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3247 qq = p; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3248 indx = true; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3249 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3250 else |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3251 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3252 xx = x; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3253 pp = p; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3254 qq = q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3255 indx = false; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3256 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3257 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3258 term = 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3259 ai = 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3260 value = 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3261 ns = static_cast<int> (qq + cx * psq); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3262 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3263 // Use the Soper reduction formula. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3264 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3265 rx = xx / cx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3266 temp = qq - ai; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3267 if (ns == 0) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3268 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3269 rx = xx; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3270 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3271 |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3272 for ( ; ; ) |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3273 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3274 term *= temp * rx / (pp + ai); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3275 value += term; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3276 temp = fabs (term); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3277 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3278 if (temp <= acu && temp <= acu * value) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3279 { |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3280 value *= exp (pp * std::log (xx) |
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3281 + (qq - 1.0) * std::log (cx) - beta) / pp; |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3282 |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3283 if (indx) |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3284 { |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3285 value = 1.0 - value; |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3286 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3287 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3288 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3289 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3290 ai += 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3291 ns -= 1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3292 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3293 if (0 <= ns) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3294 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3295 temp = qq - ai; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3296 if (ns == 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3297 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3298 rx = xx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3299 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3300 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3301 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3302 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3303 temp = psq; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3304 psq += 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3305 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3306 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3307 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3308 return value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3309 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3310 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3311 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3312 // Inverse of the incomplete Beta function |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3313 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3314 // Algorithm based on the one by John Burkardt. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3315 // See http://people.sc.fsu.edu/~jburkardt/cpp_src/asa109/asa109.html |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3316 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3317 // The original code is distributed under the GNU LGPL v3 license. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3318 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3319 // Reference: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3320 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3321 // GW Cran, KJ Martin, GE Thomas, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3322 // Remark AS R19 and Algorithm AS 109: |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3323 // A Remark on Algorithms AS 63: The Incomplete Beta Integral |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3324 // and AS 64: Inverse of the Incomplete Beta Integeral, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3325 // Applied Statistics, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3326 // Volume 26, Number 1, 1977, pages 111-114. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3327 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3328 double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3329 betaincinv (double y, double p, double q) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3330 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3331 double a, acu, adj, fpu, g, h; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3332 int iex; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3333 bool indx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3334 double pp, prev, qq, r, s, sae = -37.0, sq, t, tx, value, w, xin, ycur, yprev; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3335 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3336 double beta = lgamma (p) + lgamma (q) - lgamma (p + q); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3337 bool err = false; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3338 fpu = pow (10.0, sae); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3339 value = y; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3340 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3341 // Test for admissibility of parameters. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3342 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3343 if (p <= 0.0 || q <= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3344 (*current_liboctave_error_handler) ("betaincinv: wrong parameters"); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3345 if (y < 0.0 || 1.0 < y) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3346 (*current_liboctave_error_handler) ("betaincinv: wrong parameter Y"); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3347 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3348 if (y == 0.0 || y == 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3349 return value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3350 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3351 // Change tail if necessary. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3352 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3353 if (0.5 < y) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3354 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3355 a = 1.0 - y; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3356 pp = q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3357 qq = p; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3358 indx = true; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3359 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3360 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3361 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3362 a = y; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3363 pp = p; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3364 qq = q; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3365 indx = false; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3366 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3367 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3368 // Calculate the initial approximation. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3369 |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3370 r = sqrt (- std::log (a * a)); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3371 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3372 ycur = r - (2.30753 + 0.27061 * r) / (1.0 + (0.99229 + 0.04481 * r) * r); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3373 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3374 if (1.0 < pp && 1.0 < qq) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3375 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3376 r = (ycur * ycur - 3.0) / 6.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3377 s = 1.0 / (pp + pp - 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3378 t = 1.0 / (qq + qq - 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3379 h = 2.0 / (s + t); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3380 w = ycur * sqrt (h + r) / h - (t - s) * (r + 5.0 / 6.0 - 2.0 / (3.0 * h)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3381 value = pp / (pp + qq * exp (w + w)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3382 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3383 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3384 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3385 r = qq + qq; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3386 t = 1.0 / (9.0 * qq); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3387 t = r * pow (1.0 - t + ycur * sqrt (t), 3); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3388 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3389 if (t <= 0.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3390 { |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3391 value = 1.0 - exp ((std::log ((1.0 - a) * qq) + beta) / qq); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3392 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3393 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3394 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3395 t = (4.0 * pp + r - 2.0) / t; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3396 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3397 if (t <= 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3398 { |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3399 value = exp ((std::log (a * pp) + beta) / pp); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3400 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3401 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3402 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3403 value = 1.0 - 2.0 / (t + 1.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3404 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3405 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3406 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3407 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3408 // Solve for X by a modified Newton-Raphson method, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3409 // using the function BETAIN. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3410 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3411 r = 1.0 - pp; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3412 t = 1.0 - qq; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3413 yprev = 0.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3414 sq = 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3415 prev = 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3416 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3417 if (value < 0.0001) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3418 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3419 value = 0.0001; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3420 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3421 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3422 if (0.9999 < value) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3423 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3424 value = 0.9999; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3425 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3426 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3427 iex = std::max (- 5.0 / pp / pp - 1.0 / pow (a, 0.2) - 13.0, sae); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3428 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3429 acu = pow (10.0, iex); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3430 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3431 for ( ; ; ) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3432 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3433 ycur = betain (value, pp, qq, beta, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3434 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3435 if (err) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3436 { |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3437 return value; |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3438 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3439 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3440 xin = value; |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3441 ycur = (ycur - a) * exp (beta + r * std::log (xin) |
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3442 + t * std::log (1.0 - xin)); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3443 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3444 if (ycur * yprev <= 0.0) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3445 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3446 prev = std::max (sq, fpu); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3447 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3448 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3449 g = 1.0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3450 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3451 for ( ; ; ) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3452 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3453 for ( ; ; ) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3454 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3455 adj = g * ycur; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3456 sq = adj * adj; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3457 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3458 if (sq < prev) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3459 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3460 tx = value - adj; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3461 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3462 if (0.0 <= tx && tx <= 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3463 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3464 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3465 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3466 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3467 g /= 3.0; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3468 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3469 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3470 if (prev <= acu) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3471 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3472 if (indx) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3473 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3474 value = 1.0 - value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3475 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3476 return value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3477 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3478 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3479 if (ycur * ycur <= acu) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3480 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3481 if (indx) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3482 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3483 value = 1.0 - value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3484 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3485 return value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3486 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3487 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3488 if (tx != 0.0 && tx != 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3489 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3490 break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3491 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3492 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3493 g /= 3.0; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3494 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3495 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3496 if (tx == value) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3497 { |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3498 break; |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3499 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3500 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3501 value = tx; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3502 yprev = ycur; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3503 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3504 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3505 if (indx) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3506 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3507 value = 1.0 - value; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3508 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3509 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3510 return value; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3511 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3512 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3513 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3514 betaincinv (double x, double a, const Array<double>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3515 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3516 dim_vector dv = b.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3517 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3518 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3519 Array<double> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3520 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3521 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3522 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3523 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3524 *pretval++ = betaincinv (x, a, b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3525 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3526 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3527 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3528 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3529 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3530 betaincinv (double x, const Array<double>& a, double b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3531 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3532 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3533 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3534 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3535 Array<double> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3536 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3537 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3538 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3539 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3540 *pretval++ = betaincinv (x, a(i), b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3541 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3542 return retval; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3543 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3544 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3545 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3546 betaincinv (double x, const Array<double>& a, const Array<double>& b) |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3547 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3548 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3549 dim_vector dv = a.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3550 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3551 if (dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3552 err_betaincinv_nonconformant (dim_vector (0, 0), dv, b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3553 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3554 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3555 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3556 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3557 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3558 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3559 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3560 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3561 *pretval++ = betaincinv (x, a(i), b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3562 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3563 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3564 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3565 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3566 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3567 betaincinv (const Array<double>& x, double a, double b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3568 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3569 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3570 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3571 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3572 Array<double> retval (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3573 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3574 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3575 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3576 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3577 *pretval++ = betaincinv (x(i), a, b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3578 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3579 return retval; |
14816
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3580 } |
0a868d90436b
New function: betaincinv (bug #34364)
Axel Mathéi <axel.mathei@gmail.com>
parents:
14815
diff
changeset
|
3581 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3582 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3583 betaincinv (const Array<double>& x, double a, const Array<double>& b) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3584 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3585 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3586 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3587 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3588 if (dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3589 err_betaincinv_nonconformant (dv, dim_vector (0, 0), b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3590 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3591 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3592 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3593 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3594 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3595 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3596 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3597 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3598 *pretval++ = betaincinv (x(i), a, b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3599 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3600 return retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3601 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3602 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3603 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3604 betaincinv (const Array<double>& x, const Array<double>& a, double b) |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3605 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3606 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3607 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3608 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3609 if (dv != a.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3610 err_betaincinv_nonconformant (dv, a.dims (), dim_vector (0, 0)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3611 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3612 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3613 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3614 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3615 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3616 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3617 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3618 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3619 *pretval++ = betaincinv (x(i), a(i), b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3620 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3621 return retval; |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3622 } |
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3623 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3624 Array<double> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3625 betaincinv (const Array<double>& x, const Array<double>& a, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3626 const Array<double>& b) |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3627 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3628 Array<double> retval; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3629 dim_vector dv = x.dims (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3630 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3631 if (dv != a.dims () && dv != b.dims ()) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3632 err_betaincinv_nonconformant (dv, a.dims (), b.dims ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3633 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3634 octave_idx_type nel = dv.numel (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3635 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3636 retval.resize (dv); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3637 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3638 double *pretval = retval.fortran_vec (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3639 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3640 for (octave_idx_type i = 0; i < nel; i++) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3641 *pretval++ = betaincinv (x(i), a(i), b(i)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3642 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3643 return retval; |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3644 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3645 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3646 void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3647 ellipj (double u, double m, double& sn, double& cn, double& dn, double& err) |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3648 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3649 static const int Nmax = 16; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3650 double m1, t=0, si_u, co_u, se_u, ta_u, b, c[Nmax], a[Nmax], phi; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3651 int n, Nn, ii; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3652 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3653 if (m < 0 || m > 1) |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3654 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3655 (*current_liboctave_warning_with_id_handler) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3656 ("Octave:ellipj-invalid-m", "ellipj: invalid M value, required value 0 <= M <= 1"); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3657 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3658 sn = cn = dn = lo_ieee_nan_value (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3659 |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3660 return; |
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3661 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3662 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3663 double sqrt_eps = sqrt (std::numeric_limits<double>::epsilon ()); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3664 if (m < sqrt_eps) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3665 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3666 // For small m, (Abramowitz and Stegun, Section 16.13) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3667 si_u = sin (u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3668 co_u = cos (u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3669 t = 0.25*m*(u - si_u*co_u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3670 sn = si_u - t * co_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3671 cn = co_u + t * si_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3672 dn = 1 - 0.5*m*si_u*si_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3673 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3674 else if ((1 - m) < sqrt_eps) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3675 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3676 // For m1 = (1-m) small (Abramowitz and Stegun, Section 16.15) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3677 m1 = 1 - m; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3678 si_u = sinh (u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3679 co_u = cosh (u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3680 ta_u = tanh (u); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3681 se_u = 1/co_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3682 sn = ta_u + 0.25*m1*(si_u*co_u - u)*se_u*se_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3683 cn = se_u - 0.25*m1*(si_u*co_u - u)*ta_u*se_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3684 dn = se_u + 0.25*m1*(si_u*co_u + u)*ta_u*se_u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3685 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3686 else |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3687 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3688 // Arithmetic-Geometric Mean (AGM) algorithm |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3689 // (Abramowitz and Stegun, Section 16.4) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3690 a[0] = 1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3691 b = sqrt (1 - m); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3692 c[0] = sqrt (m); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3693 for (n = 1; n < Nmax; ++n) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3694 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3695 a[n] = (a[n - 1] + b)/2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3696 c[n] = (a[n - 1] - b)/2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3697 b = sqrt (a[n - 1]*b); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3698 if (c[n]/a[n] < std::numeric_limits<double>::epsilon ()) break; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3699 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3700 if (n >= Nmax - 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3701 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3702 err = 1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3703 return; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3704 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3705 Nn = n; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3706 for (ii = 1; n > 0; ii = ii*2, --n) ; // ii = pow(2,Nn) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3707 phi = ii*a[Nn]*u; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3708 for (n = Nn; n > 0; --n) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3709 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3710 phi = (asin ((c[n]/a[n])* sin (phi)) + phi)/2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3711 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3712 sn = sin (phi); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3713 cn = cos (phi); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3714 dn = sqrt (1 - m*sn*sn); |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3715 } |
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3716 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3717 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3718 void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3719 ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3720 double& err) |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3721 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3722 double m1 = 1 - m, ss1, cc1, dd1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3723 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3724 ellipj (imag (u), m1, ss1, cc1, dd1, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3725 if (real (u) == 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3726 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3727 // u is pure imag: Jacoby imag. transf. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3728 sn = Complex (0, ss1/cc1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3729 cn = 1/cc1; // cn.imag = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3730 dn = dd1/cc1; // dn.imag = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3731 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3732 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3733 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3734 // u is generic complex |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3735 double ss, cc, dd, ddd; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3736 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3737 ellipj (real (u), m, ss, cc, dd, err); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3738 ddd = cc1*cc1 + m*ss*ss*ss1*ss1; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3739 sn = Complex (ss*dd1/ddd, cc*dd*ss1*cc1/ddd); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3740 cn = Complex (cc*cc1/ddd, -ss*dd*ss1*dd1/ddd); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3741 dn = Complex (dd*cc1*dd1/ddd, -m*ss*cc*ss1/ddd); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3742 } |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3743 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3744 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3745 static const double pi = 3.14159265358979323846; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3746 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3747 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3748 static inline T |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3749 xlog (const T& x) |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3750 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3751 return log (x); |
17502
578805a293e5
ellipj: Move numerical code into liboctave
Mike Miller <mtmiller@ieee.org>
parents:
15852
diff
changeset
|
3752 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3753 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3754 template <> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3755 inline double |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3756 xlog (const double& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3757 { |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3758 return std::log (x); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3759 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3760 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3761 template <> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3762 inline float |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3763 xlog (const float& x) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3764 { |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3765 return std::log (x); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3766 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3767 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3768 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3769 static T |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3770 lanczos_approximation_psi (const T zc) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3771 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3772 // Coefficients for C.Lanczos expansion of psi function from XLiFE++ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3773 // gammaFunctions psi_coef[k] = - (2k+1) * lg_coef[k] (see melina++ |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3774 // gamma functions -1/12, 3/360,-5/1260, 7/1680,-9/1188, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3775 // 11*691/360360,-13/156, 15*3617/122400, ? , ? |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3776 static const T dg_coeff[10] = { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3777 -0.83333333333333333e-1, 0.83333333333333333e-2, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3778 -0.39682539682539683e-2, 0.41666666666666667e-2, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3779 -0.75757575757575758e-2, 0.21092796092796093e-1, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3780 -0.83333333333333333e-1, 0.4432598039215686, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3781 -0.3053954330270122e+1, 0.125318899521531e+2 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3782 }; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3783 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3784 T overz2 = T (1.0) / (zc * zc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3785 T overz2k = overz2; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3786 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3787 T p = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3788 for (octave_idx_type k = 0; k < 10; k++, overz2k *= overz2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3789 p += dg_coeff[k] * overz2k; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3790 p += xlog (zc) - T (0.5) / zc; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3791 return p; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3792 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3793 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3794 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3795 T |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3796 xpsi (T z) |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3797 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3798 static const double euler_mascheroni = 0.577215664901532860606512090082402431042; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3799 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3800 const bool is_int = (octave::math::floor (z) == z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3801 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3802 T p = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3803 if (z <= 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3804 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3805 // limits - zeros of the gamma function |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3806 if (is_int) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3807 p = -octave::numeric_limits<T>::Inf (); // Matlab returns -Inf for psi (0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3808 else |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3809 // Abramowitz and Stegun, page 259, eq 6.3.7 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3810 p = psi (1 - z) - (pi / tan (pi * z)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3811 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3812 else if (is_int) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3813 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3814 // Abramowitz and Stegun, page 258, eq 6.3.2 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3815 p = - euler_mascheroni; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3816 for (octave_idx_type k = z - 1; k > 0; k--) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3817 p += 1.0 / k; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3818 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3819 else if (octave::math::floor (z + 0.5) == z + 0.5) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3820 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3821 // Abramowitz and Stegun, page 258, eq 6.3.3 and 6.3.4 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3822 for (octave_idx_type k = z; k > 0; k--) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3823 p += 1.0 / (2 * k - 1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3824 |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21786
diff
changeset
|
3825 p = - euler_mascheroni - 2 * std::log (2) + 2 * (p); |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3826 } |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3827 else |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3828 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3829 // adapted from XLiFE++ gammaFunctions |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3830 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3831 T zc = z; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3832 // Use formula for derivative of LogGamma(z) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3833 if (z < 10) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3834 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3835 const signed char n = 10 - z; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3836 for (signed char k = n - 1; k >= 0; k--) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3837 p -= 1.0 / (k + z); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3838 zc += n; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3839 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3840 p += lanczos_approximation_psi (zc); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3841 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3842 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3843 return p; |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3844 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3845 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3846 // explicit instantiations |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3847 double psi (double z) { return xpsi (z); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3848 float psi (float z) { return xpsi (z); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3849 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3850 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3851 std::complex<T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3852 xpsi (const std::complex<T>& z) |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3853 { |
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3854 // adapted from XLiFE++ gammaFunctions |
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3855 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3856 typedef typename std::complex<T>::value_type P; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3857 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3858 P z_r = z.real (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3859 P z_ra = z_r; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3860 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3861 std::complex<T> dgam (0.0, 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3862 if (z.imag () == 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3863 dgam = std::complex<T> (psi (z_r), 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3864 else if (z_r < 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3865 dgam = psi (P (1.0) - z)- (P (pi) / tan (P (pi) * z)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3866 else |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3867 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3868 // Use formula for derivative of LogGamma(z) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3869 std::complex<T> z_m = z; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3870 if (z_ra < 8) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3871 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3872 unsigned char n = 8 - z_ra; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3873 z_m = z + std::complex<T> (n, 0.0); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3874 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3875 // Recurrence formula. For | Re(z) | < 8, use recursively |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3876 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3877 // DiGamma(z) = DiGamma(z+1) - 1/z |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3878 std::complex<T> z_p = z + P (n - 1); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3879 for (unsigned char k = n; k > 0; k--, z_p -= 1.0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3880 dgam -= P (1.0) / z_p; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3881 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3882 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3883 // for | Re(z) | > 8, use derivative of C.Lanczos expansion for |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3884 // LogGamma |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3885 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3886 // psi(z) = log(z) - 1/(2z) - 1/12z^2 + 3/360z^4 - 5/1260z^6 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3887 // + 7/1680z^8 - 9/1188z^10 + ... |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3888 // |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3889 // (Abramowitz&Stegun, page 259, formula 6.3.18 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3890 dgam += lanczos_approximation_psi (z_m); |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3891 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3892 return dgam; |
20154
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3893 } |
45565ecec019
New function psi to compute the digamma function.
Carnë Draug <carandraug@octave.org>
parents:
19739
diff
changeset
|
3894 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3895 // explicit instantiations |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3896 Complex psi (const Complex& z) { return xpsi (z); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3897 FloatComplex psi (const FloatComplex& z) { return xpsi (z); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3898 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3899 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3900 static inline void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3901 fortran_psifn (const T z, const octave_idx_type n, T* ans, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3902 octave_idx_type* ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3903 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3904 template <> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3905 inline void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3906 fortran_psifn<double> (const double z, const octave_idx_type n, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3907 double* ans, octave_idx_type* ierr) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3908 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3909 octave_idx_type flag = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3910 F77_XFCN (dpsifn, DPSIFN, (&z, n, 1, 1, ans, &flag, ierr)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3911 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3912 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3913 template <> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3914 inline void |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3915 fortran_psifn<float> (const float z, const octave_idx_type n, |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3916 float* ans, octave_idx_type* ierr) |
20155
1fae49e34a1a
psi: add support for complex numbers.
Carnë Draug <carandraug@octave.org>
parents:
20154
diff
changeset
|
3917 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3918 octave_idx_type flag = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3919 F77_XFCN (psifn, PSIFN, (&z, n, 1, 1, ans, &flag, ierr)); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3920 } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3921 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3922 template <typename T> |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3923 T |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3924 xpsi (const octave_idx_type n, T z) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3925 { |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3926 T ans; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3927 octave_idx_type ierr = 0; |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3928 fortran_psifn<T> (z, n, &ans, &ierr); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3929 if (ierr == 0) |
20155
1fae49e34a1a
psi: add support for complex numbers.
Carnë Draug <carandraug@octave.org>
parents:
20154
diff
changeset
|
3930 { |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3931 // Remember that psifn and dpsifn return scales values |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3932 // When n is 1: do nothing since ((-1)**(n+1)/gamma(n+1)) == 1 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3933 // When n is 0: change sign since ((-1)**(n+1)/gamma(n+1)) == -1 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3934 if (n > 1) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3935 // FIXME: xgamma here is a killer for our precision since it grows |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3936 // way too fast. |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3937 ans = ans / (pow (-1.0, n + 1) / gamma (double (n+1))); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3938 else if (n == 0) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3939 ans = -ans; |
20155
1fae49e34a1a
psi: add support for complex numbers.
Carnë Draug <carandraug@octave.org>
parents:
20154
diff
changeset
|
3940 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3941 else if (ierr == 2) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3942 ans = - octave::numeric_limits<T>::Inf (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3943 else // we probably never get here |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3944 ans = octave::numeric_limits<T>::NaN (); |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3945 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3946 return ans; |
20155
1fae49e34a1a
psi: add support for complex numbers.
Carnë Draug <carandraug@octave.org>
parents:
20154
diff
changeset
|
3947 } |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3948 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3949 double psi (octave_idx_type n, double z) { return xpsi (n, z); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3950 float psi (octave_idx_type n, float z) { return xpsi (n, z); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3951 } |
20161
65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
Carnë Draug <carandraug@octave.org>
parents:
20156
diff
changeset
|
3952 } |
65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
Carnë Draug <carandraug@octave.org>
parents:
20156
diff
changeset
|
3953 |
21786
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3954 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3955 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3956 ComplexMatrix besselj (double alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3957 ComplexMatrix bessely (double alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3958 ComplexMatrix besseli (double alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3959 ComplexMatrix besselk (double alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3960 ComplexMatrix besselh1 (double alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3961 ComplexMatrix besselh2 (double alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3962 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3963 ComplexMatrix besselj (const Matrix& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3964 ComplexMatrix bessely (const Matrix& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3965 ComplexMatrix besseli (const Matrix& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3966 ComplexMatrix besselk (const Matrix& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3967 ComplexMatrix besselh1 (const Matrix& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3968 ComplexMatrix besselh2 (const Matrix& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3969 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3970 ComplexMatrix besselj (const Matrix& alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3971 ComplexMatrix bessely (const Matrix& alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3972 ComplexMatrix besseli (const Matrix& alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3973 ComplexMatrix besselk (const Matrix& alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3974 ComplexMatrix besselh1 (const Matrix& alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3975 ComplexMatrix besselh2 (const Matrix& alpha, const ComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3976 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3977 ComplexNDArray besselj (double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3978 ComplexNDArray bessely (double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3979 ComplexNDArray besseli (double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3980 ComplexNDArray besselk (double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3981 ComplexNDArray besselh1 (double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3982 ComplexNDArray besselh2 (double alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3983 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3984 ComplexNDArray besselj (const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3985 ComplexNDArray bessely (const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3986 ComplexNDArray besseli (const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3987 ComplexNDArray besselk (const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3988 ComplexNDArray besselh1 (const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3989 ComplexNDArray besselh2 (const NDArray& alpha, const Complex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3990 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3991 ComplexNDArray besselj (const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3992 ComplexNDArray bessely (const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3993 ComplexNDArray besseli (const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3994 ComplexNDArray besselk (const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3995 ComplexNDArray besselh1 (const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3996 ComplexNDArray besselh2 (const NDArray& alpha, const ComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3997 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3998 ComplexMatrix besselj (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
3999 ComplexMatrix bessely (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4000 ComplexMatrix besseli (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4001 ComplexMatrix besselk (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4002 ComplexMatrix besselh1 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4003 ComplexMatrix besselh2 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4004 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4005 FloatComplexMatrix besselj (float alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4006 FloatComplexMatrix bessely (float alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4007 FloatComplexMatrix besseli (float alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4008 FloatComplexMatrix besselk (float alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4009 FloatComplexMatrix besselh1 (float alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4010 FloatComplexMatrix besselh2 (float alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4011 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4012 FloatComplexMatrix besselj (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4013 FloatComplexMatrix bessely (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4014 FloatComplexMatrix besseli (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4015 FloatComplexMatrix besselk (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4016 FloatComplexMatrix besselh1 (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4017 FloatComplexMatrix besselh2 (const FloatMatrix& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4018 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4019 FloatComplexMatrix besselj (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4020 FloatComplexMatrix bessely (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4021 FloatComplexMatrix besseli (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4022 FloatComplexMatrix besselk (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4023 FloatComplexMatrix besselh1 (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4024 FloatComplexMatrix besselh2 (const FloatMatrix& alpha, const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4025 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4026 FloatComplexNDArray besselj (float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4027 FloatComplexNDArray bessely (float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4028 FloatComplexNDArray besseli (float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4029 FloatComplexNDArray besselk (float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4030 FloatComplexNDArray besselh1 (float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4031 FloatComplexNDArray besselh2 (float alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4032 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4033 FloatComplexNDArray besselj (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4034 FloatComplexNDArray bessely (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4035 FloatComplexNDArray besseli (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4036 FloatComplexNDArray besselk (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4037 FloatComplexNDArray besselh1 (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4038 FloatComplexNDArray besselh2 (const FloatNDArray& alpha, const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4039 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4040 FloatComplexNDArray besselj (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4041 FloatComplexNDArray bessely (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4042 FloatComplexNDArray besseli (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4043 FloatComplexNDArray besselk (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4044 FloatComplexNDArray besselh1 (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4045 FloatComplexNDArray besselh2 (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4046 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4047 FloatComplexMatrix besselj (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselj (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4048 FloatComplexMatrix bessely (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::bessely (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4049 FloatComplexMatrix besseli (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besseli (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4050 FloatComplexMatrix besselk (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselk (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4051 FloatComplexMatrix besselh1 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh1 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4052 FloatComplexMatrix besselh2 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::besselh2 (alpha, x, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4053 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4054 ComplexMatrix airy (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::airy (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4055 ComplexMatrix biry (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::biry (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4056 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4057 ComplexNDArray airy (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::airy (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4058 ComplexNDArray biry (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::biry (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4059 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4060 FloatComplexMatrix airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::airy (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4061 FloatComplexMatrix biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::biry (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4062 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4063 FloatComplexNDArray airy (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::airy (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4064 FloatComplexNDArray biry (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) { return octave::math::biry (z, deriv, scaled, ierr); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4065 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4066 Array<double> betainc (double x, double a, const Array<double>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4067 Array<double> betainc (double x, const Array<double>& a, double b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4068 Array<double> betainc (double x, const Array<double>& a, const Array<double>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4069 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4070 Array<double> betainc (const Array<double>& x, double a, double b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4071 Array<double> betainc (const Array<double>& x, double a, const Array<double>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4072 Array<double> betainc (const Array<double>& x, const Array<double>& a, double b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4073 Array<double> betainc (const Array<double>& x, const Array<double>& a, const Array<double>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4074 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4075 Array<float> betainc (float x, float a, const Array<float>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4076 Array<float> betainc (float x, const Array<float>& a, float b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4077 Array<float> betainc (float x, const Array<float>& a, const Array<float>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4078 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4079 Array<float> betainc (const Array<float>& x, float a, float b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4080 Array<float> betainc (const Array<float>& x, float a, const Array<float>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4081 Array<float> betainc (const Array<float>& x, const Array<float>& a, float b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4082 Array<float> betainc (const Array<float>& x, const Array<float>& a, const Array<float>& b) { return octave::math::betainc (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4083 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4084 Matrix gammainc (double x, const Matrix& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4085 Matrix gammainc (const Matrix& x, double a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4086 Matrix gammainc (const Matrix& x, const Matrix& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4087 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4088 NDArray gammainc (double x, const NDArray& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4089 NDArray gammainc (const NDArray& x, double a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4090 NDArray gammainc (const NDArray& x, const NDArray& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4091 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4092 FloatMatrix gammainc (float x, const FloatMatrix& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4093 FloatMatrix gammainc (const FloatMatrix& x, float a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4094 FloatMatrix gammainc (const FloatMatrix& x, const FloatMatrix& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4095 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4096 FloatNDArray gammainc (float x, const FloatNDArray& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4097 FloatNDArray gammainc (const FloatNDArray& x, float a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4098 FloatNDArray gammainc (const FloatNDArray& x, const FloatNDArray& a) { return octave::math::gammainc (x, a); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4099 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4100 Array<double> betaincinv (double x, double a, const Array<double>& b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4101 Array<double> betaincinv (double x, const Array<double>& a, double b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4102 Array<double> betaincinv (double x, const Array<double>& a, const Array<double>& b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4103 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4104 Array<double> betaincinv (const Array<double>& x, double a, double b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4105 Array<double> betaincinv (const Array<double>& x, double a, const Array<double>& b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4106 Array<double> betaincinv (const Array<double>& x, const Array<double>& a, double b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4107 Array<double> betaincinv (const Array<double>& x, const Array<double>& a, const Array<double>& b) { return octave::math::betaincinv (x, a, b); } |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4108 |
df064166f180
use namespace for lo-specfun.h functions
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
4109 #endif |