Skip to content

Commit

Permalink
Fixing bug with quotients by trivial ideals.
Browse files Browse the repository at this point in the history
  • Loading branch information
tscrim committed Mar 31, 2024
1 parent 36b29b9 commit d92aa8c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/sage/algebras/lie_algebras/quotient.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def __init__(self, I, L, names, index_set, category=None):
self._ambient = L
self._I = I
self._sm = sm
self._triv_ideal = bool(I.dimension() == 0)

LieAlgebraWithStructureCoefficients.__init__(
self, L.base_ring(), s_coeff, names, index_set, category=category)
Expand Down Expand Up @@ -426,14 +427,23 @@ def from_vector(self, v, order=None, coerce=False):
sage: el.parent() == Q
True
An element from a vector of the ambient module
An element from a vector of the ambient module::
sage: el = Q.from_vector([1, 2, 3]); el
-2*X - Y
sage: el.parent() == Q
True
Check for the trivial ideal::
sage: L.<x,y,z> = LieAlgebra(GF(3), {('x','z'): {'x':1, 'y':1}, ('y','z'): {'y':1}})
sage: I = L.ideal([])
sage: Q = L.quotient(I)
sage: v = Q.an_element().to_vector()
sage: Q.from_vector(v)
x + y + z
"""
if len(v) == self.ambient().dimension():
if not self._triv_ideal and len(v) == self.ambient().dimension():
return self.retract(self.ambient().from_vector(v))

return super().from_vector(v)

0 comments on commit d92aa8c

Please sign in to comment.