Skip to content

Commit

Permalink
sagemathgh-38382: refining the category of all-commuting g-algebras
Browse files Browse the repository at this point in the history
fixing sagemath#38047

### 📝 Checklist

- [x] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

URL: sagemath#38382
Reported by: Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Jul 20, 2024
2 parents 3058939 + 4727407 commit 238f042
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=282c4b485888da0c9e2ce72c1c2b08f2df47480b
sha256=ddb46580851222af6d0f3bc8f997c47792cccb5a875dd22d130bb5b1acb8731e
sha1=7b7c79fc15432a1cc3d08c2f2fc610391970a727
sha256=732dc8f003f58952b811302a48ad743dab86208d236df8843fd6b904c46aa474
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3c279ec5712e0fa35c5733e03e010970727d7189
46d6ebe05583047bc9cc89904af075483e78fdae
5 changes: 3 additions & 2 deletions src/sage/algebras/free_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True):
"""
The `G`-Algebra derived from this algebra by relations.
By default is assumed, that two variables commute.
By default it is assumed that any two variables commute.
.. TODO::
Expand Down Expand Up @@ -958,6 +958,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True):
(-t)*x*y + t*y + (t + 1)
"""
from sage.matrix.constructor import Matrix
commutative = not relations

base_ring = self.base_ring()
polynomial_ring = PolynomialRing(base_ring, self.gens())
Expand Down Expand Up @@ -993,7 +994,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True):
from sage.rings.polynomial.plural import g_Algebra
return g_Algebra(base_ring, cmat, dmat,
names=names or self.variable_names(),
order=order, check=check)
order=order, check=check, commutative=commutative)

def poincare_birkhoff_witt_basis(self):
"""
Expand Down
15 changes: 12 additions & 3 deletions src/sage/rings/polynomial/plural.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class G_AlgFactory(UniqueFactory):
- ``key`` -- a 6-tuple, formed by a base ring, a tuple of names, two
matrices over a polynomial ring over the base ring with the given
variable names, a term order, and a category
- ``extra_args`` -- a dictionary, whose only relevant key is 'check'.
- ``extra_args`` -- a dictionary, whose only relevant key is 'check'
TESTS::
Expand All @@ -174,7 +174,7 @@ class G_AlgFactory(UniqueFactory):
category, check)

def create_key_and_extra_args(self, base_ring, c, d, names=None, order=None,
category=None, check=None):
category=None, check=None, commutative=None):
"""
Create a unique key for g-algebras.
Expand All @@ -186,13 +186,18 @@ class G_AlgFactory(UniqueFactory):
- ``order`` -- (optional) term order
- ``category`` -- (optional) category
- ``check`` -- optional bool
- ``commutative`` -- optional bool
TESTS::
sage: A.<x,y,z> = FreeAlgebra(QQ, 3)
sage: H = A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y})
sage: H is A.g_algebra({y*x:x*y-z, z*x:x*z+2*x, z*y:y*z-2*y}) # indirect doctest
True
sage: P = A.g_algebra(relations={}, order='lex')
sage: P.category()
Category of commutative algebras over Rational Field
"""
if names is None:
raise ValueError("The generator names must be provided")
Expand All @@ -213,7 +218,11 @@ class G_AlgFactory(UniqueFactory):
d.set_immutable()

# Get the correct category
category = check_default_category(Algebras(base_ring), category)
if commutative:
usualcat = Algebras(base_ring).Commutative()
else:
usualcat = Algebras(base_ring)
category = check_default_category(usualcat, category)

# Extra arg
if check is None:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/structure/factory.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ cdef class UniqueFactory(SageObject):
....: return args, {'impl':kwds.get('impl', None)}
....: def create_object(self, version, key, **extra_args):
....: impl = extra_args['impl']
....: if impl=='C':
....: if impl == 'C':
....: return C(*key)
....: if impl=='D':
....: if impl == 'D':
....: return D(*key)
....: return E(*key)
....:
Expand Down

0 comments on commit 238f042

Please sign in to comment.