You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
are counterproductive when the following checks are made here
try:
returnpenta_solver1(mat_flat, rhs)
exceptZeroDivisionError:
warnings.warn("pentapy: PTRANS-I not suitable for input-matrix.")
returnnp.full_like(rhs, np.nan)
because cdivision=True explicitly prevents the compiled C-code from ever raising a ZeroDivisionError.
This branch of the code was always dead. This is also indicated by the coverage which shows that these lines was never hit.
Actually, the code produced nan-values naturally because a single nan will propagate to contaminate the full solution, but the error handling was never triggered.
For the warning to be issued, cdivision=False is required here.
Even though the Cython file will be relatively yellow, there is no need to hesitate when setting cdivision=False. Cython does a very good job when it comes to handling the more elaborate division because it helps the branch predictor by making the zero-case the unlikely case. With this, the performance impact is negligible:
The Cython compiler options in this line
# cython: language_level=3, boundscheck=True, wraparound=False, cdivision=True
are counterproductive when the following checks are made here
because
cdivision=True
explicitly prevents the compiled C-code from ever raising aZeroDivisionError
.This branch of the code was always dead. This is also indicated by the coverage which shows that these lines was never hit.
Actually, the code produced
nan
-values naturally because a singlenan
will propagate to contaminate the full solution, but the error handling was never triggered.For the warning to be issued,
cdivision=False
is required here.Even though the Cython file will be relatively yellow, there is no need to hesitate when setting
cdivision=False
. Cython does a very good job when it comes to handling the more elaborate division because it helps the branch predictor by making the zero-case the unlikely case. With this, the performance impact is negligible:I will fix this in the same go as #11
The text was updated successfully, but these errors were encountered: