Skip to content

Commit

Permalink
Trac #21005: Update pari to version 2.8.0
Browse files Browse the repository at this point in the history
There is a critical bug in the current snapshot of PARI (see #21000).

Later snapshots from PARI have problems with `polredbest()`, see
http://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=1836

Two macros appeared in the doc (`\Hom` and `\Frob`) see
http://pari.math.u-bordeaux.fr/archives/pari-dev-1607/msg00020.html

Upstream tarball:
http://pari.math.u-bordeaux.fr/pub/pari/unstable/pari-2.8.0.alpha.tar.gz

URL: https://trac.sagemath.org/21005
Reported by: vdelecroix
Ticket author(s): Vincent Delecroix, Jeroen Demeyer
Reviewer(s): Volker Braun, Jeroen Demeyer, Vincent Delecroix
  • Loading branch information
Release Manager authored and vbraun committed Aug 20, 2016
2 parents 699518a + 9cf5776 commit d922775
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 28 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/pari/checksums.ini
@@ -1,4 +1,4 @@
tarball=pari-VERSION.tar.gz
sha1=a936e0ed661c8e453578f3c129c3a454e2039e3e
md5=59f2e4c3c51f7652182400489cd76e6a
cksum=1366291737
sha1=efd1eb6b8d87066b2b9f3b2c38ecb30bbfdb48d2
md5=f3f3342913a3b3b306970b3462f4d47d
cksum=1553747906
2 changes: 1 addition & 1 deletion build/pkgs/pari/package-version.txt
@@ -1 +1 @@
2.8-2771-gb70b447.p0
2.8.0.alpha.p0
15 changes: 11 additions & 4 deletions src/sage/libs/pari/paridecl.pxd
Expand Up @@ -2594,7 +2594,7 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN ellrandom(GEN e)
long ellrootno(GEN e, GEN p)
long ellrootno_global(GEN e)
GEN ellsea(GEN E, GEN p, long early_abort)
GEN ellsea(GEN E, ulong smallfact)
GEN ellsigma(GEN om, GEN z, long flag, long prec)
GEN ellsub(GEN e, GEN z1, GEN z2)
GEN elltaniyama(GEN e, long prec)
Expand Down Expand Up @@ -3014,10 +3014,11 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN padic_to_Q_shallow(GEN x)
GEN QpV_to_QV(GEN v)
GEN RgM_mulreal(GEN x, GEN y)
GEN RgX_RgM_eval_col(GEN x, GEN M, long c)
GEN RgX_cxeval(GEN T, GEN u, GEN ui)
GEN RgX_deflate_max(GEN x0, long *m)
long RgX_deflate_order(GEN x)
long ZX_deflate_order(GEN x)
GEN ZX_deflate_max(GEN x, long *m)
long RgX_degree(GEN x, long v)
GEN RgX_integ(GEN x)
GEN bitprecision0(GEN x, long n)
Expand Down Expand Up @@ -3056,6 +3057,7 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN ggrando(GEN x, long n)
GEN ggt(GEN x, GEN y)
GEN gimag(GEN x)
GEN gisexactzero(GEN g)
GEN gle(GEN x, GEN y)
GEN glt(GEN x, GEN y)
GEN gmod(GEN x, GEN y)
Expand All @@ -3067,8 +3069,10 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN gne(GEN x, GEN y)
GEN gnot(GEN x)
GEN gpolvar(GEN y)
GEN gppadicprec(GEN x, GEN p)
GEN gppoldegree(GEN x, long v)
long gprecision(GEN x)
GEN gpserprec(GEN x, long v)
GEN greal(GEN x)
GEN grndtoi(GEN x, long *e)
GEN ground(GEN x)
Expand Down Expand Up @@ -3096,6 +3100,7 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN imag_i(GEN x)
GEN integ(GEN x, long v)
GEN integser(GEN x)
GEN inv_ser(GEN b)
int iscomplex(GEN x)
int isexactzero(GEN g)
int isrationalzeroscalar(GEN g)
Expand Down Expand Up @@ -3142,7 +3147,9 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN scalarpol_shallow(GEN x, long v)
GEN scalarser(GEN x, long v, long prec)
GEN ser_unscale(GEN P, GEN h)
long serprec(GEN x, long v)
GEN serreverse(GEN x)
GEN sertoser(GEN x, long prec)
GEN simplify(GEN x)
GEN simplify_shallow(GEN x)
GEN tayl(GEN x, long v, long precdl)
Expand Down Expand Up @@ -3427,7 +3434,7 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN lfunlambda0(GEN ldata, GEN s, long der, long bitprec)
GEN lfunmisc_to_ldata(GEN ldata)
GEN lfunmisc_to_ldata_shallow(GEN ldata)
long lfunorderzero(GEN ldata, long bitprec)
long lfunorderzero(GEN ldata, long m, long bitprec)
GEN lfunprod_get_fact(GEN tech)
GEN lfunrootno(GEN data, long bitprec)
GEN lfunrootres(GEN data, long bitprec)
Expand Down Expand Up @@ -3460,7 +3467,7 @@ cdef extern from "sage/libs/pari/parisage.h":
GEN lfunmfspec(GEN lmisc, long bitprec)
GEN lfunmfpeters(GEN ldata, long bitprec)
GEN lfunmul(GEN ldata1, GEN ldata2, long bitprec)
GEN lfunqf(GEN ldata)
GEN lfunqf(GEN ldata, long prec)
GEN lfunsymsq(GEN ldata, GEN known, long prec)
GEN lfunsymsqspec(GEN lmisc, long bitprec)
GEN lfunzetakinit(GEN pol, GEN dom, long der, long flag, long bitprec)
Expand Down
18 changes: 9 additions & 9 deletions src/sage/libs/pari/tests.py
Expand Up @@ -1167,13 +1167,13 @@
[0, 1, [1, 0, 0, 0], 1]
sage: e = pari(EllipticCurve('27a3').a_invariants()).ellinit()
sage: e.elllocalred(3)
[3, 2, [1, -1, 0, 1], 1]
[3, 2, [1, 0, 0, 0], 1]
sage: e = pari(EllipticCurve('24a4').a_invariants()).ellinit()
sage: e.elllocalred(2)
[3, 3, [1, 1, 0, 1], 2]
[3, 3, [1, 0, 0, 0], 2]
sage: e = pari(EllipticCurve('20a2').a_invariants()).ellinit()
sage: e.elllocalred(2)
[2, 4, [1, 1, 0, 1], 3]
[2, 4, [1, 0, 0, 0], 3]
sage: e = pari(EllipticCurve('11a2').a_invariants()).ellinit()
sage: e.elllocalred(11)
[1, 5, [1, 0, 0, 0], 1]
Expand All @@ -1185,22 +1185,22 @@
[1, 10, [1, 0, 0, 0], 2]
sage: e = pari(EllipticCurve('32a3').a_invariants()).ellinit()
sage: e.elllocalred(2)
[5, -1, [1, 1, 1, 0], 1]
[5, -1, [1, 0, 0, 0], 1]
sage: e = pari(EllipticCurve('24a5').a_invariants()).ellinit()
sage: e.elllocalred(2)
[3, -2, [1, 2, 1, 4], 1]
[3, -2, [1, 0, 0, 0], 1]
sage: e = pari(EllipticCurve('24a2').a_invariants()).ellinit()
sage: e.elllocalred(2)
[3, -3, [1, 2, 1, 4], 2]
[3, -3, [1, 0, 0, 0], 2]
sage: e = pari(EllipticCurve('20a1').a_invariants()).ellinit()
sage: e.elllocalred(2)
[2, -4, [1, 0, 1, 2], 3]
[2, -4, [1, 0, 0, 0], 3]
sage: e = pari(EllipticCurve('24a1').a_invariants()).ellinit()
sage: e.elllocalred(2)
[3, -5, [1, 0, 1, 2], 4]
[3, -5, [1, 0, 0, 0], 4]
sage: e = pari(EllipticCurve('90c2').a_invariants()).ellinit()
sage: e.elllocalred(3)
[2, -10, [1, 96, 1, 316], 4]
[2, -10, [1, 0, 0, 0], 4]
sage: e = pari([0,1,1,-2,0]).ellinit()
sage: e.elllseries(2.1)
Expand Down
72 changes: 61 additions & 11 deletions src/sage_setup/autogen/pari/doc.py
Expand Up @@ -9,7 +9,8 @@
from six import unichr


leading_ws = re.compile("^ +", re.MULTILINE)
leading_ws = re.compile("^( +)", re.MULTILINE)
trailing_ws = re.compile("( +)$", re.MULTILINE)
double_space = re.compile(" +")

end_space = re.compile(r"(@\[end[a-z]*\])([A-Za-z])")
Expand Down Expand Up @@ -37,7 +38,8 @@
escape_percent = re.compile(r"^(\S.*)[%]", re.MULTILINE)
escape_hash = re.compile(r"^(\S.*)[#]", re.MULTILINE)

label_link = re.compile(r"(Section *)?\[@\[startbold\]Label: *(se:)?([^@]*)@\[endbold\]\]")
label_define = re.compile(r"@\[label [a-zA-Z0-9:]*\]")
label_ref = re.compile(r"(Section *)?@\[startref\](se:)?([^@]*)@\[endref\]")


def sub_loop(regex, repl, text):
Expand Down Expand Up @@ -92,6 +94,10 @@ def raw_to_rest(doc):
Traceback (most recent call last):
...
SyntaxError: @ found: @[invalid]
sage: s = '@3@[startbold]*@[endbold] snip @[dollar]0@[dollar]\ndividing @[dollar]#E@[dollar].'
sage: raw_to_rest(s)
u'- snip :math:`0`\n dividing :math:`\\#E`.'
"""
doc = doc.decode("utf-8")

Expand All @@ -113,8 +119,9 @@ def raw_to_rest(doc):
doc = doc.replace("@[uuml]", "ü")
doc = doc.replace("\\'{a}", "á")

# Remove leading whitespace from every line
# Remove leading and trailing whitespace from every line
doc = leading_ws.sub("", doc)
doc = trailing_ws.sub("", doc)

# Remove multiple spaces
doc = double_space.sub(" ", doc)
Expand All @@ -123,14 +130,19 @@ def raw_to_rest(doc):
# insert a non-breaking space
doc = end_space.sub("\\1" + unichr(0xa0) + "\\2", doc)

# Remove links
doc = label_link.sub("``\\3`` (in the PARI manual)", doc)
# Fix labels and references
doc = label_define.sub("", doc)
doc = label_ref.sub("``\\3`` (in the PARI manual)", doc)

# Bullet items
doc = doc.replace("@3@[startbold]*@[endbold] ", "@BULLET ")
doc = sub_loop(bullet_loop, "\\1 \\3", doc)
doc = doc.replace("@BULLET ", "- ")

# Add =VOID= in front of all leading whitespace (which was
# intentionally added) to avoid confusion with verbatim blocks.
doc = leading_ws.sub(r"=VOID=\1", doc)

# Verbatim blocks
doc = begin_verb.sub("::\n\n@0", doc)
doc = end_verb.sub("", doc)
Expand Down Expand Up @@ -160,6 +172,9 @@ def raw_to_rest(doc):
doc = doc.replace("@[cbr]", "}")
doc = doc.replace("@[startword]", "\\")
doc = doc.replace("@[endword]", "")
# (special rules for Hom and Frob, see trac ticket 21005)
doc = doc.replace("@[startlword]Hom@[endlword]", "\\text{Hom}")
doc = doc.replace("@[startlword]Frob@[endlword]", "\\text{Frob}")
doc = doc.replace("@[startlword]", "\\")
doc = doc.replace("@[endlword]", "")
doc = doc.replace("@[startbi]", "\\mathbb{")
Expand All @@ -184,6 +199,7 @@ def raw_to_rest(doc):
doc = doc.replace("=MID=", r"\|")
doc = doc.replace("=PERCENT=", r"\%")
doc = doc.replace("=HASH=", r"\#")
doc = doc.replace("=VOID=", "")

# Handle DISPLAYMATH
doc = doc.replace("@[endDISPLAYMATH]", "\n\n")
Expand Down Expand Up @@ -238,7 +254,7 @@ def get_raw_doc(function):
sage: from sage_setup.autogen.pari.doc import get_raw_doc
sage: get_raw_doc("cos")
'@[startbold]cos@[dollar](x)@[dollar]:@[endbold]\n\n\n\nCosine of @[dollar]x@[dollar].\n\n\nThe library syntax is @[startcode]GEN @[startbold]gcos@[endbold](GEN x, long prec)@[endcode].\n\n\n'
'@[startbold]cos@[dollar](x)@[dollar]:@[endbold]\n\n@[label se:cos]\nCosine of @[dollar]x@[dollar].\n\n\nThe library syntax is @[startcode]GEN @[startbold]gcos@[endbold](GEN x, long prec)@[endcode].\n\n\n'
sage: get_raw_doc("abcde")
Traceback (most recent call last):
...
Expand Down Expand Up @@ -274,7 +290,7 @@ def get_rest_doc(function):
<BLANKLINE>
.. MATH::
<BLANKLINE>
f(x) = \exp(-i\Pi/24).\eta((x+1)/2)/\eta(x) {such that}
f(x) = \exp(-i\pi/24).\eta((x+1)/2)/\eta(x) {such that}
j = (f^{24}-16)^3/f^{24},
<BLANKLINE>
where :math:`j` is the elliptic :math:`j`-invariant (see the function :literal:`ellj`).
Expand All @@ -294,14 +310,16 @@ def get_rest_doc(function):
<BLANKLINE>
Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \sqrt2`.
::
sage: print(get_rest_doc("ellap"))
Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, defined over
:math:`\mathbb{Q}` or a finite field :math:`\mathbb{F}_q`. The argument :math:`p` is best left omitted if the
curve is defined over a finite field, and must be a prime number otherwise.
This function computes the trace of Frobenius :math:`t` for the elliptic curve :math:`E`,
defined by the equation :math:`\#E(\mathbb{F}_q) = q+1 - t`.
a number field or a finite field :math:`\mathbb{F}_q`. The argument :math:`p` is best left
omitted if the curve is defined over a finite field, and must be a prime
number or a maximal ideal otherwise. This function computes the trace of
Frobenius :math:`t` for the elliptic curve :math:`E`, defined by the equation :math:`\#E(\mathbb{F}_q)
= q+1 - t` (for primes of good reduction).
<BLANKLINE>
When the characteristic of the finite field is large, the availability of
the :literal:`seadata` package will speed the computation.
Expand Down Expand Up @@ -338,6 +356,38 @@ def get_rest_doc(function):
? ellap(E)
%8 = -3
<BLANKLINE>
If the curve is defined over a more general number field than :math:`\mathbb{Q}`,
the maximal ideal :math:`p` must be explicitly given in :literal:`idealprimedec`
format. If :math:`p` is above :math:`2` or :math:`3`, the function currently assumes (without
checking) that the given model is locally minimal at :math:`p`. There is no
restriction at other primes.
<BLANKLINE>
::
<BLANKLINE>
? K = nfinit(a^2+1); E = ellinit([1+a,0,1,0,0], K);
? fa = idealfactor(K, E.disc)
%2 =
[ [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 1]
<BLANKLINE>
[[13, [5, 1]~, 1, 1, [-5, -1; 1, -5]] 2]
? ellap(E, fa[1,1])
%3 = -1 \\ non-split multiplicative reduction
? ellap(E, fa[2,1])
%4 = 1 \\ split multiplicative reduction
? P17 = idealprimedec(K,17)[1];
? ellap(E, P17)
%6 = 6 \\ good reduction
? E2 = ellchangecurve(E, [17,0,0,0]);
? ellap(E2, P17)
%8 = 6 \\ same, starting from a non-miminal model
<BLANKLINE>
? P3 = idealprimedec(K,3)[1];
? E3 = ellchangecurve(E, [3,0,0,0]);
? ellap(E, P3) \\ OK: E is minimal at P3
%11 = -2
? ellap(E3, P3) \\ junk: E3 is not minimal at P3 | 3
%12 = 0
<BLANKLINE>
:strong:`Algorithms used.` If :math:`E/\mathbb{F}_q` has CM by a principal imaginary
quadratic order we use a fast explicit formula (involving essentially
Kronecker symbols and Cornacchia's algorithm), in :math:`O(\log q)^2`.
Expand Down

0 comments on commit d922775

Please sign in to comment.