fix: elliptic_func returns NaN when input has 1 element (affects F17, F29 at 10D)#46
Open
Ahmedman60 wants to merge 1 commit intothieu1995:masterfrom
Open
fix: elliptic_func returns NaN when input has 1 element (affects F17, F29 at 10D)#46Ahmedman60 wants to merge 1 commit intothieu1995:masterfrom
Ahmedman60 wants to merge 1 commit intothieu1995:masterfrom
Conversation
…ng F17 and F29 10D) When ndim=1, the expression 6.0 * idx / (ndim - 1) causes division by zero returning NaN. This affects F172017 and F292017 at 10D, both listed in dim_supported. Fix: guard for 1-element case, returns x[0]**2 directly. Verified at 10D and 30D.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #
📋 Description
elliptic_funcinopfunu/utils/operator.pycomputes6.0 * idx / (ndim - 1),which causes division by zero when the input array has 1 element (ndim - 1 = 0),
returning NaN.
This affects:
F172017at 10D —p[0] = 0.1givesceil(0.1 × 10) = 1element passed toelliptic_funcF292017at 10D — embedsF172017as a sub-component, NaN propagates upBoth functions list 10D in
dim_supported, making this a supported-but-broken case.✅ Checks
💻 Additional Information
Fix: added a guard for the 1-element case, returning
x[0] ** 2directly(equivalent to the function with exponent scale = 10^0 = 1).
Verified: NaN → valid float at 10D for both F17 and F29.
30D results unchanged. Tested via monkey-patch before modifying source.