Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions include/xsf/amos/amos.h
Original file line number Diff line number Diff line change
Expand Up @@ -2666,7 +2666,7 @@ namespace amos {
dfnu = fnu + n - 1;
if ((az <= 2.) || (az * az * 0.25 <= (dfnu + 1.0))) {
/* GOTO 10 */
nw = seri(z, fnu, kode, n, cy, tol, elim, alim);
nw = seri(z, fnu, kode, nn, cy, tol, elim, alim);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inw = std::abs(nw);
nz += inw;
nn -= inw;
Expand All @@ -2689,7 +2689,7 @@ namespace amos {
//
// MILLER ALGORITHM NORMALIZED BY THE SERIES
//
nw = mlri(z, fnu, kode, n, cy, tol);
nw = mlri(z, fnu, kode, nn, cy, tol);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (nw < 0) {
nz = -1;
if (nw == -2) {
Expand All @@ -2706,7 +2706,7 @@ namespace amos {
//
// ASYMPTOTIC EXPANSION FOR LARGE Z
//
nw = asyi(z, fnu, kode, n, cy, rl, tol, elim, alim);
nw = asyi(z, fnu, kode, nn, cy, rl, tol, elim, alim);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (nw < 0) {
nz = -1;
if (nw == -2) {
Expand Down Expand Up @@ -2760,7 +2760,7 @@ namespace amos {
/* 60 */
if (az <= rl) {
/* 70 */
nw = mlri(z, fnu, kode, n, cy, tol);
nw = mlri(z, fnu, kode, nn, cy, tol);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (nw < 0) {
nz = -1;
if (nw == -2) {
Expand Down Expand Up @@ -2788,7 +2788,11 @@ namespace amos {
}
/* 100 */
if (nw > 0) {
return -1;
nz = -1;
if (nw == -2) {
nz = -2;
}
return nz;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if condition in 2792 is unreachable as first we check for nw>0 and then for nw==-2. Was this in the original Fortran source?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, of course you are right, I reverted this change.
Yes, this actually was this way in the Fortran source: https://github.com/scipy/scipy/blob/4edfcaa3ce8a387450b6efce968572def71be089/scipy/special/amos/zbinu.f#L99

}
nw = wrsk(z, fnu, kode, nn, cy, cw, tol, elim, alim);
if (nw < 0) {
Expand Down Expand Up @@ -4296,7 +4300,7 @@ namespace amos {
}

if (p1 == 0.) {
p1 = std::complex<double>(0, 0);
p1 = std::complex<double>(tol, tol);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

cy[n - 1] = p2 / p1;
Expand All @@ -4309,7 +4313,7 @@ namespace amos {
cdfnu = fnu * rz;

for (i = 2; i < (n + 1); i++) {
pt = cdfnu + t1 * rz * cy[k];
pt = cdfnu + t1 * rz + cy[k];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (pt == 0.0) {
pt = std::complex<double>(tol, tol);
}
Expand Down
Loading