geometric_algebra: deprecate [DFM] conventions, add corrected operations - #255
Draft
inducer wants to merge 2 commits into
Draft
geometric_algebra: deprecate [DFM] conventions, add corrected operations#255inducer wants to merge 2 commits into
inducer wants to merge 2 commits into
Conversation
inducer
marked this pull request as draft
September 3, 2026 18:39
inducerforce-pushed
the
lengyel-ga-fixes
branch
3 times, most recently
from
September 4, 2026 21:48
568ae28 to
bd58246CompareThe [DFM] (Dorst, Fontijne, Mann) conventions implemented in this module rest on foundations that have been shown to be flawed; see in particular Eric Lengyel's "Poor Foundations in Geometric Algebra": https://terathon.com/blog/poor-foundations-ga.html Add the corrected operations (orthogonal metrics only, consistent with the rest of the module): - MultiVector.inner: the (metric) inner product A.B = <A B~>_0, the unique extension of the metric's bilinear form to the exterior algebra. Scalar, zero for blades of different grade. norm_squared() now uses this (identical values). - MultiVector.left_contraction: A|B = <B A~>_(grB-grA) - MultiVector.right_contraction: B||A = <A~ B>_(grB-grA) - MultiVector.hodge_dual: A* = A~ I, satisfying the defining property of the Hodge star, A^B* = (A.B) I, for equal-grade blades (the [DFM] dualization mapping A I^-1 does not satisfy it). Deprecate, do not remove, the [DFM]-convention operators and methods (__or__/__ror__, __lshift__/__rlshift__, __rshift__/__rrshift__, scalar_product(), dual()). Each carries a .. deprecated:: note plus a @typing_extensions.deprecated decorator, which emits the same DeprecationWarning at the call site and sets __deprecated__ for static analysis. [DFM] behavior is unchanged. Also rename the dead-code __inv__ to __invert__ so that `~mv` actually dispatches. This breaks direct calls to mv.__inv__(); accepted, since __inv__ was never a real dunder. Decisions and trade-offs: - The corrected contractions are implemented via the article's explicit grade-extraction identities rather than its Hodge-dual definitions (A|B = A_* v B, A||B = A v B*, where v is the "antiwedge"). The article never defines the antiwedge; per Lengyel's RGA wiki it is Grassmann's regressive product (adds antigrades, hence grade p+q-n, defined via the complements), and under that reading the Hodge-dual definitions are self-consistent with the grade-extraction identities. The identities are self-contained, so we use them directly. - The new operations raise NotImplementedError for non-orthogonal (i.e., non-diagonal) metrics, matching the module's existing treatment of such spaces. - Existing tests keep exercising the deprecated [DFM] conventions (with a DeprecationWarning filter); a new test verifies the corrected operations against geometric-product-only references and exact old/new sign relations in dims 2-4 with random +/-1 diagonal metrics.
inducerforce-pushed
the
lengyel-ga-fixes
branch
from
September 4, 2026 22:02
bd58246 to
3b849b2Compare
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 freeto 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.
The operators in this module follow the conventions of Dorst/Fontijne/Mann (GA4CS), which have been shown to rest on shaky foundations; see Eric Lengyel's Poor Foundations in Geometric Algebra. Incorporate the corrections from that article. All existing behavior is preserved and deprecated, not removed.
New operations (validated against independent geometric-product references in the new test):
Deprecated (DeprecationWarning + doc notes):
Other changes:
norm_squared computes A.inner(A) directly (identical values, no longer routed through the deprecated scalar product).
The module docstring gains a "Conventions and known issues" section (ga-conventions) and a doctest contrasting the new and deprecated operations; the operator table and method docstrings point at the replacements.
The pre-existing GA test keeps exercising the [DFM] conventions (with a targeted filterwarnings); a new test covers the corrected conventions and their exact relationship to the deprecated operators.
Decisions and trade-offs:
fix the vector decomposition, are implemented instead.
Assisted-by: Zed:Qwen3.8-27B-FP8