# Commits

committed 7bc3bc6

updated for sage-5.11.beta1 unofficial

# 14675_convert_relations.patch

-# HG changeset patch
-# User Miguel Marco <mmarco@unizar.es>
-# Date 1370123892 -7200
-# Node ID 7c96167d6f4c42f067dd7e5aa8b645b0750df8a9
-# Parent  9b3e6b467313a8df84543e4cbc882580a9fc0678
-Trac Ticket #14675, convert relations to the free group at quotienting
-
-diff --git a/sage/groups/free_group.py b/sage/groups/free_group.py
---- a/sage/groups/free_group.py
-+++ b/sage/groups/free_group.py
-@@ -617,8 +617,20 @@
-
-             sage: F /  [a*b^2*a, b^3]
-             Finitely presented group < a, b | a*b^2*a, b^3 >
-+
-+        Relations are converted to the free group, even if they are not
-+        elements of it (if possible) ::
-+
-+            sage: F1.<a,b,c,d>=FreeGroup()
-+            sage: F2.<a,b>=FreeGroup()
-+            sage: r=a*b/a
-+            sage: r.parent()
-+            Free Group on generators {a, b}
-+            sage: F1/[r]
-+            Finitely presented group < a, b, c, d | a*b*a^-1 >
-+
-         """
-         from sage.groups.finitely_presented import FinitelyPresentedGroup
--        return FinitelyPresentedGroup(self, tuple(relations))
-+        return FinitelyPresentedGroup(self, tuple(map(self, relations) ) )
-
-     __div__ = quotient

# series

-trac_14232_ppl_doctest_fixes.patch
-trac_14266_ascii_art_13_05_15_EliX-jbp.patch
-trac_14266-ascii_art-review-ts.patch
-trac_14266_terminal_width.patch
-trac_14471_dynamic_class_hash.patch
 trac_14469_repr_graphics.patch
 trac_13084_ppl_lattice_polygon.patch
 trac_13084_toric_weierstrass.patch
 trac_13084_weierstrass_cleanup-fc.patch
 trac_13084_misc.patch
 trac_13458_toric_Weierstrass_covering.patch
-trac_6100-basis_homology-ts.patch
 trac_14523_improve_attach.patch
 trac_14523_readline.patch
-trac_14640_refactor_plot_expose.patch
-trac_14640-refactor_plot_expose-review-ts.patch
-trac_14014_libgap_cyclotomic_matrix.patch
-trac_14014_deletions.patch
-trac_14014_parents_for_matrix_groups.patch
-trac_14014_parents_group_dependents.patch
-trac_14014_iterator.patch
-trac_14014_misc.patch
-trac_14014-review-ts.patch
-14675_convert_relations.patch
-trac_14674_cleanup_decorator_fc.patch
-trac_14664-type1-fonts.patch
 trac_14682_doctest_fixes.patch
-trac_14015-affine_groups-ts.patch
-trac_14669.patch
 trac_12559_tour_chinese.patch
 trac_14703_infinite_fp_group_check.patch
-trac_14668_bitsets.patch
 trac_13736-content-take2.patch
 trac_13736-unit_primpart.patch
-trac14524-immutability_decorators.patch
 trac14535-immutable_graphs_vb.patch
 trac_14652_lazify_imports.patch
 trac_14634_fix_includes.patch
 trac_3416_elliptic_curve_from_cubic_vb.patch
 trac_3416_jacobians.patch
 trac_3416_fixes.patch
-trac_interrupt_groebner_basis.patch
 ppl_reflexive_polytope.patch
 debug_memory_leak.patch
 trac_12892_orbit_closure_morphism.patch

# trac14524-immutability_decorators.patch

-# HG changeset patch
-# User Simon King <simon.king@uni-jena.de>
-# Date 1367824644 -7200
-# Node ID c2c82f01b133adc84830765b2bb7499223c95b30
-# Parent  1ddd56f1ce4b9722752064741003a9a540d74abc
-#14524: Decorator for methods requiring mutability or immutability
-
-diff --git a/sage/misc/decorators.py b/sage/misc/decorators.py
---- a/sage/misc/decorators.py
-+++ b/sage/misc/decorators.py
-@@ -92,7 +92,7 @@
-           '        return ret\n'], ...)
-
-     Demonstrate that sage_wraps works for non-function callables
--    (Trac 9919)::
-+    (:trac:9919)::
-
-         sage: def square_for_met(f):
-         ...     @sage_wraps(f)
-@@ -110,7 +110,7 @@
-         sage: t.g.__doc__
-         'My little method'
-
--    The bug described in #11734 is fixed::
-+    The bug described in :trac:11734 is fixed::
-
-         sage: def square(f):
-         ...     @sage_wraps(f)
-@@ -121,6 +121,7 @@
-         sage: g = square(f)
-         sage: g(3) # this line used to fail for some people if these command were manually entered on the sage prompt
-         81
-+
-     """
-     #TRAC 9919: Workaround for bug in @update_wrapper when used with
-     #non-function callables.
-diff --git a/sage/structure/mutability.pxd b/sage/structure/mutability.pxd
---- a/sage/structure/mutability.pxd
-+++ b/sage/structure/mutability.pxd
-@@ -13,5 +13,5 @@
- ##########################################################################
-
- cdef class Mutability:
--    cdef bint _is_immutable
-+    cdef public bint _is_immutable
-     cdef _require_mutable_cdef(self)
-diff --git a/sage/structure/mutability.pyx b/sage/structure/mutability.pyx
---- a/sage/structure/mutability.pyx
-+++ b/sage/structure/mutability.pyx
-@@ -71,3 +71,98 @@
-     def __reduce__(self):
-         return Mutability, (self._is_immutable, )
-
-+#################################################################################
-+## Method decorators for mutating methods resp. methods that assume immutability
-+from sage.misc.decorators import sage_wraps
-+
-+def require_mutable(f):
-+    """
-+    A decorator that requires mutability for a method to be called.
-+
-+    EXAMPLES::
-+
-+        sage: from sage.structure.mutability import require_mutable, require_immutable
-+        sage: class A:
-+        ...    def __init__(self, val):
-+        ...        self._m = val
-+        ...    @require_mutable
-+        ...    def change(self, new_val):
-+        ...        'change self'
-+        ...        self._m = new_val
-+        ...    @require_immutable
-+        ...    def __hash__(self):
-+        ...        'implement hash'
-+        ...        return hash(self._m)
-+        sage: a = A(5)
-+        sage: a.change(6)
-+        sage: hash(a)
-+        Traceback (most recent call last):
-+        ...
-+        ValueError: <type 'instance'> instance is mutable, <function __hash__ at ...> must not be called
-+        sage: a._is_immutable = True
-+        sage: hash(a)
-+        6
-+        sage: a.change(7)   # indirect doctest
-+        Traceback (most recent call last):
-+        ...
-+        ValueError: <type 'instance'> instance is immutable, <function change at ...> must not be called
-+        sage: from sage.misc.sageinspect import sage_getdoc
-+        sage: print sage_getdoc(a.change)
-+        change self
-+
-+    AUTHORS:
-+
-+    - Simon King <simon.king@uni-jena.de>
-+    """
-+    @sage_wraps(f)
-+    def new_f(self, *args,**kwds):
-+        if getattr(self,'_is_immutable',False):
-+            raise ValueError("%s instance is immutable, %s must not be called"%(type(self), repr(f)))
-+        return f(self, *args,**kwds)
-+    return new_f
-+
-+def require_immutable(f):
-+    """
-+    A decorator that requires mutability for a method to be called.
-+
-+    EXAMPLES::
-+
-+        sage: from sage.structure.mutability import require_mutable, require_immutable
-+        sage: class A:
-+        ...    def __init__(self, val):
-+        ...        self._m = val
-+        ...    @require_mutable
-+        ...    def change(self, new_val):
-+        ...        'change self'
-+        ...        self._m = new_val
-+        ...    @require_immutable
-+        ...    def __hash__(self):
-+        ...        'implement hash'
-+        ...        return hash(self._m)
-+        sage: a = A(5)
-+        sage: a.change(6)
-+        sage: hash(a)   # indirect doctest
-+        Traceback (most recent call last):
-+        ...
-+        ValueError: <type 'instance'> instance is mutable, <function __hash__ at ...> must not be called
-+        sage: a._is_immutable = True
-+        sage: hash(a)
-+        6
-+        sage: a.change(7)
-+        Traceback (most recent call last):
-+        ...
-+        ValueError: <type 'instance'> instance is immutable, <function change at ...> must not be called
-+        sage: from sage.misc.sageinspect import sage_getdoc
-+        sage: print sage_getdoc(a.__hash__)
-+        implement hash
-+
-+    AUTHORS:
-+
-+    - Simon King <simon.king@uni-jena.de>
-+    """
-+    @sage_wraps(f)
-+    def new_f(self, *args,**kwds):
-+        if not getattr(self,'_is_immutable',False):
-+            raise ValueError("%s instance is mutable, %s must not be called"%(type(self), repr(f)))
-+        return f(self, *args,**kwds)
-+    return new_f

# trac_14014-review-ts.patch

-# HG changeset patch
-# User Travis Scrimshaw <tscrim@ucdavis.edur>
-# Date 1369724781 25200
-# Node ID d880fbc5e859e60c412ec620d6c7aab2a9b0eeff
-# Parent bf0bfbb3058dd2fb82dcc4c8d514443751ab87e7
-#14014: review patch.
-
-diff --git a/sage/groups/class_function.py b/sage/groups/class_function.py
---- a/sage/groups/class_function.py
-+++ b/sage/groups/class_function.py
-@@ -97,9 +97,9 @@ class ClassFunction_gap(SageObject):
-     """
-     def __init__(self, G, values):
-         r"""
--        Returns the character of the group G with values given by the list
-+        Return the character of the group G with values given by the list
-         values. The order of the values must correspond to the output of
--        G.conjugacy_classes_representatives().
-+        G.conjugacy_classes_representatives().
-
-         EXAMPLES::
-
-@@ -789,9 +789,9 @@ class ClassFunction_libgap(SageObject):
-
-     def __init__(self, G, values):
-         r"""
--        Returns the character of the group G with values given by the list
-+        Return the character of the group G with values given by the list
-         values. The order of the values must correspond to the output of
--        G.conjugacy_classes_representatives().
-+        G.conjugacy_classes_representatives().
-
-         EXAMPLES::
-
-@@ -917,7 +917,7 @@ class ClassFunction_libgap(SageObject):
-
-     def domain(self):
-         r"""
--        Returns the domain of the self.
-+        Return the domain of self.
-
-         OUTPUT:
-
-@@ -933,8 +933,8 @@ class ClassFunction_libgap(SageObject):
-
-     def __call__(self, g):
-         """
--        Evaluate the character on the group element g. Returns an error if
--        g is not in G.
-+        Evaluate the character on the group element g. Returns an error if
-+        g is not in G.
-         
-         EXAMPLES::
- 
-@@ -965,7 +965,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def __add__(self, other):
-         r"""
--        Returns the sum of the characters self and other.
-+        Return the sum of the characters self and other.
- 
-         INPUT:
-         
-@@ -993,7 +993,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def __sub__(self, other):
-         r"""
--        Returns the difference of the characters self and other.
-+        Return the difference of the characters self and other.
- 
-         INPUT:
-         
-@@ -1133,7 +1133,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def __pow__(self, other):
-         r"""
--        Returns the product of self with itself other times.
-+        Return the product of self with itself other times.
- 
-         EXAMPLES::
- 
-@@ -1151,11 +1151,11 @@ class ClassFunction_libgap(SageObject):
- 
-     def symmetric_power(self, n):
-         r"""
--        Returns the symmetrized product of self with itself n times.
-+        Return the symmetrized product of self with itself n times.
- 
-         INPUT:
- 
--        - n -- a positive integer.
-+        - n -- a positive integer
- 
-         OUTPUT:
- 
-@@ -1178,11 +1178,11 @@ class ClassFunction_libgap(SageObject):
- 
-     def exterior_power(self, n):
-         r"""
--        Returns the anti-symmetrized product of self with itself n times.
-+        Return the anti-symmetrized product of self with itself n times.
- 
-         INPUT:
- 
--        - n -- a positive integer.
-+        - n -- a positive integer
- 
-         OUTPUT:
- 
-@@ -1207,7 +1207,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def scalar_product(self, other):
-         r"""
--        Returns the scalar product of self with other.
-+        Return the scalar product of self with other.
- 
-         EXAMPLES::
- 
-@@ -1225,8 +1225,8 @@ class ClassFunction_libgap(SageObject):
- 
-     def is_irreducible(self):
-         r"""
--        Returns True if self cannot be written as the sum of two nonzero
--        characters of self.
-+        Return True if self cannot be written as the sum of two nonzero
-+        characters of self.
- 
-         EXAMPLES::
- 
-@@ -1240,7 +1240,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def degree(self):
-         r"""
--        Returns the degree of the character self.
-+        Return the degree of the character self.
- 
-         EXAMPLES::
- 
-@@ -1254,8 +1254,8 @@ class ClassFunction_libgap(SageObject):
- 
-     def irreducible_constituents(self):
-         r"""
--        Returns a list of the characters that appear in the decomposition
--        of chi.
-+        Return a list of the characters that appear in the decomposition
-+        of self.
- 
-         EXAMPLES::
- 
-@@ -1290,8 +1290,8 @@ class ClassFunction_libgap(SageObject):
- 
-     def decompose(self):
-         r"""
--        Returns a list of the characters that appear in the decomposition
--        of chi.
-+        Return a list of the characters that appear in the decomposition
-+        of self.
- 
-         EXAMPLES::
- 
-@@ -1309,7 +1309,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def norm(self):
-         r"""
--        Returns the norm of self.
-+        Return the norm of self.
- 
-         EXAMPLES::
- 
-@@ -1351,7 +1351,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def central_character(self):
-         r"""
--        Returns the central character of self.
-+        Return the central character of self.
- 
-         EXAMPLES::
- 
-@@ -1364,7 +1364,7 @@ class ClassFunction_libgap(SageObject):
- 
-     def determinant_character(self):
-         r"""
--        Returns the determinant character of self.
-+        Return the determinant character of self.
- 
-         EXAMPLES::
- 
-@@ -1377,6 +1377,8 @@ class ClassFunction_libgap(SageObject):
- 
-     def tensor_product(self, other):
-         r"""
-+        Return the tensor product of self and other.
-+
-         EXAMPLES::
- 
-             sage: S3 = SymmetricGroup(3)
-@@ -1453,7 +1455,4 @@ class ClassFunction_libgap(SageObject):
-             gapG = libgap(G)
-         ind = self._gap_classfunction.InducedClassFunction(gapG)
-         return ClassFunction(G, ind)
--    
--    
- 
--
-diff --git a/sage/groups/libgap_wrapper.pyx b/sage/groups/libgap_wrapper.pyx
---- a/sage/groups/libgap_wrapper.pyx
-+++ b/sage/groups/libgap_wrapper.pyx
-@@ -471,7 +471,7 @@ cdef class ElementLibGAP(MultiplicativeG
- 
-         Boolean.
- 
--        EXAMPLES:
-+        EXAMPLES::
- 
-             sage: G.<a,b> = FreeGroup('a, b')
-             sage: x = G([1, 2, -1, -2])
-diff --git a/sage/groups/matrix_gps/finitely_generated.py b/sage/groups/matrix_gps/finitely_generated.py
---- a/sage/groups/matrix_gps/finitely_generated.py
-+++ b/sage/groups/matrix_gps/finitely_generated.py
-@@ -146,7 +146,7 @@ def MatrixGroup(*gens, **kwds):
-     - *gens -- matrices, or a single list/tuple/iterable of
-       matrices, or a matrix group.
-     
--    - check=True -- boolean keyword argument (optional, default:
-+    - check -- boolean keyword argument (optional, default:
-       True). Whether to check that each matrix is invertible.
- 
-     EXAMPLES::
-@@ -245,7 +245,7 @@ class FinitelyGeneratedMatrixGroup_gener
- 
-     def __init__(self, degree, base_ring, generator_matrices):
-         """
--        Matrix group generated by a finite number of matrices
-+        Matrix group generated by a finite number of matrices.
- 
-         EXAMPLES::
- 
-@@ -383,7 +383,7 @@ class FinitelyGeneratedMatrixGroup_gener
- 
- class FinitelyGeneratedMatrixGroup_gap(MatrixGroup_gap):
-     """
--    Matrix group generated by a finite number of matrices
-+    Matrix group generated by a finite number of matrices.
-     
-     EXAMPLES::
-     
-@@ -542,10 +542,10 @@ class FinitelyGeneratedMatrixGroup_gap(M
- 
-     def module_composition_factors(self, algorithm=None):
-         r"""
--        Returns a list of triples consisting of [base field, dimension,
-+        Return a list of triples consisting of [base field, dimension,
-         irreducibility], for each of the Meataxe composition factors
--        modules. The algorithm="verbose" option returns more information, but
--        in Meataxe notation.
-+        modules. The algorithm="verbose" option returns more information,
-+        but in Meataxe notation.
-         
-         EXAMPLES::
-         
-@@ -563,7 +563,7 @@ class FinitelyGeneratedMatrixGroup_gap(M
-             sage: G.module_composition_factors()
-             [(Finite Field of size 7, 2, True)]
-         
--        Type "G.module_composition_factors(algorithm='verbose')" to get a
-+        Type G.module_composition_factors(algorithm='verbose') to get a
-         more verbose version.
-         
-         For more on MeatAxe notation, see
-@@ -602,20 +602,20 @@ class FinitelyGeneratedMatrixGroup_gap(M
-         Return invariant ring generators.
- 
-         Computes generators for the polynomial ring
--        F[x_1,\ldots,x_n]^G, where G in GL(n,F) is a finite matrix
-+        F[x_1,\ldots,x_n]^G, where G in GL(n,F) is a finite matrix
-         group.
-         
-         In the "good characteristic" case the polynomials returned
--        form a minimal generating set for the algebra of G-invariant
-+        form a minimal generating set for the algebra of G-invariant
-         polynomials.  In the "bad" case, the polynomials returned
-         are primary and secondary invariants, forming a not
-         necessarily minimal generating set for the algebra of
--        G-invariant polynomials.
-+        G-invariant polynomials.
-         
-         ALGORITHM:
- 
--        Wraps Singular's invariant_algebra_reynolds and invariant_ring
--        in finvar.lib.
-+        Wraps Singular's invariant_algebra_reynolds and invariant_ring
-+        in finvar.lib.
-     
-         EXAMPLES::
-             
-@@ -662,7 +662,7 @@ class FinitelyGeneratedMatrixGroup_gap(M
-           1993.
-     
-         - S. King, "Minimal Generating Sets of non-modular invariant
--          rings of finite groups", arXiv:math.AC/0703035 
-+          rings of finite groups", :arXiv:math/0703035.
-         """
-         from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
-         from sage.interfaces.singular import singular
-diff --git a/sage/groups/matrix_gps/matrix_group.py b/sage/groups/matrix_gps/matrix_group.py
---- a/sage/groups/matrix_gps/matrix_group.py
-+++ b/sage/groups/matrix_gps/matrix_group.py
-@@ -12,7 +12,7 @@ Loading, saving, ... works::
-     [4 0]
-     sage: TestSuite(g).run()
- 
--We test that #9437 is fixed::
-+We test that :trac:9437 is fixed::
- 
-     sage: len(list(SL(2, Zmod(4))))
-     48
-@@ -70,6 +70,7 @@ from sage.groups.matrix_gps.group_elemen
- def is_MatrixGroup(x):
-     """
-     Test whether x is a matrix group.
-+
-     EXAMPLES::
-     
-         sage: from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
-@@ -93,7 +94,7 @@ def is_MatrixGroup(x):
- 
- class MatrixGroup_base(Group):
-     """
--    Base class for all matrix groups
-+    Base class for all matrix groups.
-     
-     This base class just holds the base ring, but not the degree. So
-     it can be a base for affine groups where the natural matrix is
-@@ -287,7 +288,7 @@ class MatrixGroup_generic(MatrixGroup_ba
-         INPUT:
-         
-         - degree -- integer. The degree (matrix size) of the
--           matrix group.
-+          matrix group.
-         
-         - base_ring -- ring. The base ring of the matrices.
- 
-@@ -513,7 +514,7 @@ class MatrixGroup_gap(GroupMixinLibGAP, 
-         INPUT:
-         
-         - degree -- integer. The degree (matrix size) of the
--           matrix group.
-+          matrix group.
-         
-         - base_ring -- ring. The base ring of the matrices.
- 
-diff --git a/sage/groups/matrix_gps/pickling_overrides.py b/sage/groups/matrix_gps/pickling_overrides.py
---- a/sage/groups/matrix_gps/pickling_overrides.py
-+++ b/sage/groups/matrix_gps/pickling_overrides.py
-@@ -14,7 +14,7 @@ class LegacyMatrixGroup(FinitelyGenerate
-     
-     def __setstate__(self, state):
-         """
--        Restore from old pickle
-+        Restore from old pickle.
-         
-         EXAMPLES::
-         
-@@ -48,7 +48,7 @@ class LegacyMatrixGroupElement(MatrixGro
-     
-     def __setstate__(self, state):
-         """
--        Restore from old pickle
-+        Restore from old pickle.
-         
-         EXAMPLES::
-         
-@@ -86,7 +86,7 @@ class LegacyGeneralLinearGroup(LinearMat
- 
-     def __setstate__(self, state):
-         """
--        Restore from old pickle
-+        Restore from old pickle.
-         
-         EXAMPLES::
-         
-diff --git a/sage/libs/gap/element.pyx b/sage/libs/gap/element.pyx
---- a/sage/libs/gap/element.pyx
-+++ b/sage/libs/gap/element.pyx
-@@ -534,8 +534,6 @@ cdef class GapElement(RingElement):
- 
-         EXAMPLES::
- 
--        EXAMPLES::
--
-             sage: a = libgap(123)
-             sage: a == a
-             True
-@@ -544,7 +542,7 @@ cdef class GapElement(RingElement):
- 
-     def __hash__(self):
-         """
--        Make hashable
-+        Make hashable.
-         
-         EXAMPLES::
- 
-@@ -1301,7 +1299,7 @@ cdef class GapElement_IntegerMod(GapElem
- 
- cdef GapElement_FiniteField make_GapElement_FiniteField(parent, libGAP_Obj obj):
-     r"""
--    Turn a Gap finite field object into a :class:GapElement_FiniteField Sage object
-+    Turn a GAP finite field object into a :class:GapElement_FiniteField Sage object
- 
-     EXAMPLES::
- 
-@@ -1358,7 +1356,7 @@ cdef class GapElement_FiniteField(GapEle
- 
-     def sage(self, ring=None, var='a'):
-         r"""
--        Return the Sage equivalent of the :class:GapElement_FiniteField
-+        Return the Sage equivalent of the :class:GapElement_FiniteField.
- 
-         INPUT:
- 
-@@ -1410,7 +1408,8 @@ cdef class GapElement_FiniteField(GapEle
- 
- cdef GapElement_Cyclotomic make_GapElement_Cyclotomic(parent, libGAP_Obj obj):
-     r"""
--    Turn a Gap cyclotomic object into a :class:GapElement_Cyclotomic Sage object
-+    Turn a Gap cyclotomic object into a :class:GapElement_Cyclotomic Sage
-+    object.
- 
-     EXAMPLES::
- 
-@@ -1438,7 +1437,7 @@ cdef class GapElement_Cyclotomic(GapElem
- 
-     def sage(self, ring=None):
-         r"""
--        Return the Sage equivalent of the :class:GapElement_Cyclotomic
-+        Return the Sage equivalent of the :class:GapElement_Cyclotomic.
- 
-         INPUT:
- 
-@@ -1509,7 +1508,7 @@ cdef class GapElement_Rational(GapElemen
-     
-     def sage(self, ring=None):
-         r"""
--        Return the Sage equivalent of the :class:GapElement
-+        Return the Sage equivalent of the :class:GapElement.
- 
-         INPUT:
-         
-@@ -1544,7 +1543,7 @@ cdef class GapElement_Rational(GapElemen
- cdef GapElement_Ring make_GapElement_Ring(parent, libGAP_Obj obj):
-     r"""
-     Turn a Gap integer object into a :class:GapElement_Ring Sage
--    object
-+    object.
- 
-     EXAMPLES::
- 
-@@ -1636,7 +1635,7 @@ cdef class GapElement_Ring(GapElement):
- 
-     def sage(self, **kwds):
-         r"""
--        Return the Sage equivalent of the :class:GapElement_Ring
-+        Return the Sage equivalent of the :class:GapElement_Ring.
- 
-         INPUT:
-         
-diff --git a/sage/libs/gap/libgap.pyx b/sage/libs/gap/libgap.pyx
---- a/sage/libs/gap/libgap.pyx
-+++ b/sage/libs/gap/libgap.pyx
-@@ -304,11 +304,11 @@ class Gap(Parent):
- 
-     def _coerce_map_from_(self, S):
-         """
--        Whether a coercion from S exists
-+        Whether a coercion from S exists.
- 
-         INPUT / OUTPUT:
- 
--        See :mod:sage.structure.parent
-+        See :mod:sage.structure.parent.
- 
-         EXAMPLES::
- 
-@@ -323,7 +323,7 @@ class Gap(Parent):
- 
-     def _element_constructor_(self, x):
-         r"""
--        Construct elements of this parent class
-+        Construct elements of this parent class.
- 
-         INPUT:
- 
-@@ -396,7 +396,7 @@ class Gap(Parent):
- 
-     def eval(self, gap_command):
-         """
--        Evaluate a gap command and wrap the result
-+        Evaluate a gap command and wrap the result.
- 
-         INPUT:
-         
-@@ -421,7 +421,7 @@ class Gap(Parent):
- 
-     def _an_element_(self):
-         r"""
--        Return a :class:GapElement
-+        Return a :class:GapElement.
-         
-         OUTPUT:
- 
-@@ -437,7 +437,7 @@ class Gap(Parent):
- 
-     def zero_element(self):
-         """
--        Return (integer) zero in GAP
-+        Return (integer) zero in GAP.
-         
-         OUTPUT:
- 
-diff --git a/sage/rings/number_field/number_field.py b/sage/rings/number_field/number_field.py
---- a/sage/rings/number_field/number_field.py
-+++ b/sage/rings/number_field/number_field.py
-@@ -7777,7 +7777,7 @@ class NumberField_cyclotomic(NumberField
- 
-     def _libgap_(self):
-         """
--        Return a LibGAP representation of self
-+        Return a LibGAP representation of self.
- 
-         TESTS:
- 
-diff --git a/sage/rings/number_field/number_field_element.pyx b/sage/rings/number_field/number_field_element.pyx
---- a/sage/rings/number_field/number_field_element.pyx
-+++ b/sage/rings/number_field/number_field_element.pyx
-@@ -554,7 +554,7 @@ cdef class NumberFieldElement(FieldEleme
- 
-     def _libgap_(self):
-         """
--        Return a LibGAP representation of self.
-+        Return a LibGAP representation of self.
-         
-         EXAMPLES::
-         

# trac_14014_deletions.patch

-# HG changeset patch
-# Parent f683248fbbb54bbcb9a3262e13d282edc41f0dde
-
-Deletions for files that are renamed
-
-diff --git a/sage/groups/matrix_gps/general_linear.py b/sage/groups/matrix_gps/general_linear.py
-deleted file mode 100644
---- a/sage/groups/matrix_gps/general_linear.py
-+++ /dev/null
-@@ -1,239 +0,0 @@
--r"""
--General Linear Groups
--
--EXAMPLES::
--
--    sage: GL(4,QQ)
--    General Linear Group of degree 4 over Rational Field
--    sage: GL(1,ZZ)
--    General Linear Group of degree 1 over Integer Ring
--    sage: GL(100,RR)
--    General Linear Group of degree 100 over Real Field with 53 bits of precision
--    sage: GL(3,GF(49,'a'))
--    General Linear Group of degree 3 over Finite Field in a of size 7^2
--
--AUTHORS:
--
--- David Joyner (2006-01)
--
--- William Stein (2006-01)
--
--- David Joyner (2006-05): added _latex_, __str__, examples
--
--- William Stein (2006-12-09): rewrite
--"""
--
--##TODO: Rework this and \code{special_linear} into MatrixGroup class for any
--##field, wrapping all of GAP's matrix group commands in chapter 41
--##Matrix Groups of the GAP reference manual.
--
--
--#*****************************************************************************
--#       Copyright (C) 2005 William Stein <wstein@gmail.com>
--#
--#  Distributed under the terms of the GNU General Public License (GPL)
--#
--#    This code is distributed in the hope that it will be useful,
--#    but WITHOUT ANY WARRANTY; without even the implied warranty of
--#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--#    General Public License for more details.
--#
--#  The full text of the GPL is available at:
--#
--#                  http://www.gnu.org/licenses/
--#*****************************************************************************
--
--from sage.structure.unique_representation import UniqueRepresentation
--from sage.rings.all import is_FiniteField, Integer, FiniteField
--from matrix_group import MatrixGroup_gap, MatrixGroup_gap_finite_field
--
--def GL(n, R, var='a'):
--    """
--    Return the general linear group of degree n over the ring
--    R.
--
--    .. note::
--        This group is also available via groups.matrix.GL().
--
--    EXAMPLES::
--
--        sage: G = GL(6,GF(5))
--        sage: G.order()
--        11064475422000000000000000
--        sage: G.base_ring()
--        Finite Field of size 5
--        sage: G.category()
--        Category of finite groups
--        sage: TestSuite(G).run()
--
--        sage: G = GL(6, QQ)
--        sage: G.category()
--        Category of groups
--        sage: TestSuite(G).run()
--
--    Here is the Cayley graph of (relatively small) finite General Linear Group::
--
--        sage: g = GL(2,3)
--        sage: d = g.cayley_graph(); d
--        Digraph on 48 vertices
--        sage: d.show(color_by_label=True, vertex_size=0.03, vertex_labels=False)
--        sage: d.show3d(color_by_label=True)
--
--    ::
--
--        sage: F = GF(3); MS = MatrixSpace(F,2,2)
--        sage: gens = [MS([[0,1],[1,0]]),MS([[1,1],[0,1]])]
--        sage: G = MatrixGroup(gens)
--        sage: G.order()
--        48
--        sage: G.cardinality()
--        48
--        sage: H = GL(2,F)
--        sage: H.order()
--        48
--        sage: H == G           # Do we really want this equality?
--        False
--        sage: H.as_matrix_group() == G
--        True
--        sage: H.gens()
--        [
--        [2 0]
--        [0 1],
--        [2 1]
--        [2 0]
--        ]
--
--    TESTS::
--
--        sage: groups.matrix.GL(2, 3)
--        General Linear Group of degree 2 over Finite Field of size 3
--    """
--    if isinstance(R, (int, long, Integer)):
--        R = FiniteField(R, var)
--    if is_FiniteField(R):
--        return GeneralLinearGroup_finite_field(n, R)
--    return GeneralLinearGroup_generic(n, R)
--
--class GeneralLinearGroup_generic(UniqueRepresentation, MatrixGroup_gap):
--    """
--    TESTS::
--
--        sage: G6 = GL(6, QQ)
--        sage: G6 == G6
--        True
--        sage: G6 != G6  # check that #8695 is fixed.
--        False
--    """
--    def _gap_init_(self):
--        """
--        EXAMPLES::
--        
--            sage: G = GL(6,GF(5))
--            sage: G._gap_init_()
--            'GL(6, GF(5))'
--        """
--        return "GL(%s, %s)"%(self.degree(), self.base_ring()._gap_init_())
--
--    def _latex_(self):
--        """
--        EXAMPLES::
--        
--            sage: G = GL(6,GF(5))
--            sage: latex(G)
--            \text{GL}_{6}(\Bold{F}_{5})
--        """
--        return "\\text{GL}_{%s}(%s)"%(self.degree(), self.base_ring()._latex_())
--    
--    def _repr_(self):
--        """
--        String representation of this linear group.
--        
--        EXAMPLES::
--        
--            sage: GL(6,GF(5))
--            General Linear Group of degree 6 over Finite Field of size 5
--        """
--        return "General Linear Group of degree %s over %s"%(self.degree(), self.base_ring())
--
--    def __call__(self, x):
--        """
--        Construct a new element in this group, i.e. try to coerce x into
--        self if at all possible.
--        
--        EXAMPLES: This indicates that the issue from trac #1834 is
--        resolved::
--        
--            sage: G = GL(3, ZZ)
--            sage: x = [[1,0,1], [0,1,0], [0,0,1]]
--            sage: G(x)
--            [1 0 1]
--            [0 1 0]
--            [0 0 1]
--        """
--        if isinstance(x, self.element_class) and x.parent() is self:
--            return x
--        try:
--            m = self.matrix_space()(x)
--        except TypeError:
--            raise TypeError, "Cannot coerce %s to a %s-by-%s matrix over %s"%(x,self.degree(),self.degree(),self.base_ring())
--        if m.is_invertible():
--            return self.element_class(m, self)
--        else:
--            raise TypeError, "%s is not an invertible matrix"%(x)
--        
--    def __contains__(self, x):
--        """
--        Return True if x is an element of self, False otherwise.
--        
--        EXAMPLES::
--        
--            sage: G = GL(2, GF(101))
--            sage: x = [[0,1], [1,0]]
--            sage: x in G
--            True
--        
--        ::
--        
--            sage: G = GL(3, ZZ)
--            sage: x = [[1,0,1], [0,2,0], [0,0,1]]
--            sage: x in G
--            False
--        """
--        try:
--            x = self(x)
--        except TypeError:
--            return False
--        return True
--
--class GeneralLinearGroup_finite_field(GeneralLinearGroup_generic, MatrixGroup_gap_finite_field):
--
--    def random_element(self):
--        """
--        Return a random element of this group.
--        
--        EXAMPLES::
--        
--            sage: G = GL(4, GF(3))
--            sage: G.random_element()  # random
--            [2 1 1 1]
--            [1 0 2 1]
--            [0 1 1 0]
--            [1 0 0 1]
--            sage: G.random_element() in G
--            True
--
--        ALGORITHM:
--
--        The random matrix is generated by rejection sampling: 
--        1. Generate a random matrix
--        2. Check if is is invertible, if so return it
--        3. Go back to step 1
--
--        The expected number of iterations of this procedure is of
--        order 1 + 1/q where q is the size of the field. In all
--        cases, the expected number of iterations is less than 4.
--        """
--        M = self.matrix_space().random_element()
--        while not M.is_invertible():
--            M.randomize()
--        return self(M)
-diff --git a/sage/groups/matrix_gps/matrix_group_element.py b/sage/groups/matrix_gps/matrix_group_element.py
-deleted file mode 100644
---- a/sage/groups/matrix_gps/matrix_group_element.py
-+++ /dev/null
-@@ -1,478 +0,0 @@
--"""
--Matrix Group Elements
--
--AUTHORS:
--
--- David Joyner (2006-05): initial version David Joyner
--
--- David Joyner (2006-05): various modifications to address William
--  Stein's TODO's.
--
--- William Stein (2006-12-09): many revisions.
--
--EXAMPLES::
--
--    sage: F = GF(3); MS = MatrixSpace(F,2,2)
--    sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--    sage: G = MatrixGroup(gens); G
--    Matrix group over Finite Field of size 3 with 2 generators: 
--     [[[1, 0], [0, 1]], [[1, 1], [0, 1]]]    
--    sage: g = G([[1,1],[0,1]])
--    sage: h = G([[1,2],[0,1]])
--    sage: g*h
--    [1 0]
--    [0 1]    
--
--You cannot add two matrices, since this is not a group operation.
--You can coerce matrices back to the matrix space and add them
--there::
--
--    sage: g + h
--    Traceback (most recent call last):
--    ...
--    TypeError: unsupported operand type(s) for +: 'MatrixGroup_gens_finite_field_with_category.element_class' and 'MatrixGroup_gens_finite_field_with_category.element_class'
--
--::
--
--    sage: g.matrix() + h.matrix()
--    [2 0]
--    [0 2]
--
--::
--
--    sage: 2*g
--    Traceback (most recent call last):
--    ...
--    TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and 'Matrix group over Finite Field of size 3 with 2 generators: 
--     [[[1, 0], [0, 1]], [[1, 1], [0, 1]]]'
--    sage: 2*g.matrix()
--    [2 2]
--    [0 2]
--"""
--
--#*****************************************************************************
--#       Copyright (C) 2006 David Joyner and William Stein <wstein@gmail.com>
--#
--#  Distributed under the terms of the GNU General Public License (GPL)
--#
--#                  http://www.gnu.org/licenses/
--#*****************************************************************************
--
--from sage.rings.all import Integer, Infinity
--from sage.interfaces.gap import gap
--import sage.structure.element as element
--from sage.matrix.matrix import Matrix
--from sage.structure.factorization import Factorization
--from sage.structure.sage_object import have_same_parent
--
--def is_MatrixGroupElement(x):
--    return isinstance(x, MatrixGroupElement)
--
--class MatrixGroupElement(element.MultiplicativeGroupElement):
--    """
--    An element of a matrix group.
--    
--    EXAMPLES::
--    
--        sage: F = GF(3); MS = MatrixSpace(F,2,2)
--               sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--        sage: G = MatrixGroup(gens)
--        sage: g = G.random_element()
--        sage: type(g)
--        <class 'sage.groups.matrix_gps.matrix_group_element.MatrixGroup_gens_finite_field_with_category.element_class'>
--    """
--    def __init__(self, g, parent, check = True):
--        r"""
--        Create element of a matrix group.
--        
--        INPUT:
--        
--        
--        -  g - a Matrix
--        
--        -  parent - defines parent group (g must be in
--           parent or a TypeError is raised).
--        
--        -  check - bool (default: True), if true does some
--           type checking.
--        
--        
--        TESTS::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2,2)
--            sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G.random_element()
--            sage: TestSuite(g).run()
--        """
--        if check:
--            if not isinstance(g, Matrix):
--                raise TypeError, "g must be a matrix"
--            if not (g.parent() is parent):
--                g = parent.matrix_space()(g)
--        element.Element.__init__(self, parent)
--        self.__mat = g
--
--    def matrix(self):
--        """
--        Obtain the usual matrix (as an element of a matrix space)
--        associated to this matrix group element.
--        
--        One reason to compute the associated matrix is that matrices
--        support a huge range of functionality.
--        
--        EXAMPLES::
--        
--            sage: k = GF(7); G = MatrixGroup([matrix(k,2,[1,1,0,1]), matrix(k,2,[1,0,0,2])])
--            sage: g = G.0
--            sage: g.matrix()
--            [1 1]
--            [0 1]
--            sage: parent(g.matrix())
--            Full MatrixSpace of 2 by 2 dense matrices over Finite Field of size 7
--        
--        Matrices have extra functionality that matrix group elements do not
--        have.
--        
--        ::
--        
--            sage: g.matrix().charpoly('t')
--            t^2 + 5*t + 1
--        """
--        return self.__mat.__copy__()
--
--    def _gap_init_(self):
--        """
--        Return a string representation of a Gap object corresponding to
--        this matrix group element.
--        
--        EXAMPLES::
--        
--            sage: k = GF(7); G = MatrixGroup([matrix(k,2,[1,1,0,1]), matrix(k,2,[1,0,0,2])]); g = G.1
--            sage: g._gap_init_() # The variable $sage27 belongs to gap(k) and is somehow random -- '[[Z(7)^0,0*Z(7)],[0*Z(7),Z(7)^2]]*One($sage27)'
--            sage: gap(g._gap_init_())
--            [ [ Z(7)^0, 0*Z(7) ], [ 0*Z(7), Z(7)^2 ] ]
--        
--        It may be better to use gap(the matrix), since the result is
--        cached.
--        
--        ::
--        
--            sage: gap(G.1)
--            [ [ Z(7)^0, 0*Z(7) ], [ 0*Z(7), Z(7)^2 ] ]
--            sage: gap(G.1).IsMatrix()
--            true
--        """
--        return self.__mat._gap_init_()
--
--    def _gap_latex_(self):
--        r"""
--        Return the GAP latex version of this matrix.
--        
--        AUTHORS:
--
--        - S. Kohl: Wrote the GAP function.
--        
--        EXAMPLES::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2,2)
--            sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G([[1, 1], [0, 1]])
--            sage: print g._gap_latex_()
--            \left(\begin{array}{rr}%
--            Z(3)^{0}&Z(3)^{0}\\%
--            0*Z(3)&Z(3)^{0}\\%
--            \end{array}\right)%
--        
--        Type view(g._latex_()) to see the object in an xdvi window
--        (assuming you have latex and xdvi installed).
--        """
--        s1 = self.__mat._gap_init_()
--        s2 = gap.eval("LaTeX("+s1+")")
--        return eval(s2)
--
--    def _repr_(self):
--        """
--        Return string representation of this matrix.
--        
--        EXAMPLES::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2,2)
--            sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G([[1, 1], [0, 1]])
--            sage: g                        # indirect doctest
--            [1 1]
--            [0 1]
--        """
--        return str(self.__mat)
--    
--    def _latex_(self):
--        r"""
--        EXAMPLES::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2,2)
--            sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G([[1, 1], [0, 1]])
--            sage: print g._latex_()
--            \left(\begin{array}{rr}
--            1 & 1 \\
--            0 & 1
--            \end{array}\right)
--        
--        Type view(g._latex_()) to see the object in an
--        xdvi window (assuming you have latex and xdvi installed).
--        """
--        return self.__mat._latex_()
--
--    def _mul_(self,other):
--        """
--        Return the product of self and other, which must have identical
--        parents.
--        
--        EXAMPLES::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2)
--            sage: gens = [MS([1,0, 0,1]), MS([1,1, 0,1])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G([1,1, 0,1])
--            sage: h = G([1,1, 0,1])
--            sage: g*h         # indirect doctest
--            [1 2]
--            [0 1]
--        """
--        parent = self.parent()
--        return parent.element_class(self.__mat * other.__mat, parent, check=False)
--    
--    def _act_on_(self, x, self_on_left):
--        """
--        EXAMPLES::
--        
--            sage: G = GL(4,7)
--            sage: G.0 * vector([1,2,3,4])
--            (3, 2, 3, 4)
--            sage: v = vector(GF(7), [3,2,1,-1])
--            sage: g = G.1
--            sage: v * g == v * g.matrix()   # indirect doctest
--            True
--        """
--        if not is_MatrixGroupElement(x) and x not in self.parent().base_ring():
--            try:
--                if self_on_left:
--                    return self.matrix() * x
--                else:
--                    return x * self.matrix()
--            except TypeError:
--                return None
--
--    def __invert__(self):
--        parent = self.parent()
--        return parent.element_class(~self.__mat, parent, check=False)
--
--    def __cmp__(self, other):
--        """
--        EXAMPLES::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2)
--            sage: gens = [MS([1,0, 0,1]), MS([1,1, 0,1])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G([1,1, 0,1])
--            sage: h = G([1,1, 0,1])
--            sage: g == h
--            True
--        """
--        return cmp(self.__mat, other.__mat)
--
--    def __eq__(self, other):
--        """
--        EXAMPLES::
--
--            sage: F = GF(3); MS = MatrixSpace(F,2)
--            sage: gens = [MS([1,0, 0,1]), MS([1,1, 0,1])]
--            sage: G = MatrixGroup(gens)
--            sage: H = MatrixGroup(gens)
--            sage: g = G([1,1, 0,1])
--            sage: h = H([1,1, 0,1])
--            sage: g == h
--            True
--        """
--        return have_same_parent(self, other) and self.__mat == other.__mat
--
--    def __ne__(self, other):
--        """
--        EXAMPLES::
--
--            sage: F = GF(3); MS = MatrixSpace(F,2)
--            sage: gens = [MS([1,0, 0,1]), MS([1,1, 0,1])]
--            sage: G = MatrixGroup(gens)
--            sage: H = MatrixGroup(gens)
--            sage: g = G([1,1, 0,1])
--            sage: h = H([1,1, 0,1])
--            sage: g != h
--            False
--        """
--        return not self.__eq__(other)
--
--    def order(self):
--        """
--        Return the order of this group element, which is the smallest
--        positive integer n such that g^n = 1, or
--        +Infinity if no such integer exists.
--        
--        EXAMPLES::
--        
--            sage: k = GF(7); G = MatrixGroup([matrix(k,2,[1,1,0,1]), matrix(k,2,[1,0,0,2])])
--            sage: G
--            Matrix group over Finite Field of size 7 with 2 generators: 
--             [[[1, 1], [0, 1]], [[1, 0], [0, 2]]]
--            sage: G.order()
--            21        
--        
--        See trac #1170
--        
--        ::
--        
--            sage: gl=GL(2,ZZ); gl  
--            General Linear Group of degree 2 over Integer Ring
--            sage: g=gl.gens()[2]; g
--            [1 1]
--            [0 1]
--            sage: g.order()        
--            +Infinity
--        """
--        try:
--            return self.__order
--        except AttributeError:
--            try:
--                self.__order = Integer(self._gap_().Order())
--            except TypeError:
--                self.__order = Infinity
--            return self.__order
--
--    def word_problem(self, gens=None):
--        r"""
--        Write this group element in terms of the elements of the list
--        gens, or the standard generators of the parent of self if
--        gens is None.
--        
--        INPUT:
--
--        - gens - a list of elements that can be coerced into the parent of
--          self, or None.
--
--        ALGORITHM: Use GAP, which has optimized algorithms for solving the
--        word problem (the GAP functions EpimorphismFromFreeGroup and
--        PreImagesRepresentative).
--        
--        EXAMPLE::
--        
--            sage: G = GL(2,5); G
--            General Linear Group of degree 2 over Finite Field of size 5
--            sage: G.gens()
--            [
--            [2 0]
--            [0 1],
--            [4 1]
--            [4 0]
--            ]
--            sage: G(1).word_problem([G.1, G.0])
--            1
--        
--        Next we construct a more complicated element of the group from the
--        generators::
--        
--            sage: s,t = G.0, G.1
--            sage: a = (s * t * s); b = a.word_problem(); b
--            ([2 0]
--            [0 1]) *
--            ([4 1]
--            [4 0]) *
--            ([2 0]
--            [0 1])
--            sage: b.prod() == a
--            True
--
--        We solve the word problem using some different generators::
--
--            sage: s = G([2,0,0,1]); t = G([1,1,0,1]); u = G([0,-1,1,0])
--            sage: a.word_problem([s,t,u])
--            ([2 0]
--            [0 1])^-1 *
--            ([1 1]
--            [0 1])^-1 *
--            ([0 4]
--            [1 0]) *
--            ([2 0]
--            [0 1])^-1
--
--        We try some elements that don't actually generate the group::
--
--            sage: a.word_problem([t,u])
--            Traceback (most recent call last):
--            ...
--            ValueError: Could not solve word problem
--
--        AUTHORS:
--
--        - David Joyner and William Stein
--        - David Loeffler (2010): fixed some bugs
--        """
--        G = self.parent()
--        gg = gap(G)
--        if not gens:
--            gens = gg.GeneratorsOfGroup()
--        else:
--            gens = gap([G(x) for x in gens])
--        H = gens.Group()
--        hom = H.EpimorphismFromFreeGroup()
--        in_terms_of_gens = str(hom.PreImagesRepresentative(self))
--        if 'identity' in in_terms_of_gens:
--            return Factorization([])
--        elif in_terms_of_gens == 'fail':
--            raise ValueError, "Could not solve word problem"
--        v = list(H.GeneratorsOfGroup())
--        F = G.field_of_definition()
--        w = [G(x._matrix_(F)) for x in v]
--        factors = [Factorization([(x,1)]) for x in w]
--        d = dict([('x%s'%(i+1),factors[i]) for i in range(len(factors))])
--
--        from sage.misc.sage_eval import sage_eval
--        F = sage_eval(str(in_terms_of_gens), d)
--        F._set_cr(True)
--        return F
--
--    def list(self):
--        """
--        Return list representation of this matrix.
--        
--        EXAMPLES::
--        
--            sage: F = GF(3); MS = MatrixSpace(F,2,2)
--            sage: gens = [MS([[1,0],[0,1]]),MS([[1,1],[0,1]])]
--            sage: G = MatrixGroup(gens)
--            sage: g = G.0
--            sage: g.list()   
--            [[1, 0], [0, 1]]
--        """
--        rws = (self.__mat).rows()
--        lrws = [list(x) for x in rws]
--        return lrws
--
--    def conjugacy_class(self):
--        r"""
--        Return the conjugacy class of self.
--
--        EXAMPLES::
--
--            sage: G = SL(2, GF(2))
--            sage: g = G.gens()[0]
--            sage: g.conjugacy_class()
--            Conjugacy class of [1 1]
--            [0 1] in Special Linear Group of degree 2 over Finite Field of size 2
--        """
--        from sage.groups.conjugacy_classes import ConjugacyClassGAP
--        return ConjugacyClassGAP(self.parent(), self)
--
-diff --git a/sage/groups/matrix_gps/matrix_group_morphism.py b/sage/groups/matrix_gps/matrix_group_morphism.py
-deleted file mode 100644
---- a/sage/groups/matrix_gps/matrix_group_morphism.py
-+++ /dev/null
-@@ -1,255 +0,0 @@
--"""
--Homomorphisms Between Matrix Groups
--
--AUTHORS:
--
--- David Joyner and William Stein (2006-03): initial version
--
--- David Joyner (2006-05): examples
--
--- Simon King (2011-01): cleaning and improving code
--"""
--
--#*****************************************************************************
--#       Copyright (C) 2006 David Joyner and William Stein <wstein@gmail.com>
--#
--#  Distributed under the terms of the GNU General Public License (GPL)
--#  as published by the Free Software Foundation; either version 2 of
--#  the License, or (at your option) any later version.
--#                  http://www.gnu.org/licenses/
--#*****************************************************************************
--
--from sage.interfaces.gap import gap
--from sage.categories.morphism import *
--from sage.misc.latex import latex
--
--class MatrixGroupMap(Morphism):
--    """
--    A set-theoretic map between matrix groups.
--    """
--    def __init__(self, parent):
--        Morphism.__init__(self, parent)
--
--    def _repr_type(self):
--        return "MatrixGroup"
--
--class MatrixGroupMorphism(MatrixGroupMap):
--    pass
--
--class MatrixGroupMorphism_im_gens(MatrixGroupMorphism):
--    """
--    Some python code for wrapping GAP's GroupHomomorphismByImages
--    function but only for matrix groups. Can be expensive if G is
--    large.
--    
--    EXAMPLES::
--    
--        sage: F = GF(5); MS = MatrixSpace(F,2,2)
--        sage: G = MatrixGroup([MS([1,1,0,1])])
--        sage: H = MatrixGroup([MS([1,0,1,1])])
--        sage: phi = G.hom(H.gens())
--        sage: phi
--        Homomorphism : Matrix group over Finite Field of size 5 with 1 generators: 
--         [[[1, 1], [0, 1]]] --> Matrix group over Finite Field of size 5 with 1 generators: 
--         [[[1, 0], [1, 1]]]
--        sage: phi(MS([1,1,0,1]))
--        [1 0]
--        [1 1]
--        sage: F = GF(7); MS = MatrixSpace(F,2,2)
--        sage: F.multiplicative_generator()
--        3
--        sage: G = MatrixGroup([MS([3,0,0,1])])
--        sage: a = G.gens()[0]^2
--        sage: phi = G.hom([a])
--    """
--    def __init__(self, homset, imgsH, check=True):
--        MatrixGroupMorphism.__init__(self, homset)   # sets the parent
--        G = homset.domain()
--        H = homset.codomain()
--        gaplist_gens = [gap(x) for x in G.gens()]
--        gaplist_imgs = [gap(x) for x in imgsH]
--        genss = '[%s]'%(','.join(str(v) for v in gaplist_gens))
--        imgss = '[%s]'%(','.join(str(v) for v in gaplist_imgs))
--        args = '%s, %s, %s, %s'%(G._gap_init_(), H._gap_init_(), genss, imgss)
--        self._gap_str = 'GroupHomomorphismByImages(%s)'%args
--        phi0 = gap(self)
--        if gap.eval("IsGroupHomomorphism(%s)"%phi0.name())!="true":
--            raise ValueError,"The map "+str(gensG)+"-->"+str(imgsH)+" isn't a homomorphism."
--
--    def _repr_(self):
--        """
--        EXAMPLES::
--        
--            sage: F = GF(5); MS = MatrixSpace(F,2,2)
--            sage: G = MatrixGroup([MS([1,1,0,1])])
--            sage: H = MatrixGroup([MS([1,0,1,1])])
--            sage: phi = G.hom(H.gens())
--            sage: phi
--            Homomorphism : Matrix group over Finite Field of size 5 with 1 generators: 
--             [[[1, 1], [0, 1]]] --> Matrix group over Finite Field of size 5 with 1 generators: 
--             [[[1, 0], [1, 1]]]            
--            sage: phi(MS([1,1,0,1]))
--            [1 0]
--            [1 1]
--        """
--        return "Homomorphism : %s --> %s"%(self.domain(),self.codomain())
--    
--    def _latex_(self):
--        r"""
--        EXAMPLES::
--        
--            sage: F = GF(5); MS = MatrixSpace(F,2,2)
--            sage: G = MatrixGroup([MS([1,1,0,1])])
--            sage: phi = G.hom(G.gens())
--            sage: print latex(phi)
--            \left\langle \left(\begin{array}{rr}
--            1 & 1 \\
--            0 & 1
--            \end{array}\right) \right\rangle \rightarrow{} \left\langle \left(\begin{array}{rr}
--            1 & 1 \\
--            0 & 1
--            \end{array}\right) \right\rangle
--        """
--        return "%s \\rightarrow{} %s"%(latex(self.domain()), latex(self.codomain()))
--
--    def _gap_init_(self):
--        return self._gap_str
--
--    def kernel(self):
--        """
--        Return the kernel of self, i.e., a matrix group.
--
--        EXAMPLES::
--        
--            sage: F = GF(7); MS = MatrixSpace(F,2,2)
--            sage: F.multiplicative_generator()
--            3
--            sage: G = MatrixGroup([MS([3,0,0,1])])
--            sage: a = G.gens()[0]^2
--            sage: phi = G.hom([a])
--            sage: phi.kernel()
--            Matrix group over Finite Field of size 7 with 1 generators: 
--             [[[6, 0], [0, 1]]]
--
--        """
--        gap_ker = gap(self).Kernel()
--        from sage.all import MatrixGroup
--        F = self.domain().base_ring()
--        return MatrixGroup([x._matrix_(F) for x in gap_ker.GeneratorsOfGroup()])
--
--    def pushforward(self, J, *args,**kwds):
--        """
--        The image of an element or a subgroup.
--
--        INPUT:
--
--        J -- a subgroup or an element of the domain of self.
--
--        OUTPUT:
--
--        The image of J under self
--        
--        NOTE:
--
--        pushforward is the method that is used when a map is called on
--        anything that is not an element of its domain. For historical reasons,
--        we keep the alias image() for this method.
--
--        EXAMPLES::
--        
--            sage: F = GF(7); MS = MatrixSpace(F,2,2)
--            sage: F.multiplicative_generator()
--            3
--            sage: G = MatrixGroup([MS([3,0,0,1])])
--            sage: a = G.gens()[0]^2
--            sage: phi = G.hom([a])
--            sage: phi.image(G.gens()[0]) # indirect doctest
--            [2 0]
--            [0 1]
--            sage: H = MatrixGroup([MS(a.list())])
--            sage: H
--            Matrix group over Finite Field of size 7 with 1 generators:
--             [[[2, 0], [0, 1]]]
--
--        The following tests against trac ticket #10659::
--
--            sage: phi(H)   # indirect doctestest
--            Matrix group over Finite Field of size 7 with 1 generators: 
--             [[[4, 0], [0, 1]]]
--        """
--        phi = gap(self)
--        F = self.codomain().base_ring()
--        from sage.all import MatrixGroup
--        gapJ = gap(J)
--        if gap.eval("IsGroup(%s)"%gapJ.name()) == "true":
--            return MatrixGroup([x._matrix_(F) for x in phi.Image(gapJ).GeneratorsOfGroup()])
--        return phi.Image(gapJ)._matrix_(F)
--
--    image = pushforward
--
--    def _call_( self, g ):
--        """
--        Some python code for wrapping GAP's Images function for a matrix
--        group G. Returns an error if g is not in G.
--        
--        EXAMPLES::
--        
--            sage: F = GF(5); MS = MatrixSpace(F,2,2)
--            sage: g = MS([1,1,0,1])
--            sage: G = MatrixGroup([g])
--            sage: phi = G.hom(G.gens())
--            sage: phi(G.0)
--            [1 1]
--            [0 1]
--            sage: phi(G(g^2))
--            [1 2]
--            [0 1]
--        
--        ::
--        
--            sage: F = GF(5); MS = MatrixSpace(F,2,2)
--            sage: gens = [MS([1,2,  -1,1]),MS([1,1,  0,1])]
--            sage: G = MatrixGroup(gens)
--            sage: phi = G.hom(G.gens())
--            sage: phi(G.0)
--            [1 2]
--            [4 1]
--            sage: phi(G.1)
--            [1 1]
--            [0 1]
--
--        TEST:
--
--        The following tests that the call method was successfully
--        improved in trac ticket #10659::
--
--            sage: O = WeylGroup(['D',6])
--            sage: r = prod(O.gens())
--            sage: r_ = r^-1
--            sage: f = O.hom([r*x*r_ for x in O.gens()])  # long time (19s on sage.math, 2011)
--            sage: [f(x) for x in O.gens()]  # long time
--            [
--            [1 0 0 0 0 0]  [1 0 0 0 0 0]  [1 0 0 0 0 0]  [ 0  0  0  0 -1  0]
--            [0 0 1 0 0 0]  [0 1 0 0 0 0]  [0 1 0 0 0 0]  [ 0  1  0  0  0  0]
--            [0 1 0 0 0 0]  [0 0 0 1 0 0]  [0 0 1 0 0 0]  [ 0  0  1  0  0  0]
--            [0 0 0 1 0 0]  [0 0 1 0 0 0]  [0 0 0 0 1 0]  [ 0  0  0  1  0  0]
--            [0 0 0 0 1 0]  [0 0 0 0 1 0]  [0 0 0 1 0 0]  [-1  0  0  0  0  0]
--            [0 0 0 0 0 1], [0 0 0 0 0 1], [0 0 0 0 0 1], [ 0  0  0  0  0  1],
--            <BLANKLINE>
--            [0 0 0 0 0 1]  [ 0  0  0  0  0 -1]
--            [0 1 0 0 0 0]  [ 0  1  0  0  0  0]
--            [0 0 1 0 0 0]  [ 0  0  1  0  0  0]
--            [0 0 0 1 0 0]  [ 0  0  0  1  0  0]
--            [0 0 0 0 1 0]  [ 0  0  0  0  1  0]
--            [1 0 0 0 0 0], [-1  0  0  0  0  0]
--            ]
--            sage: f(O)  # long time
--            Matrix group over Rational Field with 6 generators: 
--             [[[1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]], [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]], [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1]], [[0, 0, 0, 0, -1, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [-1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1]], [[0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, -1], [0, 1, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [-1, 0, 0, 0, 0, 0]]]
--
--        """
--        phi = gap(self)
--        G = self.domain()
--        F = G.base_ring()
--        h = gap(g)
--        return phi.Image(h)._matrix_(F)
-diff --git a/sage/groups/matrix_gps/matrix_groups_catalog.py b/sage/groups/matrix_gps/matrix_groups_catalog.py
-deleted file mode 100644
---- a/sage/groups/matrix_gps/matrix_groups_catalog.py
-+++ /dev/null
-@@ -1,21 +0,0 @@
--r"""
--Type groups.matrix.<tab> to access examples
--of groups implemented as permutation groups.
--"""
--
--# groups imported here will be available
--# via  groups.matrix.<tab>
--#
--# Do not use this file for code
--#
--# If you import a new group, then add an
--# entry to the list in the module-level
--# docstring of groups/groups_catalog.py
--
--from general_linear import GL
--from special_linear import SL
--from symplectic import Sp
--from unitary import SU, GU
--from orthogonal import SO, GO
--from sage.groups.misc_gps.misc_groups import QuaternionMatrixGroupGF3 as QuaternionGF3
--

# trac_14014_iterator.patch

-# HG changeset patch
-# Parent 85f880cd9c9d7470fc64aeff70724241ddd2d4b8
-
-Implement the matrix group iterator via the GAP permutation group
-iterator, and make it consistent with the list() method.
-
-diff --git a/doc/en/thematic_tutorials/lie/weyl_groups.rst b/doc/en/thematic_tutorials/lie/weyl_groups.rst
---- a/doc/en/thematic_tutorials/lie/weyl_groups.rst
-+++ b/doc/en/thematic_tutorials/lie/weyl_groups.rst
-@@ -212,7 +212,7 @@
-     sage: def bi(u,v) : return [t for t in W if u.bruhat_le(t) and t.bruhat_le(v)]
-     ...
-     sage: bi(s1,s1*s2*s1)
--    [s1, s1*s2, s1*s2*s1, s2*s1]
-+    [s1*s2*s1, s1*s2, s2*s1, s1]
- 
- This would not be a good definition since it would fail if W is
- affine and be inefficient of W is large. Sage has a Bruhat interval
-diff --git a/doc/en/thematic_tutorials/tutorial-comprehensions.rst b/doc/en/thematic_tutorials/tutorial-comprehensions.rst
---- a/doc/en/thematic_tutorials/tutorial-comprehensions.rst
-+++ b/doc/en/thematic_tutorials/tutorial-comprehensions.rst
-@@ -335,9 +335,6 @@
-     [0 1]
-     [1 1]
-     <BLANKLINE>
--    [1 1]
--    [0 1]
--    <BLANKLINE>
-     [1 0]
-     [0 1]
-     <BLANKLINE>
-@@ -345,6 +342,9 @@
-     [1 1]
-     <BLANKLINE>
-     [1 1]
-+    [0 1]
-+    <BLANKLINE>
-+    [1 1]
-     [1 0]
-     <BLANKLINE>
- 
-diff --git a/sage/algebras/group_algebra_new.py b/sage/algebras/group_algebra_new.py
---- a/sage/algebras/group_algebra_new.py
-+++ b/sage/algebras/group_algebra_new.py
-@@ -592,8 +592,8 @@
-             sage: GroupAlgebra(DihedralGroup(6), QQ).random_element()
-             -1/95*(2,6)(3,5) - 1/2*(1,3)(4,6)
-             sage: GroupAlgebra(SU(2, 13), QQ).random_element(1)
--            1/2*[       6  5*a + 4]
--            [6*a + 10       12]
-+            1/2*[      12 12*a + 7]
-+            [   a + 6        7]
-         """
-         a = self(0)
-         for i in range(n):
-diff --git a/sage/algebras/iwahori_hecke_algebra.py b/sage/algebras/iwahori_hecke_algebra.py
---- a/sage/algebras/iwahori_hecke_algebra.py
-+++ b/sage/algebras/iwahori_hecke_algebra.py
-@@ -49,7 +49,7 @@
-         sage: w0
-         s1*s2*s3*s1*s2*s1
-         sage: H.an_element()
--        s1*s2*s3 + 3*s1*s2 + 2*s1 + 1
-+        s1*s2*s3*s1*s2*s1 + 2*s1*s2*s3*s1*s2 + 3*s1*s2*s3*s2*s1 + s1*s2*s3
- 
-     Iwahori Hecke algebras have proved to be fundamental. See for example:
- 
-@@ -204,8 +204,7 @@
-             sage: R.<q>=QQ[]
-             sage: H = IwahoriHeckeAlgebraT("A2",q)
-             sage: [H(x) for x in H.coxeter_group()]   # indirect doctest
--            [1, T1, T1*T2, T1*T2*T1, T2, T2*T1]
--
-+            [T1*T2*T1, T1*T2, T2*T1, T1, T2, 1]
-         """
-         assert w in self.basis().keys()
-         return self.monomial(w)
-diff --git a/sage/categories/groups.py b/sage/categories/groups.py
---- a/sage/categories/groups.py
-+++ b/sage/categories/groups.py
-@@ -207,12 +207,12 @@
-                 sage: M.cayley_table()
-                 *  a b c d e f
-                  +------------
--                a| d c b a f e
--                b| e f a b c d
--                c| f e d c b a
--                d| a b c d e f
--                e| b a f e d c
--                f| c d e f a b
-+                a| c e a f b d
-+                b| d f b e a c
-+                c| a b c d e f
-+                d| b a d c f e
-+                e| f d e b c a
-+                f| e c f a d b
- 
-             ::
- 
-diff --git a/sage/combinat/root_system/root_system.py b/sage/combinat/root_system/root_system.py
---- a/sage/combinat/root_system/root_system.py
-+++ b/sage/combinat/root_system/root_system.py
-@@ -229,13 +229,13 @@
-         sage: W = L.weyl_group()
-         sage: S3 = [ w.action(id) for w in W.classical() ]
-         sage: [L.classical()(x) for x in S3]
--        [(1, 2, 3), (2, 1, 3), (3, 1, 2), (3, 2, 1), (1, 3, 2), (2, 3, 1)]
-+        [(3, 2, 1), (3, 1, 2), (2, 3, 1), (2, 1, 3), (1, 3, 2), (1, 2, 3)]
- 
-     And the action of s_0 on these yields::
- 
-         sage: s = W.simple_reflections()
-         sage: [L.classical()(s[0].action(x)) for x in S3]
--        [(0, 2, 4), (0, 1, 5), (-1, 1, 6), (-2, 2, 6), (-1, 3, 4), (-2, 3, 5)]
-+        [(-2, 2, 6), (-1, 1, 6), (-2, 3, 5), (0, 1, 5), (-1, 3, 4), (0, 2, 4)]
- 
-     We can also plot various components of the ambient spaces::
- 
-diff --git a/sage/combinat/root_system/weyl_group.py b/sage/combinat/root_system/weyl_group.py
---- a/sage/combinat/root_system/weyl_group.py
-+++ b/sage/combinat/root_system/weyl_group.py
-@@ -301,7 +301,7 @@
-         except StandardError:
-             raise NotImplementedError, "reflections are only implemented for finite Weyl groups"
- 
--    def __repr__(self):
-+    def _repr_(self):
-         """
-         EXAMPLES::
- 
-@@ -315,53 +315,6 @@
-                                                                                                       base_ring=False,
-                                                                                                       type=False))
- 
--
--    def list(self):
--        """
--        Returns a list of the elements of self.
--
--        EXAMPLES::
--
--            sage: G = WeylGroup(['A',1])
--            sage: G.list()
--            [
--            [1 0]  [0 1]
--            [0 1], [1 0]
--            ]
--
--            sage: G = WeylGroup(['A',3,1])
--            sage: G.list()
--            Traceback (most recent call last):
--              ...
--            NotImplementedError: infinite list
--
--        This overrides the implementation of MatrixGroup_gap.
--        Those seem typical timings (without the overriding):
--    
--        #   sage: W = WeylGroup(["C",4])
--    
--        #   sage: %time  len(W.list())
--            CPU times: user 7.63 s, sys: 0.60 s, total: 8.22 s
--            Wall time: 8.63 s
--    
--        #    sage: %time  len([ x for x in W])
--            CPU times: user 3.23 s, sys: 0.09 s, total: 3.32 s
--            Wall time: 3.34 s
--    
--        #    sage: %time  len(list(W))
--            CPU times: user 3.26 s, sys: 0.02 s, total: 3.28 s
--            Wall time: 3.29 s
--
--        Note: listing the matrices in GAP is much faster than the
--        timings above suggest; the slowness apparently comes from the
--        interface with GAP, and are therefore highly subject to
--        improvement.
--        """
--        if hasattr(self, "_list_from_iterator"):
--            return self._list_from_iterator()
--        else:
--            raise NotImplementedError, "infinite list"
--
-     def character_table(self):
-         """
-         Returns the character table as a matrix
-@@ -680,7 +633,7 @@
-     """
-     Class for a Weyl Group elements
-     """
--    def __init__(self, g, parent):
-+    def __init__(self, g, parent, check=False):
-         """
-         EXAMPLES::
-         
-@@ -688,7 +641,7 @@
-             sage: s1 = G.simple_reflection(1)
-             sage: TestSuite(s1).run()
-         """
--        MatrixGroupElement_gap.__init__(self, g, parent, check=False)
-+        MatrixGroupElement_gap.__init__(self, g, parent, check=check)
-         self.__matrix = self.matrix()
-         self._parent = parent
- 
-diff --git a/sage/combinat/tiling.py b/sage/combinat/tiling.py
---- a/sage/combinat/tiling.py
-+++ b/sage/combinat/tiling.py
-@@ -257,31 +257,31 @@
-         sage: from sage.combinat.tiling import orthogonal_transformation
-         sage: orthogonal_transformation(2)
-         [
--        [1 0]  [ 0 -1]  [ 0  1]  [-1  0]
--        [0 1], [ 1  0], [-1  0], [ 0 -1]
-+        [-1  0]  [ 0 -1]  [ 0  1]  [1 0]
-+        [ 0 -1], [ 1  0], [-1  0], [0 1]
-         ]
-         sage: orthogonal_transformation(2, orientation_preserving=False)
-         [
--        [1 0]  [0 1]  [ 0 -1]  [-1  0]  [ 1  0]  [ 0  1]  [ 0 -1]  [-1  0]
--        [0 1], [1 0], [ 1  0], [ 0  1], [ 0 -1], [-1  0], [-1  0], [ 0 -1]
-+        [-1  0]  [-1  0]  [ 0 -1]  [ 0 -1]  [ 0  1]  [0 1]  [ 1  0]  [1 0]
-+        [ 0 -1], [ 0  1], [-1  0], [ 1  0], [-1  0], [1 0], [ 0 -1], [0 1]
-         ]
-         sage: orthogonal_transformation(3)
-         [
--        [1 0 0]  [0 0 1]  [ 0  0 -1]  [-1  0  0]  [ 0 -1  0]  [0 1 0]
--        [0 1 0]  [1 0 0]  [ 0  1  0]  [ 0  0  1]  [ 1  0  0]  [0 0 1]
--        [0 0 1], [0 1 0], [ 1  0  0], [ 0  1  0], [ 0  0  1], [1 0 0],
-+        [-1  0  0]  [-1  0  0]  [-1  0  0]  [-1  0  0]  [ 0 -1  0]  [ 0 -1  0]
-+        [ 0 -1  0]  [ 0  0 -1]  [ 0  0  1]  [ 0  1  0]  [-1  0  0]  [ 0  0 -1]
-+        [ 0  0  1], [ 0 -1  0], [ 0  1  0], [ 0  0 -1], [ 0  0 -1], [ 1  0  0],
-         <BLANKLINE>
--        [ 1  0  0]  [ 0  0  1]  [ 0  0 -1]  [-1  0  0]  [ 0 -1  0]  [ 0  1  0]
--        [ 0  0 -1]  [ 0 -1  0]  [-1  0  0]  [ 0 -1  0]  [ 0  0 -1]  [-1  0  0]
--        [ 0  1  0], [ 1  0  0], [ 0  1  0], [ 0  0  1], [ 1  0  0], [ 0  0  1],
-+        [ 0 -1  0]  [ 0 -1  0]  [ 0  0 -1]  [ 0  0 -1]  [ 0  0 -1]  [ 0  0 -1]
-+        [ 0  0  1]  [ 1  0  0]  [-1  0  0]  [ 0 -1  0]  [ 0  1  0]  [ 1  0  0]
-+        [-1  0  0], [ 0  0  1], [ 0  1  0], [-1  0  0], [ 1  0  0], [ 0 -1  0],
-         <BLANKLINE>
--        [ 0  1  0]  [ 0  0  1]  [ 0  0 -1]  [ 0 -1  0]  [-1  0  0]  [ 1  0  0]
--        [ 1  0  0]  [ 0  1  0]  [ 1  0  0]  [ 0  0  1]  [ 0  1  0]  [ 0  0  1]
--        [ 0  0 -1], [-1  0  0], [ 0 -1  0], [-1  0  0], [ 0  0 -1], [ 0 -1  0],
-+        [ 0  0  1]  [ 0  0  1]  [ 0  0  1]  [0 0 1]  [ 0  1  0]  [ 0  1  0]
-+        [-1  0  0]  [ 0 -1  0]  [ 0  1  0]  [1 0 0]  [-1  0  0]  [ 0  0 -1]
-+        [ 0 -1  0], [ 1  0  0], [-1  0  0], [0 1 0], [ 0  0  1], [-1  0  0],
-         <BLANKLINE>
--        [ 0  1  0]  [ 0  0  1]  [ 0  0 -1]  [ 0 -1  0]  [-1  0  0]  [ 1  0  0]
--        [ 0  0 -1]  [-1  0  0]  [ 0 -1  0]  [-1  0  0]  [ 0  0 -1]  [ 0 -1  0]
--        [-1  0  0], [ 0 -1  0], [-1  0  0], [ 0  0 -1], [ 0 -1  0], [ 0  0 -1]
-+        [0 1 0]  [ 0  1  0]  [ 1  0  0]  [ 1  0  0]  [ 1  0  0]  [1 0 0]
-+        [0 0 1]  [ 1  0  0]  [ 0 -1  0]  [ 0  0 -1]  [ 0  0  1]  [0 1 0]
-+        [1 0 0], [ 0  0 -1], [ 0  0 -1], [ 0  1  0], [ 0 -1  0], [0 0 1]
-         ]
- 
-     TESTS::
-@@ -1361,25 +1361,25 @@
-             sage: y = Polyomino([(0,0),(1,0),(2,0),(3,0),(2,1)], color='yellow')
-             sage: T = TilingSolver([y], box=(5,10), reusable=True, reflection=True)
-             sage: for a in T.dlx_common_prefix_solutions(): a
--            [18, 119, 68, 33, 48, 23, 8, 73, 58, 43]
--            [18, 119, 68, 33, 48]
--            [18, 119, 68, 33, 48, 133, 8, 73, 168, 43]
--            [18, 119]
--            [18, 119, 178, 143, 48, 23, 8, 73, 58, 43]
--            [18, 119, 178, 143, 48]
--            [18, 119, 178, 143, 48, 133, 8, 73, 168, 43]
--            [18, 119, 178]
--            [18, 119, 178, 164, 152, 73, 8, 133, 159, 147]
-+            [46, 83, 149, 26, 179, 44, 81, 162, 132, 101]
-+            [46, 83, 149, 26, 179]
-+            [46, 83, 149, 26, 179, 154, 81, 162, 132, 175]
-+            [46, 83, 149]
-+            [46, 83, 149, 97, 21, 162, 81, 44, 30, 106]
-+            [46]
-+            [46, 157, 149, 136, 179, 44, 81, 162, 132, 101]
-+            [46, 157, 149, 136, 179]
-+            [46, 157, 149, 136, 179, 154, 81, 162, 132, 175]
-             []
--            [74, 19, 177, 33, 49, 134, 109, 72, 58, 42]
--            [74, 19, 177]`