Exemplo n.º 1
0
def convert_from_trace_bi(t, P, Q):
    M = t.parent()
    _x, _y = M.gens()[:1]
    m = P.degree()
    n = Q.degree()
    IP = inverse_mod(P.derivative(), P)
    IQ = inverse_mod(Q.derivative(), Q)
    N = (P.reverse(m)(_x) * Q.reverse(n)(_y) * t).truncate(_x, m).truncate(_y, n)
    Nstar = N(1/_x,1/_y) * _x^(m-1) * _y^(n-1)
    Nstar = Nstar.numerator()
    H = (Nstar*IP(_x)*IQ(_y)).reduce([P(_x), Q(_y)])
    return H
Exemplo n.º 2
0
def convert_from_trace_bi(t, P, Q):
    M = t.parent()
    _x, _y = M.gens()[:1]
    m = P.degree()
    n = Q.degree()
    IP = inverse_mod(P.derivative(), P)
    IQ = inverse_mod(Q.derivative(), Q)
    N = (P.reverse(m)(_x) * Q.reverse(n)(_y) * t).truncate(_x,
                                                           m).truncate(_y, n)
    Nstar = N(1 / _x, 1 / _y) * _x ^ (m - 1) * _y ^ (n - 1)
    Nstar = Nstar.numerator()
    H = (Nstar * IP(_x) * IQ(_y)).reduce([P(_x), Q(_y)])
    return H
Exemplo n.º 3
0
def lift_ramified(g, p, u, n):
    r"""
    Given four integers `a,b,c,d` with `p \mid c` and `ad - bc = 1 \pmod{p^u}`,
    find `a',b',c',d'` congruent to `a,b,c,d \pmod{p^u}`, with `c' = c
    \pmod{p^{u+1}}`, such that `a'd' - b'c'` is exactly 1, and `\begin{pmatrix}
    a & b \\ c & d \end{pmatrix}` is in `\Gamma_1(n)`.

    Algorithm: Uses :func:`~lift_to_gamma1` to get a lifting modulo `p^u`, and
    then adds an appropriate multiple of the top row to the bottom row in order
    to get the bottom-left entry correct modulo `p^{u+1}`.

    EXAMPLES::

        sage: from sage.modular.local_comp.liftings import lift_ramified
        sage: lift_ramified([2,2,3,2], 3, 1, 1)
        [5, 8, 3, 5]
        sage: lift_ramified([8,2,12,2], 3, 2, 23)
        [323, 110, -133584, -45493]
        sage: type(lift_ramified([8,2,12,2], 3, 2, 23)[0])
        <type 'sage.rings.integer.Integer'>
    """
    a,b,c,d = lift_to_gamma1(g, p**u, n)
    r = crt( (c - g[2]) / p**u * inverse_mod(a, p), 0, p, n)
    c = c - p**u * r * a
    d = d - p**u * r * b
    # assert (c - g[2]) % p**(u+1) == 0
    return [a,b,c,d]
Exemplo n.º 4
0
def convert_from_trace(t, M):
    m = M.degree()
    D = inverse_mod(M.derivative(), M)
    N = (M.reverse(m) * t).truncate(m)
    Nstar = N.reverse(m - 1)
    C = (Nstar * D) % M
    return C
Exemplo n.º 5
0
def tchange_basis_2(gamma, P, Q, R, M):
    U = P.parent()
    m = P.degree()
    n = Q.degree()

    SP = S0(P)
    SR = S0(R)
    SQ = S0(Q)

    np = n + m - 1
    p = ceil(sqrt(np))
    q = ceil(np/p)
    T = embed(U.gen(), Q, P, R)
    iT = inverse_mod(T, R)
    iTm = power_mod(iT, m-1, R)
    TT = [U(1)]
    for i in range(1,q+1):
        TT.append(TT[i-1]*T % R)
    MT = matrix([ [ U([TT[i][k] for k in range(j*m,(j+1)*m)]) for j in range(n)] for i in range(q)])
    gamma = tmulmod(gamma, iTm, R, SR)
    Vstar = []
    for i in range(p):
        Vstar.append(gamma)
        gamma = tmulmod(gamma, TT[q], R, SR)
    V = [trem(Vstar[i], R, m*n+m-1) for i in range(p)]
    MV = matrix([ [ U([V[i][ell] for ell in range(j*m,j*m+2*m-1)]) for j in range(n)] for i in range(p)])
    MH = trightmatmul(MV, MT, m-1, m)
    LH = MH.list()
    ell = M(0)
    for i in range(m):
        for k in range(np):
            if (i+k-(m-1) >= 0) and (i+k-(m-1) < n):
                ell = ell + LH[k][i]*M.gens()[0]^i*M.gens()[1]^(i+k-(m-1))
    return ell
Exemplo n.º 6
0
def change_basis_2(FF, P, Q, R):
    M = FF.parent()
    U = P.parent()
    m = P.degree()
    n = Q.degree()

    SP = S0(P)
    SR = S0(R)
    SQ = S0(Q)

    np = n + m - 1
    p = ceil(sqrt(np))
    q = ceil(np/p)
    T = embed(U.gen(), Q, P, R)
    iT = inverse_mod(T, R)
    iTm = power_mod(iT, m-1, R)
    TT = [U(1)]
    for i in range(1,q+1):
        TT.append(TT[i-1]*T % R)
    MT = matrix([ [ U([TT[i][k] for k in range(j*m,(j+1)*m)]) for j in range(n)] for i in range(q)])
    H = []
    for k in range(p*q):
        lo = max(0,m-1-k)
        hi = min(m,n+m-1-k)
        tmp = U([FF[ell,ell+k-m+1] for ell in range(lo, hi)])
        H.append(tmp.shift(lo))
    MH = matrix([ [ H[i*q+j] for j in range(q) ] for i in range(p) ])
    MV = MH*MT
    V = [add(MV[i,j].shift(j*m) for j in range(n)) % R for i in range(p)]
    G = 0
    for i in range(p-1,-1,-1):
        G = (G*TT[q]+V[i]) % R
    G = G*iTm % R
    return G
Exemplo n.º 7
0
def convert_from_trace(t, M):
    m = M.degree()
    D = inverse_mod(M.derivative(), M)
    N = (M.reverse(m)*t).truncate(m)
    Nstar = N.reverse(m-1)
    C = (Nstar*D) % M
    return C
Exemplo n.º 8
0
def tchange_basis_2(gamma, P, Q, R, M):
    U = P.parent()
    m = P.degree()
    n = Q.degree()

    SP = S0(P)
    SR = S0(R)
    SQ = S0(Q)

    np = n + m - 1
    p = ceil(sqrt(np))
    q = ceil(np / p)
    T = embed(U.gen(), Q, P, R)
    iT = inverse_mod(T, R)
    iTm = power_mod(iT, m - 1, R)
    TT = [U(1)]
    for i in range(1, q + 1):
        TT.append(TT[i - 1] * T % R)
    MT = matrix(
        [[U([TT[i][k] for k in range(j * m, (j + 1) * m)]) for j in range(n)]
         for i in range(q)])
    gamma = tmulmod(gamma, iTm, R, SR)
    Vstar = []
    for i in range(p):
        Vstar.append(gamma)
        gamma = tmulmod(gamma, TT[q], R, SR)
    V = [trem(Vstar[i], R, m * n + m - 1) for i in range(p)]
    MV = matrix([[
        U([V[i][ell] for ell in range(j * m, j * m + 2 * m - 1)])
        for j in range(n)
    ] for i in range(p)])
    MH = trightmatmul(MV, MT, m - 1, m)
    LH = MH.list()
    ell = M(0)
    for i in range(m):
        for k in range(np):
            if (i + k - (m - 1) >= 0) and (i + k - (m - 1) < n):
                ell = ell + LH[k][i] * M.gens()[0] ^ i * M.gens()[1] ^ (
                    i + k - (m - 1))
    return ell
Exemplo n.º 9
0
def change_basis_2(FF, P, Q, R):
    M = FF.parent()
    U = P.parent()
    m = P.degree()
    n = Q.degree()

    SP = S0(P)
    SR = S0(R)
    SQ = S0(Q)

    np = n + m - 1
    p = ceil(sqrt(np))
    q = ceil(np / p)
    T = embed(U.gen(), Q, P, R)
    iT = inverse_mod(T, R)
    iTm = power_mod(iT, m - 1, R)
    TT = [U(1)]
    for i in range(1, q + 1):
        TT.append(TT[i - 1] * T % R)
    MT = matrix(
        [[U([TT[i][k] for k in range(j * m, (j + 1) * m)]) for j in range(n)]
         for i in range(q)])
    H = []
    for k in range(p * q):
        lo = max(0, m - 1 - k)
        hi = min(m, n + m - 1 - k)
        tmp = U([FF[ell, ell + k - m + 1] for ell in range(lo, hi)])
        H.append(tmp.shift(lo))
    MH = matrix([[H[i * q + j] for j in range(q)] for i in range(p)])
    MV = MH * MT
    V = [add(MV[i, j].shift(j * m) for j in range(n)) % R for i in range(p)]
    G = 0
    for i in range(p - 1, -1, -1):
        G = (G * TT[q] + V[i]) % R
    G = G * iTm % R
    return G