Ticket #14483: trac_14483.patch

File trac_14483.patch, 5.0 KB (added by ncohen, 8 years ago)
  • sage/combinat/designs/block_design.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1366819014 -7200
    # Node ID 06718f942140095f338ebe70b6c73f6ad01f1829
    # Parent  1ddd56f1ce4b9722752064741003a9a540d74abc
    A more helpful message when GAP cannot load one of its packages
    
    diff --git a/sage/combinat/designs/block_design.py b/sage/combinat/designs/block_design.py
    a b  
    110110        v = (q**(n+1)-1)/(q-1)
    111111        return BlockDesign(v, blcks, name="ProjectiveGeometryDesign")
    112112    if algorithm == "gap":   # Requires GAP's Design
    113         gap.eval('LoadPackage("design")')
     113        gap.load_package("design")
    114114        gap.eval("D := PGPointFlatBlockDesign( %s, %s, %d )"%(n,q,d))
    115115        v = eval(gap.eval("D.v"))
    116116        gblcks = eval(gap.eval("D.blocks"))
     
    195195        (5, 12, 6, 1)
    196196    """
    197197    from sage.interfaces.gap import gap, GapElement
    198     gap.eval('LoadPackage("design")')
     198    gap.load_package("design")
    199199    gap.eval("B:=WittDesign(%s)"%n)
    200200    v = eval(gap.eval("B.v"))
    201201    gblcks = eval(gap.eval("B.blocks"))
     
    204204       gB.append([x-1 for x in b])
    205205    return BlockDesign(v, gB, name="WittDesign", test=True)
    206206
    207 def HadamardDesign(n): 
     207def HadamardDesign(n):
    208208    """
    209209    As described in Section 1, p. 10, in [CvL]. The input n must have the
    210210    property that there is a Hadamard matrix of order n+1 (and that a
    211211    construction of that Hadamard matrix has been implemented...).
    212    
     212
    213213    EXAMPLES::
    214    
     214
    215215        sage: HadamardDesign(7)
    216216        Incidence structure with 7 points and 7 blocks
    217217        sage: print HadamardDesign(7)
    218218        HadamardDesign<points=[0, 1, 2, 3, 4, 5, 6], blocks=[[0, 1, 2], [0, 3, 4], [0, 5, 6], [1, 3, 5], [1, 4, 6], [2, 3, 6], [2, 4, 5]]>
    219    
     219
    220220    REFERENCES:
    221221
    222222    - [CvL] P. Cameron, J. H. van Lint, Designs, graphs, codes and
     
    239239
    240240    A Steiner Triple System (STS) of a set `\{0,...,n-1\}`
    241241    is a family `S` of 3-sets such that for any `i \not = j`
    242     there exists exactly one set of `S` in which they are 
     242    there exists exactly one set of `S` in which they are
    243243    both contained.
    244244
    245245    It can alternatively be thought of as a factorization of
  • sage/combinat/designs/incidence_structures.py

    diff --git a/sage/combinat/designs/incidence_structures.py b/sage/combinat/designs/incidence_structures.py
    a b  
    416416        from sage.combinat.designs.block_design import BlockDesign
    417417        from sage.misc.functional import transpose
    418418        if algorithm=="gap":
    419             gap.eval('LoadPackage("design")')
     419            gap.load_package("design")
    420420            gD = self._gap_()
    421421            gap.eval("DD:=DualBlockDesign("+gD+")")
    422422            v = eval(gap.eval("DD.v"))
     
    606606        """
    607607        from sage.interfaces.gap import gap, GapElement
    608608        from sage.sets.set import Set
    609         gap.eval('LoadPackage("design")')
     609        gap.load_package("design")
    610610        gD = self._gap_()
    611611        gP = gap.eval("BlockDesignPoints("+gD+")").replace("..",",")
    612612        return range(eval(gP)[0],eval(gP)[1]+1)
  • sage/groups/perm_gps/permgroup.py

    diff --git a/sage/groups/perm_gps/permgroup.py b/sage/groups/perm_gps/permgroup.py
    a b  
    149149
    150150    EXAMPLES::
    151151
    152         sage: sage.groups.perm_gps.permgroup.load_hap()
     152        sage: sage.groups.perm_gps.permgroup.load_hap() # optional - gap_packages
    153153    """
    154154    try:
    155         gap.eval('LoadPackage("hap")')
     155        gap.load_package("hap")
    156156    except StandardError:
    157         gap.eval('LoadPackage("hap")')
     157        gap.load_package("hap")
    158158
    159159def hap_decorator(f):
    160160    """
  • sage/interfaces/gap.py

    diff --git a/sage/interfaces/gap.py b/sage/interfaces/gap.py
    a b  
    479479    def _continuation_prompt(self):
    480480        """
    481481        Returns the continuation prompt in GAP.
    482        
     482
    483483        EXAMPLES::
    484        
     484
    485485            sage: gap._continuation_prompt()
    486486            '> '
    487487        """
     
    490490    def load_package(self, pkg, verbose=False):
    491491        """
    492492        Load the Gap package with the given name.
    493        
     493
    494494        If loading fails, raise a RuntimeError exception.
    495495
    496496        TESTS::
     
    498498            sage: gap.load_package("chevie")
    499499            Traceback (most recent call last):
    500500            ...
    501             RuntimeError: Error loading Gap package chevie
    502 
     501            RuntimeError: Error loading Gap package chevie. You may want to install the gap_packages SPKG.
    503502        """
    504503        if verbose:
    505504            print "Loading GAP package %s"%pkg
    506505        x = self.eval('LoadPackage("%s")'%pkg)
    507506        if x == 'fail':
    508             raise RuntimeError, 'Error loading Gap package %s'%pkg
     507            raise RuntimeError("Error loading Gap package "+str(pkg)+". "+
     508                               "You may want to install the gap_packages SPKG.")
    509509
    510510    def eval(self, x, newlines=False, strip=True, split_lines=True, **kwds):
    511511        r"""