33"""
44from __future__ import absolute_import
55
6- #* ****************************************************************************
6+ # ****************************************************************************
77# Copyright (C) 2012 Jim Stark <[email protected] > 88# 2013 Simon King <[email protected] > 99# 2014 Simon King <[email protected] > 1717# See the GNU General Public License for more details; the full text
1818# is available at:
1919#
20- # http ://www.gnu.org/licenses/
21- #* ****************************************************************************
20+ # https ://www.gnu.org/licenses/
21+ # ****************************************************************************
2222
2323import six
2424from sage .misc .cachefunc import cached_method
2525from sage .combinat .free_module import CombinatorialFreeModule
2626from .algebra_elements import PathAlgebraElement
2727
28+
2829class PathAlgebra (CombinatorialFreeModule ):
2930 r"""
3031 Create the path algebra of a :class:`quiver <DiGraph>` over a given field.
@@ -50,9 +51,9 @@ class PathAlgebra(CombinatorialFreeModule):
5051
5152 - the path algebra `kP` with the given monomial order
5253
53- NOTE:
54+ .. NOTE: :
5455
55- Monomial orders that are not degree orders are not supported.
56+ Monomial orders that are not degree orders are not supported.
5657
5758 EXAMPLES::
5859
@@ -133,10 +134,11 @@ class PathAlgebra(CombinatorialFreeModule):
133134 # #
134135 ###########################################################################
135136
136- def __init__ (self , k , P , order = "negdegrevlex" ):
137+ def __init__ (self , k , P , order = "negdegrevlex" ):
137138 """
138- Creates a :class:`PathAlgebra` object. Type ``PathAlgebra?`` for
139- more information.
139+ Create a :class:`PathAlgebra` object.
140+
141+ Type ``PathAlgebra?`` for more information.
140142
141143 INPUT:
142144
@@ -166,10 +168,10 @@ def __init__(self, k, P, order = "negdegrevlex"):
166168 self ._semigroup = P
167169 self ._ordstr = order
168170 super (PathAlgebra , self ).__init__ (k , self ._semigroup ,
169- prefix = '' ,
170- # element_class=self.Element,
171- category = GradedAlgebrasWithBasis (k ),
172- bracket = False )
171+ prefix = '' ,
172+ # element_class=self.Element,
173+ category = GradedAlgebrasWithBasis (k ),
174+ bracket = False )
173175 self ._assign_names (self ._semigroup .variable_names ())
174176
175177 def order_string (self ):
@@ -223,8 +225,8 @@ def arrows(self):
223225 sage: A.arrows()
224226 (a, b, c)
225227 """
226- return tuple (self ._from_dict ( {index : self .base_ring ().one ()},
227- remove_zeros = False )
228+ return tuple (self ._from_dict ({index : self .base_ring ().one ()},
229+ remove_zeros = False )
228230 for index in self ._semigroup .arrows ())
229231
230232 @cached_method
@@ -240,8 +242,8 @@ def idempotents(self):
240242 sage: A.idempotents()
241243 (e_1, e_2, e_3, e_4)
242244 """
243- return tuple (self ._from_dict ( {index : self .base_ring ().one ()},
244- remove_zeros = False )
245+ return tuple (self ._from_dict ({index : self .base_ring ().one ()},
246+ remove_zeros = False )
245247 for index in self ._semigroup .idempotents ())
246248
247249 @cached_method
@@ -264,8 +266,8 @@ def gen(self, i):
264266 sage: A.gen(5)
265267 b
266268 """
267- return self ._from_dict ( {self ._semigroup .gen (i ): self .base_ring ().one ()},
268- remove_zeros = False )
269+ return self ._from_dict ({self ._semigroup .gen (i ): self .base_ring ().one ()},
270+ remove_zeros = False )
269271
270272 def ngens (self ):
271273 """
@@ -445,7 +447,7 @@ def _repr_monomial(self, data):
445447 # gives the component in the module, and mid gives the length of the
446448 # left factor in a two-sided module.
447449 arrows = self .variable_names ()
448- return '*' .join ( [ arrows [n ] for n in data ] )
450+ return '*' .join (arrows [n ] for n in data )
449451
450452 def _latex_monomial (self , data ):
451453 """
@@ -465,7 +467,7 @@ def _latex_monomial(self, data):
465467
466468 """
467469 arrows = self .variable_names ()
468- return '\\ cdot ' .join ( [ arrows [n ] for n in data ] )
470+ return '\\ cdot ' .join (arrows [n ] for n in data )
469471
470472 @cached_method
471473 def one (self ):
@@ -482,8 +484,8 @@ def one(self):
482484 e_1 + e_2 + e_3
483485 """
484486 one = self .base_ring ().one ()
485- D = dict (( index , one ) for index in self ._semigroup .idempotents ())
486- return self ._from_dict ( D )
487+ D = { index : one for index in self ._semigroup .idempotents ()}
488+ return self ._from_dict (D )
487489
488490 ###########################################################################
489491 # #
@@ -563,19 +565,19 @@ def degree_on_basis(self, x):
563565
564566 def sum (self , iter_of_elements ):
565567 """
566- Returns the sum of all elements in ``iter_of_elements``
568+ Return the sum of all elements in ``iter_of_elements``
567569
568570 INPUT:
569571
570572 - ``iter_of_elements``: iterator of elements of ``self``
571573
572- NOTE:
574+ .. NOTE: :
573575
574- It overrides a method inherited from
575- :class:`~sage.combinat.free_module.CombinatorialFreeModule`, which
576- relies on a private attribute of elements---an implementation
577- detail that is simply not available for
578- :class:`~sage.quivers.algebra_elements.PathAlgebraElement`.
576+ It overrides a method inherited from
577+ :class:`~sage.combinat.free_module.CombinatorialFreeModule`,
578+ which relies on a private attribute of elements---an
579+ implementation detail that is simply not available for
580+ :class:`~sage.quivers.algebra_elements.PathAlgebraElement`.
579581
580582 EXAMPLES::
581583
0 commit comments