Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
16659: renamed, moved some methods to better places
Browse files Browse the repository at this point in the history
  • Loading branch information
avirmaux committed Sep 1, 2014
1 parent c6eebd2 commit 7cbeb9a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 42 deletions.
25 changes: 0 additions & 25 deletions src/sage/categories/algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,6 @@ def _div_(self, y):

class Quotients(QuotientsCategory):

class ElementMethods:

def _lift_idempotent(self):
r"""
Lift an idempotent of parent of ``self`` into an indempotent of
parent of ``self.lift()``
EXAMPLES::
sage: A = FiniteDimensionalAlgebrasWithBasis(QQ).example().semisimple_quotient()
sage: orth = A.orthogonal_idempotents()
sage: orth[1]._lift_idempotent()
x
TODO: better documentation.
"""
idempOld = None
idemp = self.lift()
p = idemp.parent()
while idemp <> idempOld:
tmp = idemp
idemp = (p.one() - (p.one() - idemp**2)**2)
idempOld = tmp
return idemp

class ParentMethods:

def algebra_generators(self):
Expand Down
69 changes: 59 additions & 10 deletions src/sage/categories/finite_dimensional_algebras_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def radical_basis(self, cache_products=True):
from sage.modules.free_module_element import vector

if self in SemisimpleAlgebras(self.base_ring()):
return self.from_vector(vector(self.zero()))
return []

if cache_products is True:
product_on_basis = cached_function(self.product_on_basis)
Expand Down Expand Up @@ -353,14 +353,14 @@ def center(self):
center.rename("Center of {}".format(self))
return center

def ideal(self, a, side='left'):
def principal_ideal(self, a, side='left'):
r"""
Construct the ``left`` or ``right`` A-module generated by ``a``.
Construct the ``side`` A-module generated by ``a``.
EXAMPLE::
sage: A = FiniteDimensionalAlgebrasWithBasis(QQ).example()
sage: A.ideal(A.an_element())
sage: A.principal_ideal(A.an_element())
Free module generated by {0, 1, 2, 3} over Rational Field
"""
Expand Down Expand Up @@ -395,12 +395,50 @@ def orthogonal_idempotents(self):
An example of a finite dimensional algebra with basis: the path
algebra of the Kronecker quiver (containing the arrows a:x->y
and b:x->y) over Rational Field
sage: A.orthogonal_idempotents()
[y, x]
sage: sorted(A.orthogonal_idempotents(), key=str)
[x, y]
sage: Monoids().Finite().example()
An example of a finite multiplicative monoid: the integers
modulo 12
sage: Z12 = Monoids().Finite().example()
sage: A = Z12.algebra(QQ)
sage: sorted(A.orthogonal_idempotents(), key=str)
[-1/2*B[3] + 1/2*B[9], -1/2*B[8] + 1/2*B[4], -B[0] + 1/2*B[3] +
1/2*B[9], 1/2*B[8] + 1/2*B[4] - B[0], 1/4*B[1] + 1/2*B[3] +
1/4*B[5] - 1/4*B[7] - 1/2*B[9] - 1/4*B[11], 1/4*B[1] + 1/4*B[11]
- 1/4*B[5] - 1/4*B[7], 1/4*B[1] - 1/2*B[4] - 1/4*B[5] + 1/4*B[7]
+ 1/2*B[8] - 1/4*B[11], B[0], B[0] + 1/4*B[1] - 1/2*B[3] -
1/2*B[4] + 1/4*B[5] + 1/4*B[7] - 1/2*B[8] - 1/2*B[9] +
1/4*B[11]]
"""
Aquo = self.semisimple_quotient()
orth_quo = Aquo.orthogonal_idempotents()
return [x._lift_idempotent() for x in orth_quo]
return [self._lift_idempotent(x) for x in orth_quo]

def _lift_idempotent(self, x):
r"""
Lift an idempotent of the semisimple quotient of ``self`` into an
idempotent of ``self``.
EXAMPLES::
sage: A = FiniteDimensionalAlgebrasWithBasis(QQ).example()
sage: Aquo = A.semisimple_quotient()
sage: orth = Aquo.orthogonal_idempotents()
sage: A._lift_idempotent(orth[1])
y
"""
idempOld = None
assert x in self.semisimple_quotient()
idemp = x.lift()
p = idemp.parent()
while idemp <> idempOld:
tmp = idemp
idemp = (p.one() - (p.one() - idemp**2)**2)
idempOld = tmp
return idemp

@cached_method
def cartan_invariant_matrix(self, side='left'):
Expand All @@ -418,12 +456,23 @@ def cartan_invariant_matrix(self, side='left'):
[1 0 0]
[0 1 0]
[0 0 1]
sage: Z12 = Monoids().Finite().example()
sage: A = Z12.algebra(QQ)
sage: A.cartan_invariant_matrix()
[1 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0]
[0 0 2 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0]
[0 0 0 0 0 2 0 0 0]
[0 0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 0 2]
"""
Aquo = self.semisimple_quotient()
orth_quo = Aquo.orthogonal_idempotents()
# Dimension of simple modules
dimSimples = [sqrt(Aquo.ideal(e, side).dimension()) for e in
dimSimples = [sqrt(Aquo.principal_ideal(e, side).dimension()) for e in
orth_quo]
orth = [x._lift_idempotent() for x in orth_quo]
return Matrix(self.base_ring(),
Expand All @@ -450,7 +499,7 @@ def projective_decomposition(self, side='left'):
True
"""
return [self.ideal(e, side) for e in self.orthogonal_idempotents()]
return [self.principal_ideal(e, side) for e in self.orthogonal_idempotents()]


def _cartan_matrix_coef(self, ei, ej):
Expand Down
14 changes: 7 additions & 7 deletions src/sage/categories/semisimple_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,16 @@ def orthogonal_idempotents(self):
sage: sorted(orth, key=str)
[B['x'], B['y']]
"""
Z = self.center()
orth = Z.orthogonal_idempotents()
return [x.lift() for x in orth]
return [x.lift()
for x in self.center().orthogonal_idempotents()]


class Commutative(CategoryWithAxiom_over_base_ring):

class ParentMethods:

@cached_method
def _semi_simple_commutative_decomposition_generators(self, listGen=None, topLevel=True):
def _orthogonal_decomposition(self, listGen=None, topLevel=True):
r"""
Decompose a commutative finite dimensional semi-simple
algebra ``A`` into a direct sum of simple A-modules.
Expand All @@ -126,7 +125,7 @@ def _semi_simple_commutative_decomposition_generators(self, listGen=None, topLev
sage: G5 = SymmetricGroup(5)
sage: A5 = G5.algebra(QQ)
sage: Z5 = A5.center()
sage: gens = Z5._semi_simple_commutative_decomposition_generators()
sage: gens = Z5._orthogonal_decomposition()
sage: sorted(gens, key=str)
[B[0] + 1/2*B[1] + 1/4*B[3] - 1/4*B[4] - 1/4*B[6],
B[0] + 1/5*B[1] + 1/5*B[2] - 1/5*B[3] + 1/5*B[4] -
Expand Down Expand Up @@ -172,7 +171,7 @@ def _semi_simple_commutative_decomposition_generators(self, listGen=None, topLev

#Recursive on decomp
res = [x for space in decomp for x in
space._semi_simple_commutative_decomposition_generators(topLevel=False)]
space._orthogonal_decomposition(topLevel=False)]
if topLevel:
return res
else:
Expand Down Expand Up @@ -213,4 +212,5 @@ def orthogonal_idempotents(self, dimSimple=False):
sage: orth[1] ** 2 == orth[1]
True
"""
return [(e.leading_coefficient()/(e*e).leading_coefficient())*e for e in self._semi_simple_commutative_decomposition_generators()]
return [(e.leading_coefficient()/(e*e).leading_coefficient())*e for
e in self._orthogonal_decomposition()]

0 comments on commit 7cbeb9a

Please sign in to comment.