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

Commit

Permalink
Trac 12630: Remove mutating _iadd_ from QuiverRepElement
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-king-jena committed Feb 21, 2014
1 parent c5dd56a commit 48a8fed
Showing 1 changed file with 3 additions and 47 deletions.
50 changes: 3 additions & 47 deletions src/sage/quivers/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from sage.modules.module import Module
from sage.modules.module_element import ModuleElement
from sage.misc.cachefunc import cached_method
from sage.misc.fast_methods import WithEqualityById

class QuiverRepFactory(UniqueFactory):
"""
Expand Down Expand Up @@ -500,30 +501,6 @@ def _add_(left, right):

return left.parent()(elements)

def _iadd_(self, right):
"""
This overrides the += operator.
TESTS::
sage: Q = DiGraph({1:{2:['a'], 3:['b']}, 2:{3:['c']}}).path_semigroup()
sage: spaces = dict((v, GF(3)^2) for v in Q.quiver())
sage: M = Q.representation(GF(3), spaces)
sage: elems = {1: (1, 0), 2: (0, 1), 3: (2, 1)}
sage: v = M(elems)
sage: w = M(elems)
sage: v += w # indirect doctest
sage: v == w
False
sage: v.is_zero()
False
"""

for v in self._quiver:
self._elems[v] += right._elems[v]

return self

def _sub_(left, right):
"""
This overrides the - operator.
Expand All @@ -545,27 +522,6 @@ def _sub_(left, right):

return left.parent()(elements)

def _isub_(self, right):
"""
This overrides the -= operator.
TESTS::
sage: Q = DiGraph({1:{2:['a'], 3:['b']}, 2:{3:['c']}}).path_semigroup()
sage: spaces = dict((v, GF(3)^2) for v in Q.quiver())
sage: M = Q.representation(GF(3), spaces)
sage: elems = {1: (1, 0), 2: (0, 1), 3: (2, 1)}
sage: v = M(elems)
sage: v -= v # indirect doctest
sage: v.is_zero()
True
"""

for v in self._quiver:
self._elems[v] -= right._elems[v]

return self

def _neg_(self):
"""
This overrides the unary - operator.
Expand Down Expand Up @@ -754,7 +710,7 @@ def get_element(self, vertex):
OUTPUT:
- vector, the vaector assigned to the given vertex
- vector, the vector assigned to the given vertex
EXAMPLES::
Expand Down Expand Up @@ -914,7 +870,7 @@ def copy(self):
####################################################################
# The representations

class QuiverRep_generic(Module):
class QuiverRep_generic(WithEqualityById, Module):
"""
This function should not be called by the user.
Expand Down

0 comments on commit 48a8fed

Please sign in to comment.