Ticket #9313: trac_9313-remove_padic_height.patch

File trac_9313-remove_padic_height.patch, 4.6 KB (added by davidloeffler, 9 years ago)

patch against 4.4.4

  • deleted file sage/schemes/elliptic_curves/padic_height.py

    # HG changeset patch
    # User David Loeffler <d.loeffler.01@cantab.net>
    # Date 1277801719 -3600
    # Node ID d4d16a8aa9a8b348004f0f0a2dad851aac295244
    # Parent  9302bc15fe96aad78072eacc611ea1403b34622a
    #9313: remove outdated file sage/schemes/elliptic_curves/padic_height.py
    
    diff -r 9302bc15fe96 -r d4d16a8aa9a8 sage/schemes/elliptic_curves/padic_height.py
    + -  
    1 """
    2 Access to MAGMA code for computing p-adic height pairings.
    3 
    4 (deprecated)
    5 """
    6 
    7 #*****************************************************************************
    8 #       Copyright (C) 2005 William Stein <wstein@gmail.com>
    9 #
    10 #  Distributed under the terms of the GNU General Public License (GPL)
    11 #
    12 #    This code is distributed in the hope that it will be useful,
    13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    15 #    General Public License for more details.
    16 #
    17 #  The full text of the GPL is available at:
    18 #
    19 #                  http://www.gnu.org/licenses/
    20 #*****************************************************************************
    21 
    22 from sage.interfaces.magma import Magma
    23 from sage.rings.all import O, pAdicField
    24 
    25 _KeyboardInterrupt = KeyboardInterrupt   # bug in Python requires this???
    26 
    27 magma = None
    28 def init():
    29     global magma
    30     if magma is None:
    31         magma = Magma(script_subdirectory='padic_height')
    32         magma.attach('kedlaya.m')
    33         magma.attach('padic_height.m')
    34        
    35 def padic_eval(cmd, p, prec):
    36     init()
    37     global magma   
    38     bad = False
    39     try:
    40         x = magma.eval(cmd)
    41     except _KeyboardInterrupt:
    42         bad = True
    43         magma = None
    44         raise _KeyboardInterrupt
    45    
    46     if not bad:
    47         try:
    48             v, n = eval(x)
    49             if x.find("error") != -1:
    50                 bad = True
    51         except SyntaxError, KeyboardInterrupt:
    52             bad = True
    53            
    54     if bad or not (isinstance(v, (int, long)) and isinstance(n, (int, long))):
    55         magma = None
    56         raise RuntimeError, "error computing p-adic height: %s"%x
    57    
    58     z = (n + O(p**(prec)))
    59     if v < 0:
    60         z = z / (p**(-v))
    61     elif v > 0:
    62         z = z * (p**v)
    63     return z
    64 
    65 def padic_height(E, p, point, prec=20):
    66     """
    67     INPUT:
    68         E -- five-tuple of integers that define a Weierstrass equation
    69         p -- a prime number
    70         point -- point on E
    71         prec -- precision parameter
    72     OUTPUT:
    73         p-adic number
    74     """
    75     # TODO: add type checking for better error messages.
    76     cmd = "E := EllipticCurve(%s); r := height_function(E,%s,%s)(E!%s); v:=Valuation(r); print [v, Integers()!(r*%s^(-v))];"%(
    77                 E, p, prec, list(point), p)
    78     return padic_eval(cmd, p, prec)
    79 
    80 def padic_regulator(E, p, points, prec=20):
    81     """
    82     Returns the p-adic regulator, where points is a basis for the Mordell-Weil group
    83     modulo torsion.
    84    
    85     INPUT:
    86         E -- five-tuple of integers that define a Weierstrass equation
    87         p -- a prime number
    88         points -- list of points on E
    89         prec -- precision parameter
    90     OUTPUT:
    91         p-adic number
    92     """
    93     points = [list(x) for x in points]
    94     cmd = "E := EllipticCurve(%s); r := regulator(E,%s,%s,%s); v:=Valuation(r); print [v, Integers()!(r*%s^(-v))];"%(
    95         E, p, prec, points, p)
    96     return padic_eval(cmd, p, prec)
    97 
    98 def padic_E2(E, p, prec=20):
    99     """
    100     INPUT:
    101         E -- five-tuple of integers that define a Weierstrass equation
    102         p -- a prime number
    103         prec -- precision parameter
    104     OUTPUT:
    105         p-adic number
    106     """
    107     cmd = "E := EllipticCurve(%s); r := E2(E,%s,%s); v:=Valuation(r); print [v, Integers()!(r*%s^(-v))];"%(
    108          E, p, prec, p)
    109     return padic_eval(cmd, p, prec)
    110 
    111 def padic_E2_of_c4c6(c4, c6, p, prec=20):
    112     K = pAdicField(p)
    113     c4 = K(c4); c6 = K(c6)
    114     cmd = "r := E2_c4c6(%s,%s,%s,%s); v:=Valuation(r); print [v, Integers()!(r*%s^(-v))];"%(
    115          c4.lift(), c6.lift(), p, prec, p)
    116     return padic_eval(cmd, p, prec)
  • sage/schemes/elliptic_curves/padics.py

    diff -r 9302bc15fe96 -r d4d16a8aa9a8 sage/schemes/elliptic_curves/padics.py
    a b  
    3636import sage.misc.misc as misc
    3737import sage.matrix.all as matrix
    3838sqrt = math.sqrt
    39 import padic_height as pheight
    4039import monsky_washnitzer
    4140import sage.schemes.hyperelliptic_curves.hypellfrob
    4241from constructor import EllipticCurve