Skip to content

Test multiple PARI versions #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .travis-install-pari.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Helper script to install PARI for Travis CI

# Exit on error
set -e

PARI_URL="http://pari.math.u-bordeaux.fr/pub/pari/$URLDIR"

# Figure out PARI version and download location
# Note that we support giving a list of URLs
if [ "$PARI_VERSION" = snapshot ]; then
PARI_VERSION=$(wget -qO- "$PARI_URL" | sed -n 's/.*href="\(pari-.*-g.*\)[.]tar[.]gz".*/\1/p')
fi

# Download PARI sources
wget --no-verbose "$PARI_URL/$PARI_VERSION.tar.gz"

# Install
tar xzf "$PARI_VERSION.tar.gz"
cd "$PARI_VERSION"
./Configure --prefix=/usr
make gp
sudo make install
30 changes: 16 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@ python:
- "3.4"
- "3.5"
- "3.6"
# non python dependencies
env:
- PARI_VERSION=pari-2.8.1.beta
URLDIR=unstable
- PARI_VERSION=pari-2.9.3
URLDIR=unix
- PARI_VERSION=snapshot
URLDIR=snapshots

before_install:
- sudo apt-get -qq update
- wget http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-2.9.3.tar.gz
- tar xf pari-2.9.3.tar.gz
- cd pari-2.9.3/
- ./Configure --prefix=/usr/
- make gp
- sudo make install
- cd ..
# command to install dependencies
install:
- pip install --verbose Cython
- pip install --verbose cysignals
- pip install --verbose Sphinx
- export PATH="/usr/lib/ccache:$PATH"
- ccache -M 256M && ccache -s
install:
- bash -x .travis-install-pari.sh
- pip install --build=/tmp/pip --verbose -r requirements.txt
- pip install --verbose .
# command to run tests
script:
- python tests/rundoctest.py
- (cd docs && make html)
cache:
directories:
- $HOME/.ccache
30 changes: 6 additions & 24 deletions cypari2/gen.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,6 @@ cdef class Gen(Gen_auto):
def polred(self, *args, **kwds):
r'''
This function is :emphasis:`deprecated`, use :meth:`.polredbest` instead.

Tests:

>>> from cypari2 import Pari
>>> pari = Pari()

>>> pari('x^4 + 8').polred(2)
[1, x - 1; 1/2*x^2 + 1, x^2 - 2*x + 3; -1/2*x^2 + 1, x^2 - 2*x + 3; 1/2*x^2, x^2 + 2; 1/4*x^3, x^4 + 2]
'''
import warnings
with warnings.catch_warnings():
Expand Down Expand Up @@ -2899,12 +2891,10 @@ cdef class Gen(Gen_auto):
>>> pari(1.0).sizeword() == (4 if bitness == '32' else 3)
True

>>> pari('x').sizeword()
9
>>> pari('x^20').sizeword()
66
>>> pari('[x, I]').sizeword()
20
>>> pari('x + 1').sizeword()
10
>>> pari('[x + 1, 1]').sizeword()
16
"""
return gsizeword(x.g)

Expand Down Expand Up @@ -4504,14 +4494,6 @@ cdef class Gen(Gen_auto):
Traceback (most recent call last):
...
PariError: incorrect type in boundfact (t_POL)

PARI doesn't have an algorithm for factoring multivariate
polynomials:

>>> pari('x^3 - y^3').factor()
Traceback (most recent call last):
...
PariError: sorry, factor for general polynomials is not yet implemented
"""
cdef GEN g
global factor_proven
Expand Down Expand Up @@ -4816,13 +4798,13 @@ cdef class Gen(Gen_auto):
>>> from cypari2 import Pari
>>> pari = Pari()

>>> pari('[1/2, 1.0*I]').debug()
>>> pari('[1/2, 1 + 1.0*I]').debug()
[&=...] VEC(lg=3):...
1st component = [&=...] FRAC(lg=3):...
num = [&=...] INT(lg=3):... (+,lgefint=3):...
den = [&=...] INT(lg=3):... (+,lgefint=3):...
2nd component = [&=...] COMPLEX(lg=3):...
real = [&=...] INT(lg=2):... (0,lgefint=2):...
real = [&=...] INT(lg=3):... (+,lgefint=3):...
imag = [&=...] REAL(lg=3):... (+,expo=0):...
"""
sig_on()
Expand Down