-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
BUG:special:amos: Fix some mistakes in the AMOS C translation #19934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There appears to be another problem in the Fortran code scipy/scipy/special/amos/zkscl.f Lines 109 to 121 in e5f2129
Regardless of whether the if condition C translation Lines 4052 to 4059 in 44b39e1
if (ic == n) {
nz = n-1;
-} else {
- nz = kk - 2;
} Notice that Lines 4035 to 4041 in 44b39e1
scipy/scipy/special/amos/zkscl.f Lines 98 to 100 in e5f2129
|
Yes it seems like the else branch is not needed. The main issue, probably it seems, is that, I associated the |
Ah how nice that you added the call graph. @lucascolley if the failing backend test is not relevant let's get this one in when CI is green please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching these @inkydragon. The alternative backend test is definitely not relevant. I'll merge when rest of the CI settles.
thanks for the ping, that is probably due to the update of |
thanks for your first contribution to SciPy @inkydragon ! |
Reference issue
What does this implement/fix?
amos_kscl
function in C translation of amos code.See description below.
else
branch inamos_kscl
.See my first comment for detailed description.
C translation:
scipy/scipy/special/_amos.c
Lines 4007 to 4011 in 44b39e1
ref: amos fortran code:
scipy/scipy/special/amos/zkscl.f
Lines 52 to 56 in e5f2129
Additional information
Since this function is not exported, it is difficult to construct a test case to cover this bug.
Some shorter call paths from exported functions to
amos_kscl
.full call graph
It's a bit difficult to test this bug in python, but you can test it in C.
Add the following C code to _amos.c, compile it, and run it.
Then check the printout of the program.
C test code add to _amos.c
run with
gcc -g -o amos _amos.c -lm && ./amos
C test code outout
master output (Without pr)
nz = 1
with pr
nz = 0
, andy[]
outout also changed.