Ticket #9476: trac_9476-eclib.patch

File trac_9476-eclib.patch, 13.3 KB (added by cremona, 11 years ago)

Applies after eclib-20100711.patch and trac_9441-atkin-lehner.patch

  • sage/libs/cremona/constructor.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1278883220 -3600
    # Node ID 251c4a062bdaca342573557ef668036b63103b20
    # Parent  b777a6ccad1c06a44b0c821283d701dae0a2c1a0
    #9476 - update interface for eclib-20100711
    
    diff -r b777a6ccad1c -r 251c4a062bda sage/libs/cremona/constructor.py
    a b  
    33    Return the space of Cremona modular symbols with given level, sign, etc.
    44
    55    INPUT:
    6         level -- an integer >= 2  (at least 2, not just positive!)
    7         sign -- an integer either 0 (the default) or 1.
    8         cuspidal -- (default: False); if True, compute only the cuspidal subspace
    9         verbose -- (default: False): if True, print verbose information while creating space
     6   
     7    - ``level`` -- an integer >= 2  (at least 2, not just positive!)
     8    - ``sign`` -- an integer either 0 (the default) or 1 or -1.
     9    - ``cuspidal`` -- (default: False); if True, compute only the cuspidal subspace
     10    - ``verbose`` -- (default: False): if True, print verbose information while creating space
    1011
    11     EXAMPLES:
     12    EXAMPLES::
     13   
    1214        sage: M = CremonaModularSymbols(43); M
    1315        Cremona Modular Symbols space of dimension 7 for Gamma_0(43) of weight 2 with sign 0
    1416        sage: M = CremonaModularSymbols(43, sign=1); M
     
    1820        sage: M = CremonaModularSymbols(43, cuspidal=True, sign=1); M
    1921        Cremona Cuspidal Modular Symbols space of dimension 3 for Gamma_0(43) of weight 2 with sign 1
    2022
    21     When run interactively, the following command will display verbose output:
    22         sage: M = CremonaModularSymbols(43, verbose=1); M   # not tested, since verbose output annoyingly goes to stderr.
     23    When run interactively, the following command will display verbose output::
     24
     25        sage: M = CremonaModularSymbols(43, verbose=1); M   # not tested, since verbose output goes to stderr.
    2326        After 2-term relations, ngens = 22
    2427        predicted value of ngens = 22
    2528        ngens     = 22
     
    3841        Finished constructing homspace.
    3942        Cremona Modular Symbols space of dimension 7 for Gamma_0(43) of weight 2 with sign 0
    4043
    41     The input must be valid or a ValueError is raised:
     44    The input must be valid or a ValueError is raised::
     45   
    4246        sage: M = CremonaModularSymbols(-1)
    4347        Traceback (most recent call last):
    4448        ...
     
    4852        ...
    4953        ValueError: the level (= 0) must be at least 2
    5054
    51     The sign can only be 0 or 1.
     55    The sign can only be 0 or 1 or -1::
     56   
    5257        sage: M = CremonaModularSymbols(10, sign = -2)
    5358        Traceback (most recent call last):
    5459        ...
    55         ValueError: sign (= -2) is not supported; use 0 or +1
     60        ValueError: sign (= -2) is not supported; use 0, +1 or -1
    5661
    57     Not even -1 is allowed as a sign:
    58         sage: M = CremonaModularSymbols(10, sign = -1)
    59         Traceback (most recent call last):
    60         ...
    61         ValueError: sign (= -1) is not supported; use 0 or +1
     62    We do allow -1 as a sign (see #9476)::
     63   
     64        sage: CremonaModularSymbols(10, sign = -1)
     65        Cremona Modular Symbols space of dimension 0 for Gamma_0(10) of weight 2 with sign -1
    6266    """
    6367    from homspace import ModularSymbols
    6468    return ModularSymbols(level=level, sign=sign, cuspidal=cuspidal, verbose=verbose)
  • sage/libs/cremona/homspace.pxd

    diff -r b777a6ccad1c -r 251c4a062bda sage/libs/cremona/homspace.pxd
    a b  
    1616    ctypedef struct homspace "homspace":
    1717        # attributes
    1818        long modulus
    19         int plusflag
     19        int plusflag # sign
    2020        int cuspidal
    2121
    2222        # member functions
  • sage/libs/cremona/homspace.pyx

    diff -r b777a6ccad1c -r 251c4a062bda sage/libs/cremona/homspace.pyx
    a b  
    44
    55cdef class ModularSymbols:
    66    """
    7     Class of Cremona Modular Symbols of given level, sign, etc.
     7    Class of Cremona Modular Symbols of given level and sign (and weight 2).
    88
    9     EXAMPLES:
     9    EXAMPLES::
     10   
    1011        sage: M = CremonaModularSymbols(225)
    1112        sage: type(M)
    1213        <type 'sage.libs.cremona.homspace.ModularSymbols'>
     
    1516        """
    1617        Called when creating a space of Cremona modular symbols.
    1718
    18         EXAMPLES:
     19        INPUT:
     20
     21        - ``level`` (int) -- the level: an integer, at least 2.
     22        - ``sign`` (int, default 0) -- the sign: 0, +1 or -1
     23        - ``cuspidal`` (boolean, default False) -- True for cuspidal homology
     24        - ``verbose`` (int, default 0) -- verbosity level
     25
     26        EXAMPLES::
     27       
    1928            sage: CremonaModularSymbols(123, sign=1, cuspidal=True)
    2029            Cremona Cuspidal Modular Symbols space of dimension 13 for Gamma_0(123) of weight 2 with sign 1
     30            sage: CremonaModularSymbols(123, sign=-1, cuspidal=True)
     31            Cremona Cuspidal Modular Symbols space of dimension 12 for Gamma_0(123) of weight 2 with sign -1
     32            sage: CremonaModularSymbols(123, sign=0, cuspidal=True)
     33            Cremona Cuspidal Modular Symbols space of dimension 26 for Gamma_0(123) of weight 2 with sign 0
     34            sage: CremonaModularSymbols(123, sign=0, cuspidal=False)
     35            Cremona Modular Symbols space of dimension 29 for Gamma_0(123) of weight 2 with sign 0
    2136        """
    22         if not (sign == 0 or sign==1):
    23             raise ValueError, "sign (= %s) is not supported; use 0 or +1"%sign
     37        if not (sign == 0 or sign == 1 or sign == -1):
     38            raise ValueError, "sign (= %s) is not supported; use 0, +1 or -1"%sign
    2439        if level <= 1:
    2540            raise ValueError, "the level (= %s) must be at least 2"%level
    2641        _sig_on
     
    3550        String representation of space of Cremona modular symbols.
    3651
    3752        EXAMPLES:
    38         We test various types of spaces that impact printing:
     53       
     54        We test various types of spaces that impact printing::
    3955
    4056            sage: M = CremonaModularSymbols(37, sign=1)
    4157            sage: M.__repr__()
     
    5369        """
    5470        Return the level of this modular symbols space.
    5571
    56         EXAMPLES:
     72        EXAMPLES::
     73       
    5774            sage: M = CremonaModularSymbols(1234, sign=1)
    5875            sage: M.level()
    5976            1234
     
    6582        """
    6683        Return the dimension of this modular symbols space.
    6784
    68         EXAMPLES:
     85        EXAMPLES::
     86       
    6987            sage: M = CremonaModularSymbols(1234, sign=1)
    7088            sage: M.dimension()
    7189            156
     
    7795        Return the number of cusps for $\Gamma_0(N)$, where $N$ is the
    7896        level.
    7997
    80         EXAMPLES:
     98        EXAMPLES::
     99       
    81100            sage: M = CremonaModularSymbols(225)
    82101            sage: M.number_of_cusps()
    83102            24
     
    87106    #cpdef int sign(self):
    88107    def sign(self):
    89108        """
    90         Return the sign of this Cremona modular symbols space.  The sign is either 0 or +1.
     109        Return the sign of this Cremona modular symbols space.  The sign is either 0, +1 or -1.
    91110
    92         EXAMPLES:
     111        EXAMPLES::
     112       
    93113            sage: M = CremonaModularSymbols(1122, sign=1); M
    94114            Cremona Modular Symbols space of dimension 224 for Gamma_0(1122) of weight 2 with sign 1
    95115            sage: M.sign()
     
    98118            Cremona Modular Symbols space of dimension 433 for Gamma_0(1122) of weight 2 with sign 0
    99119            sage: M.sign()
    100120            0
     121            sage: M = CremonaModularSymbols(1122, sign=-1); M
     122            Cremona Modular Symbols space of dimension 209 for Gamma_0(1122) of weight 2 with sign -1
     123            sage: M.sign()
     124            -1
    101125        """
    102126        return self.H.plusflag
    103127
     
    106130        """
    107131        Return whether or not this space is cuspidal.
    108132
    109         EXAMPLES:
     133        EXAMPLES::
     134       
    110135            sage: M = CremonaModularSymbols(1122); M.is_cuspidal()
    111136            0
    112137            sage: M = CremonaModularSymbols(1122, cuspidal=True); M.is_cuspidal()
  • sage/libs/cremona/mat.pyx

    diff -r b777a6ccad1c -r 251c4a062bda sage/libs/cremona/mat.pyx
    a b  
    1010    """
    1111    A Cremona Matrix.
    1212
    13     EXAMPLES:
     13    EXAMPLES::
     14   
    1415        sage: M = CremonaModularSymbols(225)
    1516        sage: t = M.hecke_matrix(2)
    1617        sage: type(t)
     
    2223        """
    2324        Called when the matrix is being created.
    2425
    25         EXAMPLES:
     26        EXAMPLES::
     27       
    2628            sage: t = CremonaModularSymbols(11).hecke_matrix(2); t
    2729            3 x 3 Cremona matrix over Rational Field
    2830            sage: type(t)
     
    3537        String representation of this matrix.  Use print self.str() to
    3638        print out the matrix entries on the screen.
    3739
    38         EXAMPLES:
     40        EXAMPLES::
     41       
    3942            sage: M = CremonaModularSymbols(23)
    4043            sage: t = M.hecke_matrix(2); t
    4144            5 x 5 Cremona matrix over Rational Field
     
    5255        """
    5356        Return full string representation of this matrix, never in compact form.
    5457
    55         EXAMPLES:
     58        EXAMPLES::
     59       
    5660            sage: M = CremonaModularSymbols(22, sign=1)
    5761            sage: t = M.hecke_matrix(13)
    5862            sage: t.str()
     
    103107        """
    104108        Return the number of rows of this matrix.
    105109
    106         EXAMPLES:
     110        EXAMPLES::
     111       
    107112            sage: M = CremonaModularSymbols(19, sign=1)
    108113            sage: t = M.hecke_matrix(13); t
    109114            2 x 2 Cremona matrix over Rational Field
     
    116121        """
    117122        Return the number of columns of this matrix.
    118123
    119         EXAMPLES:
     124        EXAMPLES::
     125       
    120126            sage: M = CremonaModularSymbols(1234, sign=1)
    121127            sage: t = M.hecke_matrix(3); t.ncols()
    122128            156
     
    152158        """
    153159        Return new matrix obtained by adding s to each diagonal entry of self.
    154160
    155         EXAMPLES:
     161        EXAMPLES::
     162       
    156163            sage: M = CremonaModularSymbols(23, cuspidal=True, sign=1)
    157164            sage: t = M.hecke_matrix(2); print t.str()
    158165            [ 0  1]
     
    168175        Return the characteristic polynomial of this matrix, viewed as
    169176        as a matrix over the integers.
    170177
    171         ALGORITHM: Note that currently, this function converts this
    172         matrix into a dense matrix over the integers, then calls the
    173         charpoly algorithm on that, which I think is LinBox's.
     178        ALGORITHM:
    174179
    175         EXAMPLES:
     180        Note that currently, this function converts this matrix into a
     181        dense matrix over the integers, then calls the charpoly
     182        algorithm on that, which I think is LinBox's.
     183
     184        EXAMPLES::
     185       
    176186            sage: M = CremonaModularSymbols(33, cuspidal=True, sign=1)
    177187            sage: t = M.hecke_matrix(2)
    178188            sage: t.charpoly()
     
    186196        """
    187197        Return corresponding Sage matrix over the integers.
    188198
    189         INPUTS:
    190             sparse -- (default: True) whether the return matrix has a
    191                       sparse representation
     199        INPUT:
     200       
     201        - ``sparse`` -- (default: True) whether the return matrix has
     202          a sparse representation
    192203
    193         EXAMPLES:
     204        EXAMPLES::
     205       
    194206            sage: M = CremonaModularSymbols(23, cuspidal=True, sign=1)
    195207            sage: t = M.hecke_matrix(2)
    196208            sage: s = t.sage_matrix_over_ZZ(); s
  • sage/libs/cremona/newforms.pxd

    diff -r b777a6ccad1c -r 251c4a062bda sage/libs/cremona/newforms.pxd
    a b  
    3131        int verbose
    3232        long maxdepth
    3333        long cuspidal
    34         long plusflag
     34        long sign
    3535
    3636        #member functions
    3737        void (* createfromcurve)(CurveRed CR)
  • sage/libs/cremona/newforms.pyx

    diff -r b777a6ccad1c -r 251c4a062bda sage/libs/cremona/newforms.pyx
    a b  
    2424    Modular symbol associated with an elliptic curve,
    2525    using John Cremona's newforms class.
    2626
    27     EXAMPLES:
     27    EXAMPLES::
     28   
    2829        sage: from sage.libs.cremona.newforms import ECModularSymbol
    2930        sage: E = EllipticCurve('11a')
    3031        sage: M = ECModularSymbol(E); M
     
    5354        when run on a 32-bit platform, but works fine on 64-bit in this
    5455        case; see trac #8114). 
    5556
     57        ::
    5658            sage: from sage.libs.cremona.newforms import ECModularSymbol
    5759            sage: E = EllipticCurve('858k2')
    5860            sage: ECModularSymbol(E)
     
    8789
    8890    def __repr__(self):
    8991        """
    90         TESTS:
     92        TESTS::
     93       
    9194            sage: from sage.libs.cremona.newforms import ECModularSymbol
    9295            sage: E = EllipticCurve('11a')
    9396            sage: M = ECModularSymbol(E); M
     
    105108        """
    106109        Computes the (rational) value of self at a rational number r.
    107110
    108         EXAMPLES:
     111        EXAMPLES::
     112       
    109113            sage: from sage.libs.cremona.newforms import ECModularSymbol
    110114            sage: E = EllipticCurve('11a')
    111115            sage: M = ECModularSymbol(E)