fix(lt): reject zero-vector output in Lt callable constructor#579
Closed
utiberious wants to merge 1 commit intopygae:masterfrom
Closed
fix(lt): reject zero-vector output in Lt callable constructor#579utiberious wants to merge 1 commit intopygae:masterfrom
utiberious wants to merge 1 commit intopygae:masterfrom
Conversation
Upstream Macdonald code requires F(basis) to return a non-zero vector. The is_zero() exemption added in pygae#510 allows degenerate/singular maps through silently; restoring the stricter check makes the error explicit.
utensil
reviewed
Apr 2, 2026
Member
utensil
left a comment
There was a problem hiding this comment.
The is_zero() exemption wasn't from #510 — it was added in #560 to fix #540. Projection maps like lambda x: (x | e1) * e1 legitimately return zero for perpendicular basis vectors, and the zero map is a valid linear map too. The existing test_lt_callable_zero regression test covers exactly this.
This change would revert a deliberate fix.
Contributor
Author
|
Closing — the change is incorrect. The |
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.
Discovered during code audit in #575.
Change
Removes the
and not out.is_zero()exemption added in #510, restoring the upstream Macdonald behavior whereF(basis_vector)must return a proper vector.Before (galgebra):
After (matches upstream zip):
Rationale
A linear transform that maps any basis vector to zero is singular. Accepting it silently allows constructing an
Ltthat will produce incorrect results (e.g. wrong determinant, inverse undefined). Making the error explicit at construction time is safer.