From 4bccd0d34babdac0113ce9ace7a058733551389a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 4 Mar 2026 09:09:10 -0500 Subject: [PATCH] mjo/clan: fix propagation of scalar fields Non-default fields were getting lost in __init__. Now there are tests. --- mjo/clan/jordan_spin_clan.py | 8 +++++++- mjo/clan/t_algebra_clan.py | 28 ++++++++++++++++++++++++++-- mjo/clan/trivial_clan.py | 10 +++++++++- mjo/clan/vinberg_clan.py | 10 +++++++++- 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/mjo/clan/jordan_spin_clan.py b/mjo/clan/jordan_spin_clan.py index 54fc623..ee0991c 100644 --- a/mjo/clan/jordan_spin_clan.py +++ b/mjo/clan/jordan_spin_clan.py @@ -90,6 +90,12 @@ class JordanSpinClan(NormalDecomposition): ....: if i not in [j,k] ) True + At least on a superficial level, it is possible to use non-default + fields:: + + sage: JordanSpinClan(3, scalar_field=AA) + Jordan spin clan of dimension 3 over Algebraic Real Field + """ from sage.rings.rational_field import QQ def __init__(self, n, scalar_field=QQ, **kwargs): @@ -146,7 +152,7 @@ class JordanSpinClan(NormalDecomposition): p = cp(x,y) / two return sum( p[idx] for idx in indices if idx[0] == idx[1] ) - super().__init__(RN, cp, ip, **kwargs) + super().__init__(RN, cp, ip, scalar_field=scalar_field, **kwargs) def __repr__(self) -> str: diff --git a/mjo/clan/t_algebra_clan.py b/mjo/clan/t_algebra_clan.py index 24c9d25..e688c12 100644 --- a/mjo/clan/t_algebra_clan.py +++ b/mjo/clan/t_algebra_clan.py @@ -233,6 +233,14 @@ class RealSymmetricClan(TAlgebraClan): [2 3 0] [0 0 0] + TESTS: + + At least on a superficial level, it is possible to use non-default + fields:: + + sage: RealSymmetricClan(2, scalar_field=AA) + Clan S^2 over Algebraic Real Field + """ from sage.rings.rational_field import QQ def __init__(self, n, scalar_field=QQ, **kwargs): @@ -255,7 +263,11 @@ class RealSymmetricClan(TAlgebraClan): support_order=b.keys(), ambient=Mn) - super().__init__(Sn, TAlgebraClan._cp, TAlgebraClan._ip, **kwargs) + super().__init__(Sn, + TAlgebraClan._cp, + TAlgebraClan._ip, + scalar_field=scalar_field, + **kwargs) def __repr__(self) -> str: @@ -343,6 +355,14 @@ class ComplexHermitianClan(TAlgebraClan): │ 0 │ 0 │ 0 │ └─────────┴──────────┴───┘ + TESTS: + + At least on a superficial level, it is possible to use non-default + fields:: + + sage: ComplexHermitianClan(2, scalar_field=AA) + Clan H^2 over Algebraic Real Field + """ from sage.rings.rational_field import QQ def __init__(self, n, scalar_field=QQ, **kwargs): @@ -367,7 +387,11 @@ class ComplexHermitianClan(TAlgebraClan): support_order=b.keys(), ambient=Mn) - super().__init__(Hn, TAlgebraClan._cp, TAlgebraClan._ip, **kwargs) + super().__init__(Hn, + TAlgebraClan._cp, + TAlgebraClan._ip, + scalar_field=scalar_field, + **kwargs) def __repr__(self) -> str: diff --git a/mjo/clan/trivial_clan.py b/mjo/clan/trivial_clan.py index 41b5e32..4c849f8 100644 --- a/mjo/clan/trivial_clan.py +++ b/mjo/clan/trivial_clan.py @@ -56,6 +56,14 @@ class TrivialClan(NormalDecomposition): ....: if i not in [j,k] ) True + TESTS: + + At least on a superficial level, it is possible to use non-default + fields:: + + sage: TrivialClan(scalar_field=AA) + Trivial clan over Algebraic Real Field + """ from sage.rings.rational_field import QQ def __init__(self, scalar_field=QQ, **kwargs): @@ -68,7 +76,7 @@ class TrivialClan(NormalDecomposition): def ip(x,y): return scalar_field.zero() - super().__init__(R0, cp, ip, **kwargs) + super().__init__(R0, cp, ip, scalar_field=scalar_field, **kwargs) def __repr__(self) -> str: diff --git a/mjo/clan/vinberg_clan.py b/mjo/clan/vinberg_clan.py index 0650535..86ab8a8 100644 --- a/mjo/clan/vinberg_clan.py +++ b/mjo/clan/vinberg_clan.py @@ -124,6 +124,14 @@ class VinbergClan(NormalDecomposition): sage: actual == expected True + TESTS: + + At least on a superficial level, it is possible to use non-default + fields:: + + sage: VinbergClan(scalar_field=AA) + Vinberg clan over Algebraic Real Field + """ def _unlift(self, pair): A,B = pair @@ -211,7 +219,7 @@ class VinbergClan(NormalDecomposition): for idx in p.monomial_coefficients() if idx[0] == idx[1] ) - super().__init__(R5, cp, ip, **kwargs) + super().__init__(R5, cp, ip, scalar_field=scalar_field, **kwargs) def __repr__(self) -> str: r""" -- 2.51.0