diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /sci-mathematics/pari/files | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sci-mathematics/pari/files')
16 files changed, 1491 insertions, 0 deletions
diff --git a/sci-mathematics/pari/files/50pari-gentoo.el b/sci-mathematics/pari/files/50pari-gentoo.el new file mode 100644 index 000000000000..2f5b4da9084e --- /dev/null +++ b/sci-mathematics/pari/files/50pari-gentoo.el @@ -0,0 +1,10 @@ + +;; site-init for sci-mathematics/pari + +(add-to-list 'load-path "@SITELISP@") + +(autoload 'gp-mode "pari" nil t) +(autoload 'gp-script-mode "pari" nil t) +(autoload 'gp "pari" nil t) +(autoload 'gpman "pari" nil t) +(add-to-list 'auto-mode-alist '("\\.gp$" . gp-script-mode)) diff --git a/sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch b/sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch new file mode 100644 index 000000000000..e3581c9de349 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch @@ -0,0 +1,11 @@ +diff -Naur pari-2.3.2/config/arch-osname pari-2.3.2.new/config/arch-osname +--- pari-2.3.2/config/arch-osname 2006-02-15 05:12:59.000000000 -0500 ++++ pari-2.3.2.new/config/arch-osname 2007-11-26 00:17:17.000000000 -0500 +@@ -30,6 +30,7 @@ + osf1) case "$5" in alpha) arch=alpha;; esac;; + linux) arch=`uname -m` + case $arch in ++ ppc) arch=powerpc;; + sparc64) arch=sparcv9;; + parisc*) arch=hppa;; + sparc) case "`cat /proc/cpuinfo`" in diff --git a/sci-mathematics/pari/files/pari-2.3.2-strip.patch b/sci-mathematics/pari/files/pari-2.3.2-strip.patch new file mode 100644 index 000000000000..0fee947fd556 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.3.2-strip.patch @@ -0,0 +1,11 @@ +--- config/Makefile.SH. 2007-10-01 23:45:45.000000000 +0200 ++++ config/Makefile.SH 2007-10-01 23:55:10.000000000 +0200 +@@ -208,7 +208,7 @@ + MV = mv -f + LN = $ln_s + CP_F = cp -f +-STRIP = strip ++STRIP = true + STRIPFLAGS = + + # Change these installation directories to suit your needs. diff --git a/sci-mathematics/pari/files/pari-2.3.5-doc-make.patch b/sci-mathematics/pari/files/pari-2.3.5-doc-make.patch new file mode 100644 index 000000000000..67edc8c70f11 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.3.5-doc-make.patch @@ -0,0 +1,46 @@ +--- config/DOC_Make.SH.orig 2010-09-21 21:24:56.655520480 +1200 ++++ config/DOC_Make.SH 2010-09-21 21:26:24.683520242 +1200 +@@ -30,23 +30,23 @@ + -rm -f libpari.std + pdftex libpari + pdftex libpari +- make libpari.std; pdftex libpari; rm -f libpari.std ++ \$(MAKE) libpari.std; pdftex libpari; rm -f libpari.std + libpari.dvi: \$(PARI_TEX) \$(MACROS) + -rm -f libpari.std + tex libpari + tex libpari +- make libpari.std; tex libpari; rm -f libpari.std ++ \$(MAKE) libpari.std; tex libpari; rm -f libpari.std + + develop.pdf: develop.tex \$(MACROS) + -rm -f develop.std + pdftex develop + pdftex develop +- make develop.std; pdftex develop; rm -f develop.std ++ \$(MAKE) develop.std; pdftex develop; rm -f develop.std + develop.dvi: develop.tex \$(MACROS) + -rm -f develop.std + tex develop + tex develop +- make develop.std; tex develop; rm -f develop.std ++ \$(MAKE) develop.std; tex develop; rm -f develop.std + + tutorial.pdf: tutorial.tex \$(MACROS) + -rm -f tutorial.std +@@ -74,13 +74,13 @@ + -rm -f users.std + tex users + tex users +- make users.std; tex users; rm -f users.std ++ \$(MAKE) users.std; tex users; rm -f users.std + + users.pdf: \$(USERS_TEX) + -rm -f users.std + pdftex users + pdftex users +- make users.std; pdftex users; rm -f users.std ++ \$(MAKE) users.std; pdftex users; rm -f users.std + + gpman: gp.1 + nroff -man gp.1 | unix2dos -ascii > gp.man diff --git a/sci-mathematics/pari/files/pari-2.5.0-doc-make.patch b/sci-mathematics/pari/files/pari-2.5.0-doc-make.patch new file mode 100644 index 000000000000..0882da03e6a4 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.0-doc-make.patch @@ -0,0 +1,82 @@ +--- config/DOC_Make.SH.orig 2011-07-28 14:11:34.430896929 +1200 ++++ config/DOC_Make.SH 2011-07-28 14:11:39.832738158 +1200 +@@ -21,7 +21,8 @@ + + doc all: develop.dvi libpari.dvi users.dvi refcard.ps tutorial.dvi + docps: develop.ps libpari.ps refcard.ps tutorial.ps users.ps INSTALL.ps +-docpdf: develop.pdf libpari.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf ++#docpdf: develop.pdf libpari.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf ++docpdf: \$(PARI_TEX) \$(MACROS) pass1 pass2 indexing refcard.pdf INSTALL.pdf + + .SUFFIXES: .tex .ipf .pod .inf .dumbpod .3 .html + +@@ -37,27 +38,49 @@ + %.dvi: %.tex \$(MACROS) + tex \$< + ++pass1: \$(PARI_TEX) \$(USERS_TEX) develop.tex tutorial.tex \$(MACROS) ++ -rm -f *.std ++ pdftex libpari ++ pdftex develop ++ pdftex tutorial ++ pdftex users ++ ++pass2: pass1 ++ pdftex libpari ++ pdftex develop ++ pdftex tutorial ++ pdftex users ++ ++indexing: pass2 ++ \$(MAKE) libpari.std ++ \$(MAKE) develop.std ++ \$(MAKE) users.std ++ pdftex libpari ++ pdftex develop ++ pdftex users ++ -rm -f *.std ++ + libpari.pdf: \$(PARI_TEX) \$(MACROS) + -rm -f libpari.std + pdftex libpari + pdftex libpari +- make libpari.std; pdftex libpari; rm -f libpari.std ++ \$(MAKE) libpari.std; pdftex libpari; rm -f libpari.std + libpari.dvi: \$(PARI_TEX) \$(MACROS) + -rm -f libpari.std + tex libpari + tex libpari +- make libpari.std; tex libpari; rm -f libpari.std ++ \$(MAKE) libpari.std; tex libpari; rm -f libpari.std + + develop.pdf: develop.tex \$(MACROS) + -rm -f develop.std + pdftex develop + pdftex develop +- make develop.std; pdftex develop; rm -f develop.std ++ \$(MAKE)make develop.std; pdftex develop; rm -f develop.std + develop.dvi: develop.tex \$(MACROS) + -rm -f develop.std + tex develop + tex develop +- make develop.std; tex develop; rm -f develop.std ++ \$(MAKE) develop.std; tex develop; rm -f develop.std + + tutorial.pdf: tutorial.tex \$(MACROS) + -rm -f tutorial.std +@@ -85,13 +108,13 @@ + -rm -f users.std + tex users + tex users +- make users.std; tex users; rm -f users.std ++ \$(MAKE) users.std; tex users; rm -f users.std + + users.pdf: \$(USERS_TEX) + -rm -f users.std + pdftex users + pdftex users +- make users.std; pdftex users; rm -f users.std ++ \$(MAKE) users.std; pdftex users; rm -f users.std + + gpman: gp.1 + nroff -man gp.1 | unix2dos -ascii > gp.man diff --git a/sci-mathematics/pari/files/pari-2.5.0-macos.patch b/sci-mathematics/pari/files/pari-2.5.0-macos.patch new file mode 100644 index 000000000000..1b4076009379 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.0-macos.patch @@ -0,0 +1,21 @@ +--- config/get_dlld.orig 2011-07-28 14:27:13.341072367 +1200 ++++ config/get_dlld 2011-07-28 14:27:46.225178023 +1200 +@@ -94,7 +94,7 @@ + *) extra=;; + esac + case "$osname" in +- darwin) shared=-dynamiclib;; ++ darwin) shared="-dynamiclib -install_name \$(PURELIBDIR)/\$(LIBPARI_DYN)";; + *) shared=-shared;; + esac + DLLDFLAGS="$shared $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS" +--- config/Makefile.SH.orig 2011-07-28 14:29:06.753681364 +1200 ++++ config/Makefile.SH 2011-07-28 14:29:10.589276933 +1200 +@@ -234,6 +234,7 @@ + # DESTDIR is used to install to a false hierachy (to build a Debian package) + INCLUDEDIR= "\$(DESTDIR)$includedir" + LIBDIR = "\$(DESTDIR)$libdir" ++PURELIBDIR= $libdir + BINDIR = "\$(DESTDIR)$bindir" + MANDIR = "\$(DESTDIR)$mandir" + DATADIR = "\$(DESTDIR)$datadir" diff --git a/sci-mathematics/pari/files/pari-2.5.0-mp.c.patch b/sci-mathematics/pari/files/pari-2.5.0-mp.c.patch new file mode 100644 index 000000000000..0bcfffc08176 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.0-mp.c.patch @@ -0,0 +1,23 @@ +Index: src/kernel/gmp/mp.c +=================================================================== +--- src/kernel/gmp/mp.c (revision 13151) ++++ src/kernel/gmp/mp.c (working copy) +@@ -45,18 +45,8 @@ + /*We need PARI invmod renamed to invmod_pari*/ + #define INVMOD_PARI + +-static void *gmp_realloc(void *ptr, size_t old_size, size_t new_size) { +- (void)old_size; return (void *) pari_realloc(ptr,new_size); +-} +- +-static void gmp_free(void *ptr, size_t old_size){ +- (void)old_size; pari_free(ptr); +-} +- + int pari_kernel_init(void) + { +- /* Use pari_malloc instead of malloc */ +- mp_set_memory_functions((void *(*)(size_t)) pari_malloc, gmp_realloc, gmp_free); + return 0; + } + diff --git a/sci-mathematics/pari/files/pari-2.5.1-1302.patch b/sci-mathematics/pari/files/pari-2.5.1-1302.patch new file mode 100644 index 000000000000..245e587d275c --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.1-1302.patch @@ -0,0 +1,33 @@ +commit 917b505c86a70dda2191d380861af05becc03858 +Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> +Date: Mon Mar 12 23:54:11 2012 +0100 + + ispower(x < 0,, &n): n could have the wrong sign [#1302] + +diff --git a/src/basemath/arith1.c b/src/basemath/arith1.c +index ded946b..5502ba5 100644 +--- a/src/basemath/arith1.c ++++ b/src/basemath/arith1.c +@@ -1109,6 +1109,7 @@ Z_isanypower(GEN x, GEN *pty) + *pty = gerepileuptoint(av, y); + return k; + } ++ if (pty) togglesign_safe(pty); + } + if (pty) *pty = gerepilecopy(av, *pty); else avma = av; + return k; +diff --git a/src/test/32/ispower b/src/test/32/ispower +index bf4b6f0..84d8de7 100644 +--- a/src/test/32/ispower ++++ b/src/test/32/ispower +@@ -1118,7 +1118,7 @@ + [2, 999] + [6, 10] + [3, -4] +-[3, 2] +-[3, 21218] ++[3, -2] ++[3, -21218] + [3, -1/4] +-Total time spent: 3236 ++Total time spent: 3012 diff --git a/sci-mathematics/pari/files/pari-2.5.1-1304.patch b/sci-mathematics/pari/files/pari-2.5.1-1304.patch new file mode 100644 index 000000000000..3da2e8558dac --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.1-1304.patch @@ -0,0 +1,39 @@ +commit ff707a3f2ba2d5c555434ba50547453833a7570f +Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> +Date: Sun Mar 18 23:54:02 2012 +0100 + + 71- issquarefree(0) => error [#1304] + +diff --git a/src/basemath/ifactor1.c b/src/basemath/ifactor1.c +index 046491f..8f9fbaa 100644 +--- a/src/basemath/ifactor1.c ++++ b/src/basemath/ifactor1.c +@@ -3493,7 +3493,11 @@ moebius(GEN n) + GEN + gissquarefree(GEN x) { return map_proto_lG(issquarefree,x); } + long +-Z_issquarefree(GEN n) { return moebius(n)? 1: 0; } ++Z_issquarefree(GEN n) ++{ ++ if (!signe(n)) return 0; ++ return moebius(n)? 1: 0; ++} + long + issquarefree(GEN x) + { +diff --git a/src/test/32/arith b/src/test/32/arith +new file mode 100644 +index 0000000..3c5981a +--- /dev/null ++++ b/src/test/32/arith +@@ -0,0 +1,2 @@ ++0 ++Total time spent: 8 +diff --git a/src/test/in/arith b/src/test/in/arith +new file mode 100644 +index 0000000..fb92bed +--- /dev/null ++++ b/src/test/in/arith +@@ -0,0 +1,2 @@ ++\\#1304 ++issquarefree(0) diff --git a/sci-mathematics/pari/files/pari-2.5.1-gcc47.patch b/sci-mathematics/pari/files/pari-2.5.1-gcc47.patch new file mode 100644 index 000000000000..e7b27159fa06 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.1-gcc47.patch @@ -0,0 +1,18 @@ +Index: pari-2.5.1/src/basemath/bibli2.c +=================================================================== +--- pari-2.5.1.orig/src/basemath/bibli2.c 2012-01-26 17:26:13.000000000 +0100 ++++ pari-2.5.1/src/basemath/bibli2.c 2012-06-04 10:08:41.000000000 +0200 +@@ -1394,12 +1394,12 @@ + int (*CMP)(void*,GEN,GEN); + int (*cmp)(GEN,GEN) = (flag & cmp_LEX)? &lexcmp: &gcmp; + void *E; ++ struct veccmp_s v; + + if (flag < 0 || flag > (cmp_REV|cmp_LEX|cmp_IND|cmp_UNIQ)) + pari_err(flagerr,"vecsort"); + if (k) { + long i, j, l, lk, tx, lx; +- struct veccmp_s v; + GEN y; + + /* cf init_sort */ diff --git a/sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch b/sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch new file mode 100644 index 000000000000..8fee1f7eaf70 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch @@ -0,0 +1,100 @@ +diff -Nur pari-2.5.1.orig/config/get_config_options pari-2.5.1/config/get_config_options +--- pari-2.5.1.orig/config/get_config_options 2012-08-01 18:32:03.000000000 +0100 ++++ pari-2.5.1/config/get_config_options 2012-08-01 20:57:09.000000000 +0100 +@@ -83,10 +83,12 @@ + --with-ncurses-lib=*|--with-ncurses=*) + with_ncurses_lib=`echo "$1" | sed -e 's/[-a-z]*=//'` ;; + ++ --without-qt|--with-qt=no) without_qt=yes ;; + --with-qt) with_qt=yes ;; + --with-qt=*) + with_qt=`echo "$1" | sed -e 's/[-a-z]*=//'` ;; + ++ --without-fltk|--with-fltk=no) without_fltk=yes ;; + --with-fltk) with_fltk=yes ;; + --with-fltk=*) + with_fltk=`echo "$1" | sed -e 's/[-a-z]*=//'` ;; +@@ -158,7 +160,9 @@ + --with-gmp-lib=DIR specify location of gmp libs + + --with-qt[=DIR] use the Qt graphical library [prefix for Qt dir.] ++ --without-qt do not try to use the Qt lib + --with-fltk[=DIR] use the FLTK graphical library [prefix for FLTK dir.] ++ --without-fltk do not try to use the FLTK lib + + EOT + exit 1 +diff -Nur pari-2.5.1.orig/config/get_fltk pari-2.5.1/config/get_fltk +--- pari-2.5.1.orig/config/get_fltk 2012-08-01 18:32:03.000000000 +0100 ++++ pari-2.5.1/config/get_fltk 2012-08-01 22:28:23.000000000 +0100 +@@ -2,6 +2,9 @@ + with_fltk=yes + fi + FLTKDIR= ++if test -z "$without_fltk; then ++ FLTKDIR="`fltk-config --prefix 2>/dev/null`" ++fi + case "$with_fltk" in + yes) + pth=$libpth; lib=fltk; . ./locatelib +diff -Nur pari-2.5.1.orig/config/get_graphic_lib pari-2.5.1/config/get_graphic_lib +--- pari-2.5.1.orig/config/get_graphic_lib 2012-08-01 18:32:03.000000000 +0100 ++++ pari-2.5.1/config/get_graphic_lib 2012-08-01 22:16:57.000000000 +0100 +@@ -11,6 +11,7 @@ + else + if test -n "$with_fltk"; then which_graphic_lib=fltk; fi + if test -n "$with_qt"; then which_graphic_lib=Qt; fi ++ if test -n "$without_fltk" -a -n "$without_qt"; then which_graphic_lib=none; fi + if test "$which_graphic_lib" != none; then + case $osname in + mingw) case $which_graphic_lib in +@@ -41,7 +42,7 @@ + case $which_graphic_lib in + auto|fltk) + . ./get_fltk # FLTKDIR, FLTK_LIBS +- if test -z "$FLTKDIR"; then ++ if test -z "`fltk-config --ldflags 2> /dev/null`"; then + case $which_graphic_lib in fltk) which_graphic_lib=none;; esac + else + which_graphic_lib=fltk +diff -Nur pari-2.5.1.orig/config/get_Qt pari-2.5.1/config/get_Qt +--- pari-2.5.1.orig/config/get_Qt 2012-08-01 18:32:03.000000000 +0100 ++++ pari-2.5.1/config/get_Qt 2012-08-01 20:39:28.000000000 +0100 +@@ -5,7 +5,7 @@ + case "$with_qt" in + yes) + pth="/usr/local/lib /usr/local/share /usr/lib /usr/share" +- QTDIR=`locatedir qt4/bin $pth` ++ QTDIR=`locatedir qt4 $pth` + QTLIB="-lQtCore -lQtGui" + which_graphic_lib=Qt4 + if test -z "$QTDIR"; then +diff -Nur pari-2.5.1.orig/config/Makefile.SH pari-2.5.1/config/Makefile.SH +--- pari-2.5.1.orig/config/Makefile.SH 2012-08-01 18:32:03.000000000 +0100 ++++ pari-2.5.1/config/Makefile.SH 2012-08-01 21:08:20.000000000 +0100 +@@ -65,12 +65,12 @@ + PLOTLIBS="-L\$(QTDIR)/lib $QTLIB" + graph=plotQt;; + Qt4) +- PLOTCFLAGS='-D__FANCY_WIN__ -I$(QTDIR)/include' +- PLOTLIBS="-L\$(QTDIR)/lib $QTLIB" ++ PLOTCFLAGS='-D__FANCY_WIN__ `pkg-config --cflags QtGui`' ++ PLOTLIBS="`pkg-config --libs QtGui`" + graph=plotQt4;; + fltk) +- PLOTCFLAGS="-I\$(FLTKDIR)/include $X11_INC" +- PLOTLIBS="-L\$(FLTKDIR)/lib -lfltk $FLTK_LIBS" ++ PLOTCFLAGS="`fltk-config --cxxflags` $X11_INC" ++ PLOTLIBS="`fltk-config --ldflags`" + postconfig='-fltk-config --post ' + graph=plotfltk;; + win32) +@@ -254,7 +254,7 @@ + GMPINCLUDE = $GMPINCLUDE + # Graphic library. + QTDIR = "$QTDIR" +-MOC = \$(QTDIR)/bin/moc ++MOC = "`which moc`" + PLOTCFLAGS = $PLOTCFLAGS + PLOTLIBS = $PLOTLIBS + CPLUSPLUS = g++ diff --git a/sci-mathematics/pari/files/pari-2.5.4-polred.patch b/sci-mathematics/pari/files/pari-2.5.4-polred.patch new file mode 100644 index 000000000000..4287c9d35d66 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.4-polred.patch @@ -0,0 +1,754 @@ +diff -ru src/src/basemath/base1.c b/src/basemath/base1.c +--- src/src/basemath/base1.c 2013-05-06 16:01:56.000000000 +0200 ++++ b/src/basemath/base1.c 2013-05-06 16:49:09.042406927 +0200 +@@ -1675,40 +1675,42 @@ + ZX_is_better(GEN y, GEN x, GEN *dx) + { + GEN d = ZX_disc(y); +- long cmp = absi_cmp(d, *dx); ++ int cmp; ++ if (!*dx) *dx = ZX_disc(x); ++ cmp = absi_cmp(d, *dx); + if (cmp < 0) { *dx = d; return 1; } + if (cmp == 0) return cmp_abs_ZX(y, x) < 0; + return 0; + } + +-static GEN polred_aux(nfbasic_t *T, GEN *pro, long flag); ++static void polredbest_aux(nfbasic_t *T, GEN *pro, GEN *px, GEN *pdx, GEN *pa); + /* Seek a simpler, polynomial pol defining the same number field as + * x (assumed to be monic at this point) */ + static GEN + nfpolred(nfbasic_t *T, GEN *pro) + { +- GEN x = T->x, dx = T->dx, a, z, rev, pow, dpow; ++ GEN x = T->x, dx, b, rev, pow, dpow; + long i, n = degpol(x), v = varn(x); + + if (n == 1) { + T->x = deg1pol_shallow(gen_1, gen_m1, v); + *pro = NULL; return pol_1(v); + } +- z = polred_aux(T, pro, nf_ORIG | nf_RED); +- if (typ(z) != t_VEC || !ZX_is_better(gel(z,1),x,&dx)) +- return NULL; /* no improvement */ +- +- rev = QXQ_reverse(gel(z,2), x); +- x = gel(z,1); if (DEBUGLEVEL>1) err_printf("xbest = %Ps\n",x); ++ polredbest_aux(T, pro, &x, &dx, &b); ++ if (x == T->x) return NULL; /* no improvement */ ++ if (DEBUGLEVEL>1) err_printf("xbest = %Ps\n",x); + + /* update T */ ++ rev = QXQ_reverse(b, T->x); + pow = QXQ_powers(rev, n-1, x); + pow = Q_remove_denom(pow, &dpow); +- a = T->bas; +- for (i=2; i<=n; i++) gel(a,i) = QX_ZXQV_eval(gel(a,i), pow, dpow); ++ for (i=2; i<=n; i++) gel(T->bas,i) = QX_ZXQV_eval(gel(T->bas,i), pow, dpow); + (void)Z_issquareall(diviiexact(dx,T->dK), &(T->index)); +- T->basden = get_bas_den(a); +- T->dx = dx; T->x = x; *pro = NULL; return rev; ++ T->basden = get_bas_den(T->bas); ++ T->dx = dx; ++ T->x = x; ++ *pro = NULL; /* reset */ ++ return rev; + } + + /* let bas a t_VEC of QX giving a Z-basis of O_K. Return the index of the +@@ -1776,7 +1778,7 @@ + x = Q_primpart(x); + RgX_check_ZX(x, "nfinit"); + if (!ZX_is_irred(x)) pari_err(redpoler, "nfinit"); +- if (flag & nf_RED || !gequal1(gel(x,lg(x)-1))) ++ if (flag & nf_RED || !equali1(gel(x,lg(x)-1))) + x = ZX_Q_normalize(x, &(T->lead)); + nfmaxord(&S, x, flag, fa); + index = S.index; +@@ -1822,26 +1824,32 @@ + nfinitall(GEN x, long flag, long prec) + { + const pari_sp av = avma; +- GEN nf; ++ GEN nf, lead; + nfbasic_t T; + + nfbasic_init(x, flag, NULL, &T); + nfbasic_add_disc(&T); /* more expensive after set_LLL_basis */ +- if (T.lead != gen_1 && !(flag & nf_RED)) ++ lead = T.lead; ++ if (lead != gen_1 && !(flag & nf_RED)) + { + pari_warn(warner,"non-monic polynomial. Result of the form [nf,c]"); + flag |= nf_RED | nf_ORIG; + } + if (flag & nf_RED) + { +- GEN ro, rev = nfpolred(&T, &ro); ++ GEN ro, rev; ++ /* lie to polred: more efficient to update *after* modreverse, than to ++ * unscale in the polred subsystem */ ++ T.lead = gen_1; ++ rev = nfpolred(&T, &ro); + nf = nfbasic_to_nf(&T, ro, prec); + if (flag & nf_ORIG) + { + if (!rev) rev = pol_x(varn(T.x)); /* no improvement */ +- if (T.lead != gen_1) rev = RgX_Rg_div(rev, T.lead); ++ if (lead != gen_1) rev = RgX_Rg_div(rev, lead); + nf = mkvec2(nf, mkpolmod(rev, T.x)); + } ++ T.lead = lead; /* restore */ + } else { + GEN ro; set_LLL_basis(&T, &ro, 0.99); + nf = nfbasic_to_nf(&T, ro, prec); +@@ -1948,7 +1956,7 @@ + get_polchar(CG_data *d, GEN x) + { return get_pol(d, RgM_RgC_mul(d->ZKembed,x)); } + +-/* return a defining polynomial for Q(w_i) */ ++/* return a defining polynomial for Q(w_k) */ + static GEN + get_polmin_w(CG_data *d, long k) + { +@@ -1956,6 +1964,22 @@ + if (g) (void)ZX_gcd_all(g, ZX_deriv(g), &g); + return g; + } ++/* return a defining polynomial for Q(w_k+w_l) */ ++static GEN ++get_polmin_add2(CG_data *d, long k, long l) ++{ ++ GEN g = get_pol(d, RgV_add(gel(d->ZKembed,k), gel(d->ZKembed,l))); ++ if (g) (void)ZX_gcd_all(g, ZX_deriv(g), &g); ++ return g; ++} ++/* return a defining polynomial for Q(w_k-w_l) */ ++static GEN ++get_polmin_sub2(CG_data *d, long k, long l) ++{ ++ GEN g = get_pol(d, RgV_sub(gel(d->ZKembed,k), gel(d->ZKembed,l))); ++ if (g) (void)ZX_gcd_all(g, ZX_deriv(g), &g); ++ return g; ++} + + /* does x generate the correct field ? */ + static GEN +@@ -2044,13 +2068,67 @@ + d->v = varn(T->x); + d->r1= T->r1; return prec; + } ++static void ++update(GEN *pai, GEN *pch, nfbasic_t *T, long orig) ++{ ++ GEN ch = *pch, ai = *pai; ++ if (!ch) ++ { /* accuracy too low, compute algebraically */ ++ ch = ZXQ_charpoly(ai, T->x, varn(T->x)); ++ (void)ZX_gcd_all(ch, ZX_deriv(ch), &ch); ++ } ++ if (ZX_canon_neg(ch) && orig) ai = RgX_neg(ai); ++ if (DEBUGLEVEL>3) err_printf("polred: generator %Ps\n", ch); ++ if (T->lead != gen_1 && orig) ai = RgX_unscale(ai, ginv(T->lead)); ++ *pch = ch; *pai = ai; ++} ++static GEN ++findmindisc(GEN y, GEN *pa) ++{ ++ GEN a = *pa, x = gel(y,1), b = gel(a,1), dx = NULL; ++ long i, l = lg(y); ++ for (i = 2; i < l; i++) ++ { ++ GEN yi = gel(y,i); ++ if (ZX_is_better(yi,x,&dx)) { x = yi; b = gel(a,i); } ++ } ++ *pa = b; return x; ++} ++/* filter [y,b] from polred_aux: keep a single polynomial of degree n in y ++ * [ the best wrt discriminant ordering ], but keep all non-primitive ++ * polynomials */ ++static void ++filter(GEN y, GEN b, long n) ++{ ++ GEN x, a, dx; ++ long i, k = 1, l = lg(y); ++ a = x = dx = NULL; ++ for (i = 1; i < l; i++) ++ { ++ GEN yi = gel(y,i), ai = gel(b,i); ++ if (degpol(yi) == n) ++ { ++ if (dx && !ZX_is_better(yi,x,&dx)) continue; ++ if (!dx) dx = ZX_disc(yi); ++ x = yi; a = ai; continue; ++ } ++ gel(y,k) = yi; ++ gel(b,k) = ai; k++; ++ } ++ if (dx) ++ { ++ gel(y,k) = x; ++ gel(b,k) = a; k++; ++ } ++ setlg(y, k); ++ setlg(b, k); ++} ++ + static GEN +-polred_aux(nfbasic_t *T, GEN *pro, long flag) ++polred_aux(nfbasic_t *T, GEN *pro, long orig) + { + GEN b, y, x = T->x; +- long i, v = varn(x), l = lg(T->bas); +- const long orig = flag & nf_ORIG; +- const long nfred = flag & nf_RED; ++ long maxi, i, j, k, v = varn(x), n = lg(T->bas)-1; + nffp_t F; + CG_data d; + +@@ -2058,27 +2136,41 @@ + *pro = F.ro; + d.ZKembed = F.M; + +- y = cgetg(l, t_VEC); +- b = cgetg(l, t_COL); ++ /* n + 2 sum_{1 <= i <= n} n-i = n + n(n-1) = n*n */ ++ y = cgetg(n*n + 1, t_VEC); ++ b = cgetg(n*n + 1, t_COL); ++ /* i = 1 */ + gel(y,1) = deg1pol_shallow(gen_1, gen_m1, v); + gel(b,1) = gen_1; +- for (i = 2; i < l; i++) ++ for (i = k = 2; i <= n; i++) + { +- GEN ch, ai = gel(T->bas,i); ++ GEN ch, ai; ++ ai = gel(T->bas,i); + ch = get_polmin_w(&d, i); +- /* if accuracy too low, compute algebraically */ +- if (!ch) ++ update(&ai, &ch, T, orig); ++ gel(y,k) = ch; ++ gel(b,k) = ai; k++; ++ } ++ k = i; ++ maxi = minss(n, 3); ++ for (i = 1; i <= maxi; i++) ++ for (j = i+1; j <= n; j++) + { +- ch = ZXQ_charpoly(ai, x, v); +- (void)ZX_gcd_all(ch, ZX_deriv(ch), &ch); ++ GEN ch, ai; ++ ai = gadd(gel(T->bas,i), gel(T->bas,j)); ++ ch = get_polmin_add2(&d, i, j); ++ update(&ai, &ch, T, orig); ++ gel(y,k) = ch; ++ gel(b,k) = ai; k++; ++ ++ ai = gsub(gel(T->bas,i), gel(T->bas,j)); ++ ch = get_polmin_sub2(&d, i, j); ++ update(&ai, &ch, T, orig); ++ gel(y,k) = ch; ++ gel(b,k) = ai; k++; + } +- if (ZX_canon_neg(ch) && orig) ai = RgX_neg(ai); +- if (nfred && degpol(ch) == l-1) return mkvec2(ch, ai); +- if (DEBUGLEVEL>3) err_printf("polred: generator %Ps\n", ch); +- if (T->lead != gen_1 && orig) ai = RgX_unscale(ai, ginv(T->lead)); +- gel(y,i) = ch; +- gel(b,i) = ai; +- } ++ setlg(y, k); ++ setlg(b, k); filter(y, b, n); + if (!orig) return gen_sort_uniq(y, (void*)cmpii, &gen_cmp_RgX); + (void)sort_factor_pol(mkmat2(y, b), cmpii); + settyp(y, t_COL); return mkmat2(b, y); +@@ -2089,10 +2181,58 @@ + { + pari_sp av = avma; + GEN ro; +- nfbasic_t T; nfbasic_init(x, flag & (nf_PARTIALFACT|nf_RED), fa, &T); ++ nfbasic_t T; nfbasic_init(x, flag & nf_PARTIALFACT, fa, &T); + return gerepilecopy(av, polred_aux(&T, &ro, flag & nf_ORIG)); + } + ++/* finds "best" polynomial in polred_aux list, defaulting to T->x if none of ++ * them is primitive. *px is the ZX, characteristic polynomial of *pb, *pdx ++ * its discriminant. ++ * Set *pro = polroots(T->x) [ NOT *px ], in case caller needs it. */ ++static void ++polredbest_aux(nfbasic_t *T, GEN *pro, GEN *px, GEN *pdx, GEN *pb) ++{ ++ GEN a, v, y, x = T->x, b = pol_x(varn(x)); /* default values */ ++ long i, l, n = degpol(x); ++ v = polred_aux(T, pro, nf_ORIG); ++ *pdx = T->dx; ++ y = gel(v,2); ++ a = gel(v,1); l = lg(a); ++ for (i=1; i<l; i++) ++ { ++ GEN yi = gel(y,i); ++ pari_sp av = avma; ++ if (degpol(yi) == n && ZX_is_better(yi,x,pdx)) { x = yi; b = gel(a,i); } ++ else avma = av; ++ } ++ *px = x; ++ *pb = b; ++} ++GEN ++polredbest(GEN x, long flag) ++{ ++ pari_sp av = avma; ++ GEN dx, ro, b; ++ long fl; ++ nfbasic_t T; ++ switch(flag) ++ { ++ default: pari_err(talker, "invalid flag in polredbest()"); ++ case 0: fl = nf_PARTIALFACT; break; ++ case 1: fl = nf_PARTIALFACT|nf_ORIG; break; ++ } ++ nfbasic_init(x, fl, NULL, &T); ++ polredbest_aux(&T, &ro, &x, &dx, &b); ++ if (flag) ++ { ++ if (x == T.x) ++ b = pol_x(varn(x)); /* no improvement */ ++ else ++ b = QXQ_reverse(b, T.x); ++ x = mkvec2(x, mkpolmod(b,x)); ++ } ++ return gerepilecopy(av, x); ++} + /* FIXME: backward compatibility */ + GEN + polred0(GEN x, long flag, GEN fa) +@@ -2273,22 +2413,6 @@ + return bound; + } + +-static GEN +-findmindisc(GEN y, GEN *pa) +-{ +- GEN a = *pa, x = gel(y,1), b = gel(a,1), dx; +- long i, l = lg(y); +- +- if (l == 2) { *pa = b; return x; } +- dx = ZX_disc(x); +- for (i = 2; i < l; i++) +- { +- GEN yi = gel(y,i); +- if (ZX_is_better(yi,x,&dx)) { x = yi; b = gel(a,i); } +- } +- *pa = b; return x; +-} +- + /* z "small" minimal polynomial of Mod(a,x), deg z = deg x */ + static GEN + store(GEN x, GEN z, GEN a, nfbasic_t *T, long flag, GEN u) +@@ -2355,7 +2479,7 @@ + GEN y, a, u; + nfbasic_t T; + +- nfbasic_init(x, flag & (nf_PARTIALFACT|nf_RED), NULL, &T); ++ nfbasic_init(x, flag & nf_PARTIALFACT, NULL, &T); + x = T.x; vx = varn(x); + + if (degpol(x) == 1) +diff -ru src/src/functions/number_fields/polredabs b/src/functions/number_fields/polredabs +--- src/src/functions/number_fields/polredabs 2013-05-06 16:01:57.000000000 +0200 ++++ b/src/functions/number_fields/polredabs 2013-05-06 16:47:04.542393431 +0200 +@@ -17,8 +17,8 @@ + \misctitle{Warning} This routine uses an exponential-time algorithm to + enumerate all potential generators, and may be exceedingly slow when the + number field has many subfields, hence a lot of elements of small $T_2$-norm. +- E.g. do not try it on the compositum of many quadratic fields; in that case, +- use \tet{polred} instead. ++ The function \tet{polredbest} is in general much faster (it runs in ++ polynomial time), and tends to return polynomials with smaller discriminants. + + The binary digits of $\fl$ mean + +@@ -38,6 +38,15 @@ + (has at most one large prime factor not in the \kbd{addprimes} table), the + result is the same. + ++ \bprog ++ ? T = x^16 - 136*x^14 + 6476*x^12 - 141912*x^10 + 1513334*x^8 - 7453176*x^6 + 13950764*x^4 - 5596840*x^2 + 46225 ++ ? T1 = polredabs(T); T2 = polredbest(T); ++ ? [ norml2(polroots(T1)), norml2(polroots(T2)) ] ++ %3 = [88.0000000, 120.000000] ++ ? [ sizedigit(poldisc(T1)), sizedigit(poldisc(T2)) ] ++ %4 = [75, 67] ++ @eprog ++ + Variant: Instead of the above hardcoded numerical flags, one should use an + or-ed combination of + +diff -ruN src/src/functions/number_fields/polredbest b/src/functions/number_fields/polredbest +--- src/src/functions/number_fields/polredbest 1970-01-01 01:00:00.000000000 +0100 ++++ b/src/functions/number_fields/polredbest 2013-01-31 14:49:05.547513332 +0100 +@@ -0,0 +1,21 @@ ++Function: polredbest ++Section: number_fields ++C-Name: polredbest ++Prototype: GD0,L, ++Help: polredbest(T,{flag=0}): reduction of the polynomial T (gives minimal ++ polynomials only). If flag=1, gives also elements. ++Doc: finds a polynomial with reasonably ++ small coefficients defining the same number field as $T$. ++ All $T$ accepted by \tet{nfinit} are also allowed here (e.g. non-monic ++ polynomials, \kbd{nf}, \kbd{bnf}, \kbd{[T,Z\_K\_basis]}). Contrary to ++ \tet{polredabs}, this routine runs in polynomial time, but it offers no ++ guarantee as to the minimality of its result. ++ ++ If $\fl = 1$: outputs a two-component row vector $[P,a]$, where $P$ is the ++ default output and \kbd{Mod(a, P)} is a root of the original $T$. ++ \bprog ++ ? polredbest(x^4 + 8, 1) ++ %1 = [x^4 + 2, Mod(x^3, x^4 + 2)] ++ ? charpoly(%[2]) ++ %2 = x^4 + 8 ++ @eprog +diff -ruN src/src/headers/paridecl.h b/src/headers/paridecl.h +--- src/src/headers/paridecl.h 2012-09-25 23:10:47.000000000 +0200 ++++ b/src/headers/paridecl.h 2013-01-31 14:49:05.557525771 +0100 +@@ -889,6 +889,7 @@ + GEN polredabs0(GEN x, long flag); + GEN polredabs2(GEN x); + GEN polredabsall(GEN x, long flun); ++GEN polredbest(GEN x, long flag); + GEN smallpolred(GEN x); + GEN smallpolred2(GEN x); + GEN tschirnhaus(GEN x); +diff -ru src/src/test/32/compat b/src/test/32/compat +--- src/src/test/32/compat 2013-05-06 16:01:57.000000000 +0200 ++++ b/src/test/32/compat 2013-05-06 16:47:04.542393431 +0200 +@@ -787,13 +787,9 @@ + ? factoreddiscf(p,fa) + 136866601 + ? factoredpolred(p,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? factoredpolred2(p,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? factornf(x^3+x^2-2*x-1,t^3+t^2-2*t-1) + + [x + mod(-t, t^3 + t^2 - 2*t - 1) 1] +@@ -904,7 +900,7 @@ + ? gcd(12345678,87654321) + 9 + ? getheap() +-[208, 45748] ++[208, 45584] + ? getrand() + Vecsmall([1220248512, -582244995, 485580680, -1643185972, -2103930341, -9694 + 07356, 336208700, 1439513079, -1910826353, -2042699820, 222745475, 183991374 +@@ -2014,7 +2010,7 @@ + ? orderell(tcurve,[1,2]) + 6 + ? ordred(x^3-12*x+45*x-1) +-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1] ++[x - 1, x^3 + 33*x - 1] + ? padicprec(padicno,127) + 5 + ? pascal(8) +@@ -2093,15 +2089,16 @@ + ? polint([0,2,3],[0,4,9],5) + 25 + ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568) +-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x +-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8] ++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1] + ? polred2(x^4-28*x^3-458*x^2+9156*x-25321) + + [1 x - 1] + +-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] ++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9] ++ ++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9] + +-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6] ++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] + + [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6] + +@@ -2454,13 +2451,21 @@ + ? smallinitell([0,0,0,-17,0]) + [0, 0, 0, -17, 0, 0, -34, 0, -289, 816, 0, 314432, 1728] + ? smallpolred(x^4+576) +-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] ++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] + ? smallpolred2(x^4+576) + + [1 x - 1] + ++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3] ++ ++[1/24*x^2 + 1 x^2 - 2*x + 2] ++ ++[-1/24*x^2 + 1 x^2 - 2*x + 2] ++ + [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1] + ++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1] ++ + [1/24*x^2 x^2 + 1] + + [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1] +@@ -2650,6 +2655,6 @@ + ? getstack() + 104 + ? getheap() +-[599, 110982] ++[599, 110954] + ? print("Total time spent: ",gettime); +-Total time spent: 236 ++Total time spent: 140 +diff -ru src/src/test/32/nfields b/src/test/32/nfields +--- src/src/test/32/nfields 2013-05-06 16:01:57.000000000 +0200 ++++ b/src/test/32/nfields 2013-05-06 16:47:04.542393431 +0200 +@@ -926,45 +926,50 @@ + ? polgalois(x^6-3*x^2-1) + [12, 1, 1, "A_4(6) = [2^2]3"] + ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568) +-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x +-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8] ++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1] + ? polred(x^4-28*x^3-458*x^2+9156*x-25321,3) + + [1 x - 1] + +-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] ++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9] ++ ++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9] + +-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6] ++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] + + [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6] + + ? polred(x^4+576,1) +-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] ++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] + ? polred(x^4+576,3) + + [1 x - 1] + ++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3] ++ ++[1/24*x^2 + 1 x^2 - 2*x + 2] ++ ++[-1/24*x^2 + 1 x^2 - 2*x + 2] ++ + [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1] + ++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1] ++ + [1/24*x^2 x^2 + 1] + + [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1] + + ? polred(p2,0,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? polred(p2,1,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568) + x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1 + ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568,1) + [x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1, Mod(2*x^4 - x^3 + 3*x^2 - 3*x - 1, x^5 - + x^4 + 2*x^3 - 4*x^2 + x - 1)] + ? polredord(x^3-12*x+45*x-1) +-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1] ++[x - 1, x^3 + 33*x - 1] + ? polsubcyclo(31,5) + x^5 + x^4 - 12*x^3 - 21*x^2 + x + 5 + ? setrand(1);poltschirnhaus(x^5-x-1) +@@ -1028,6 +1033,6 @@ + ? sizebyte(%) + 152 + ? getheap +-[175, 113027] ++[175, 112999] + ? print("Total time spent: ",gettime); +-Total time spent: 116 ++Total time spent: 76 +diff -ru src/src/test/64/compat b/src/test/64/compat +--- src/src/test/64/compat 2013-05-06 16:01:58.000000000 +0200 ++++ b/src/test/64/compat 2013-05-06 16:47:04.542393431 +0200 +@@ -789,13 +789,9 @@ + ? factoreddiscf(p,fa) + 136866601 + ? factoredpolred(p,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? factoredpolred2(p,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? factornf(x^3+x^2-2*x-1,t^3+t^2-2*t-1) + + [x + mod(-t, t^3 + t^2 - 2*t - 1) 1] +@@ -906,7 +902,7 @@ + ? gcd(12345678,87654321) + 9 + ? getheap() +-[208, 44472] ++[208, 44308] + ? getrand() + Vecsmall([-696235626332558091, -7363039021536514678, -3123062006620239999, - + 2510915082749224356, -5278885121447018503, 8033304491650294704, 333461878925 +@@ -2014,7 +2010,7 @@ + ? orderell(tcurve,[1,2]) + 6 + ? ordred(x^3-12*x+45*x-1) +-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1] ++[x - 1, x^3 + 33*x - 1] + ? padicprec(padicno,127) + 5 + ? pascal(8) +@@ -2093,15 +2089,16 @@ + ? polint([0,2,3],[0,4,9],5) + 25 + ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568) +-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x +-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8] ++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1] + ? polred2(x^4-28*x^3-458*x^2+9156*x-25321) + + [1 x - 1] + +-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] ++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9] ++ ++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9] + +-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6] ++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] + + [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6] + +@@ -2454,13 +2451,21 @@ + ? smallinitell([0,0,0,-17,0]) + [0, 0, 0, -17, 0, 0, -34, 0, -289, 816, 0, 314432, 1728] + ? smallpolred(x^4+576) +-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] ++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] + ? smallpolred2(x^4+576) + + [1 x - 1] + ++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3] ++ ++[1/24*x^2 + 1 x^2 - 2*x + 2] ++ ++[-1/24*x^2 + 1 x^2 - 2*x + 2] ++ + [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1] + ++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1] ++ + [1/24*x^2 x^2 + 1] + + [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1] +@@ -2649,6 +2654,6 @@ + ? getstack() + 200 + ? getheap() +-[599, 100048] ++[599, 100020] + ? print("Total time spent: ",gettime); +-Total time spent: 152 ++Total time spent: 180 +diff -ru src/src/test/64/nfields b/src/test/64/nfields +--- src/src/test/64/nfields 2013-05-06 16:01:58.000000000 +0200 ++++ b/src/test/64/nfields 2013-05-06 16:47:04.542393431 +0200 +@@ -928,45 +928,50 @@ + ? polgalois(x^6-3*x^2-1) + [12, 1, 1, "A_4(6) = [2^2]3"] + ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568) +-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x +-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8] ++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1] + ? polred(x^4-28*x^3-458*x^2+9156*x-25321,3) + + [1 x - 1] + +-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] ++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9] ++ ++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9] + +-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6] ++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10] + + [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6] + + ? polred(x^4+576,1) +-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] ++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1] + ? polred(x^4+576,3) + + [1 x - 1] + ++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3] ++ ++[1/24*x^2 + 1 x^2 - 2*x + 2] ++ ++[-1/24*x^2 + 1 x^2 - 2*x + 2] ++ + [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1] + ++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1] ++ + [1/24*x^2 x^2 + 1] + + [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1] + + ? polred(p2,0,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? polred(p2,1,fa) +-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46 +-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52 +-*x^3 - 197*x^2 - 273*x - 127] ++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671] + ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568) + x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1 + ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568,1) + [x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1, Mod(2*x^4 - x^3 + 3*x^2 - 3*x - 1, x^5 - + x^4 + 2*x^3 - 4*x^2 + x - 1)] + ? polredord(x^3-12*x+45*x-1) +-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1] ++[x - 1, x^3 + 33*x - 1] + ? polsubcyclo(31,5) + x^5 + x^4 - 12*x^3 - 21*x^2 + x + 5 + ? setrand(1);poltschirnhaus(x^5-x-1) +@@ -1030,6 +1035,6 @@ + ? sizebyte(%) + 288 + ? getheap +-[175, 102929] ++[175, 102901] + ? print("Total time spent: ",gettime); +-Total time spent: 84 ++Total time spent: 110 diff --git a/sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch b/sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch new file mode 100644 index 000000000000..14833da62709 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch @@ -0,0 +1,100 @@ +diff -ru src/src/basemath/alglin1.c b/src/basemath/alglin1.c +--- src/src/basemath/alglin1.c 2012-09-25 23:10:46.000000000 +0200 ++++ b/src/basemath/alglin1.c 2013-01-03 13:56:55.487513420 +0100 +@@ -2969,6 +2969,21 @@ + return NULL; /* not reached */ + } + ++/* A a 2x2 matrix ++ returns the determinant of A computed by the simple formula ++*/ ++static GEN ++det2x2(GEN A) ++{ ++ pari_sp av = avma; ++ GEN a = gcoeff(A, 1, 1), ++ b = gcoeff(A, 1, 2), ++ c = gcoeff(A, 2, 1), ++ d = gcoeff(A, 2, 2); ++ return gerepileupto(av, gsub(gmul(a, d), gmul(b, c))); ++} ++ ++ + static GEN + det_simple_gauss(GEN a, GEN data, pivot_fun pivot) + { +@@ -3021,6 +3036,7 @@ + if (typ(a)!=t_MAT) pari_err(mattype1,"det2"); + if (!nbco) return gen_1; + if (nbco != lg(a[1])-1) pari_err(mattype1,"det2"); ++ if (nbco == 2) return det2x2 (a); + pivot = get_pivot_fun(a, &data); + return det_simple_gauss(a, data, pivot); + } +@@ -3158,11 +3174,7 @@ + { + case 0: return gen_1; + case 1: return gcopy(gcoeff(M,1,1)); +- case 2: { +- GEN a = gcoeff(M,1,1), b = gcoeff(M,1,2); +- GEN c = gcoeff(M,2,1), d = gcoeff(M,2,2); +- return gerepileupto(av, gsub(gmul(a,d), gmul(b,c))); +- } ++ case 2: return det2x2(M); + } + if (max > ((n+2)>>1)) max = (n+2)>>1; + for (j = 1; j <= n; j++) +@@ -3193,9 +3205,10 @@ + } + if (best_row) + { ++ double d = lbest-1; + GEN s = NULL; + long k; +- bound /= (lbest-1); ++ bound /= d*d*d; + for (k = 1; k < lbest; k++) + { + GEN c = coeff_det(M, best_row, best[k], max, bound); +@@ -3205,9 +3218,10 @@ + } + if (best_col) + { ++ double d = lbest-1; + GEN s = NULL; + long k; +- bound /= (lbest-1); ++ bound /= d*d*d; + for (k = 1; k < lbest; k++) + { + GEN c = coeff_det(M, best[k], best_col, max, bound); +@@ -3230,15 +3244,24 @@ + if (!n) return gen_1; + if (n != lg(a[1])-1) pari_err(mattype1,"det"); + if (n == 1) return gcopy(gcoeff(a,1,1)); +- if (RgM_is_FpM(a, &p) && p) ++ if (RgM_is_FpM(a, &p)) + { +- pari_sp av = avma; +- return gerepilecopy(av, Fp_to_mod(FpM_det(RgM_to_FpM(a, p), p), p)); ++ pari_sp av; ++ if (!p) ++ { /* ZM */ ++ return det_simple_gauss(a, NULL, &gauss_get_pivot_NZ); ++ } ++ else ++ { /* FpM */ ++ av = avma; ++ return gerepilecopy(av, Fp_to_mod(FpM_det(RgM_to_FpM(a, p), p), p)); ++ } + } ++ if (n == 2) return det2x2 (a); + pivot = get_pivot_fun(a, &data); + if (pivot != gauss_get_pivot_NZ) return det_simple_gauss(a, data, pivot); +- B = (double)n; B = B*B; B = B*B; +- return det_develop(a, 7, B); ++ B = (double)n; ++ return det_develop(a, 7, B*B*B); + } + + diff --git a/sci-mathematics/pari/files/pari-2.7.0-doc-make.patch b/sci-mathematics/pari/files/pari-2.7.0-doc-make.patch new file mode 100644 index 000000000000..4292688d97af --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.7.0-doc-make.patch @@ -0,0 +1,89 @@ +diff -Naur pari-2.7.0/config/DOC_Make.SH pari-2.7.0_a/config/DOC_Make.SH +--- pari-2.7.0/config/DOC_Make.SH 2014-03-20 21:59:28.000000000 +1300 ++++ pari-2.7.0_a/config/DOC_Make.SH 2014-05-05 13:20:09.119923587 +1200 +@@ -23,7 +23,8 @@ + + doc all: develop.dvi libpari.dvi parallel.dvi users.dvi refcard.ps tutorial.dvi + docps: develop.ps libpari.ps parallel.ps refcard.ps tutorial.ps users.ps INSTALL.ps +-docpdf: develop.pdf libpari.pdf parallel.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf ++#docpdf: develop.pdf libpari.pdf parallel.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf ++docpdf: \$(PARI_TEX) \$(MACROS) pass1 pass2 indexing refcard.pdf INSTALL.pdf + + .SUFFIXES: .tex .ipf .pod .inf .dumbpod .3 .html + +@@ -39,38 +40,60 @@ + %.dvi: %.tex \$(MACROS) + \$(TEX) \$< + ++pass1: \$(PARI_TEX) \$(USERS_TEX) develop.tex tutorial.tex \$(MACROS) ++ -rm -f *.std ++ pdftex libpari ++ pdftex develop ++ pdftex tutorial ++ pdftex users ++ ++pass2: pass1 ++ pdftex libpari ++ pdftex develop ++ pdftex tutorial ++ pdftex users ++ ++indexing: pass2 ++ \$(MAKE) libpari.std ++ \$(MAKE) develop.std ++ \$(MAKE) users.std ++ pdftex libpari ++ pdftex develop ++ pdftex users ++ -rm -f *.std ++ + libpari.pdf: \$(PARI_TEX) \$(MACROS) + -rm -f libpari.std + \$(PDFTEX) libpari + \$(PDFTEX) libpari +- make libpari.std; \$(PDFTEX) libpari; rm -f libpari.std ++ \$(MAKE) libpari.std; \$(PDFTEX) libpari; rm -f libpari.std + libpari.dvi: \$(PARI_TEX) \$(MACROS) + -rm -f libpari.std + \$(TEX) libpari + \$(TEX) libpari +- make libpari.std; \$(TEX) libpari; rm -f libpari.std ++ \$(MAKE) libpari.std; \$(TEX) libpari; rm -f libpari.std + + develop.pdf: develop.tex \$(MACROS) + -rm -f develop.std + \$(PDFTEX) develop + \$(PDFTEX) develop +- make develop.std; \$(PDFTEX) develop; rm -f develop.std ++ \$(MAKE) develop.std; \$(PDFTEX) develop; rm -f develop.std + develop.dvi: develop.tex \$(MACROS) + -rm -f develop.std + \$(TEX) develop + \$(TEX) develop +- make develop.std; \$(TEX) develop; rm -f develop.std ++ \$(MAKE) develop.std; \$(TEX) develop; rm -f develop.std + + parallel.pdf: parallel.tex \$(MACROS) + -rm -f parallel.std + \$(PDFTEX) parallel + \$(PDFTEX) parallel +- make parallel.std; \$(PDFTEX) parallel; rm -f parallel.std ++ \$(MAKE) parallel.std; \$(PDFTEX) parallel; rm -f parallel.std + parallel.dvi: parallel.tex \$(MACROS) + -rm -f parallel.std + \$(TEX) parallel + \$(TEX) parallel +- make parallel.std; \$(TEX) parallel; rm -f parallel.std ++ \$(MAKE) parallel.std; \$(TEX) parallel; rm -f parallel.std + + tutorial.pdf: tutorial.tex \$(MACROS) + -rm -f tutorial.std +@@ -104,7 +127,7 @@ + -rm -f users.std + \$(PDFTEX) users + \$(PDFTEX) users +- make users.std; \$(PDFTEX) users; rm -f users.std ++ \$(MAKE) users.std; \$(PDFTEX) users; rm -f users.std + + gpman: gp.1 + nroff -man gp.1 | unix2dos -ascii > gp.man diff --git a/sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch b/sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch new file mode 100644 index 000000000000..2d77f19f9f54 --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch @@ -0,0 +1,100 @@ +diff -Naur pari-2.7.0/config/Makefile.SH pari-2.7.0_a/config/Makefile.SH +--- pari-2.7.0/config/Makefile.SH 2014-03-20 21:59:28.000000000 +1300 ++++ pari-2.7.0_a/config/Makefile.SH 2014-05-05 12:00:21.095724368 +1200 +@@ -75,12 +75,12 @@ + PLOTLIBS="-L\$(QTDIR)/lib $QTLIB" + graph=plotQt;; + Qt4) +- PLOTCFLAGS='-D__FANCY_WIN__ -I$(QTDIR)/include' +- PLOTLIBS="-L\$(QTDIR)/lib $QTLIB" ++ PLOTCFLAGS='-D__FANCY_WIN__ `pkg-config --cflags QtGui`' ++ PLOTLIBS="`pkg-config --libs QtGui`" + graph=plotQt4;; + fltk) +- PLOTCFLAGS="-I\$(FLTKDIR)/include $X11_INC" +- PLOTLIBS="$FLTK_LIBS" ++ PLOTCFLAGS="`fltk-config --cxxflags` $X11_INC" ++ PLOTLIBS="`fltk-config --ldflags`" + postconfig='fltk-config --post ' + graph=plotfltk;; + win32) +@@ -269,7 +269,7 @@ + GMPINCLUDE = $GMPINCLUDE + # Graphic library. + QTDIR = "$QTDIR" +-MOC = \$(QTDIR)/bin/moc ++MOC = "`which moc`" + PLOTCFLAGS = $PLOTCFLAGS + PLOTLIBS = $PLOTLIBS + CPLUSPLUS = g++ +diff -Naur pari-2.7.0/config/get_Qt pari-2.7.0_a/config/get_Qt +--- pari-2.7.0/config/get_Qt 2014-03-20 21:59:28.000000000 +1300 ++++ pari-2.7.0_a/config/get_Qt 2014-05-05 11:56:42.453465262 +1200 +@@ -5,7 +5,7 @@ + case "$with_qt" in + yes) + pth="/usr/local/lib /usr/local/share /usr/lib /usr/share" +- QTDIR=`locatedir qt4/bin $pth` ++ QTDIR=`locatedir qt4 $pth` + if test -n "$QTDIR"; then + QTLIB="-lQtCore -lQtGui" + which_graphic_lib=Qt4 +diff -Naur pari-2.7.0/config/get_config_options pari-2.7.0_a/config/get_config_options +--- pari-2.7.0/config/get_config_options 2014-03-20 21:59:28.000000000 +1300 ++++ pari-2.7.0_a/config/get_config_options 2014-05-05 11:49:14.577963840 +1200 +@@ -85,10 +85,12 @@ + --with-ncurses-lib=*|--with-ncurses=*) + with_ncurses_lib=`echo "$1" | sed -e 's/[-a-z]*=//'` ;; + ++ --without-qt|--with-qt=no) without_qt=yes ;; + --with-qt) with_qt=yes ;; + --with-qt=*) + with_qt=`echo "$1" | sed -e 's/[-a-z]*=//'` ;; + ++ --without-fltk|--with-fltk=no) without_fltk=yes ;; + --with-fltk) with_fltk=yes ;; + --with-fltk=*) + with_fltk=`echo "$1" | sed -e 's/[-a-z]*=//'` ;; +@@ -164,7 +166,9 @@ + --with-gmp-lib=DIR specify location of gmp libs + + --with-qt[=DIR] use the Qt graphical library [prefix for Qt dir.] ++ --without-qt do not try to use the Qt lib + --with-fltk[=DIR] use the FLTK graphical library [prefix for FLTK dir.] ++ --without-fltk do not try to use the FLTK lib + + Environment variables affecting the build: + CC C compiler +diff -Naur pari-2.7.0/config/get_fltk pari-2.7.0_a/config/get_fltk +--- pari-2.7.0/config/get_fltk 2014-03-20 21:59:28.000000000 +1300 ++++ pari-2.7.0_a/config/get_fltk 2014-05-05 11:49:14.578963841 +1200 +@@ -2,6 +2,9 @@ + with_fltk=yes + fi + FLTKDIR= ++if test -z "$without_fltk; then ++ FLTKDIR="`fltk-config --prefix 2>/dev/null`" ++fi + case "$with_fltk" in + yes) + pth=$libpth; lib=fltk; . ./locatelib +diff -Naur pari-2.7.0/config/get_graphic_lib pari-2.7.0_a/config/get_graphic_lib +--- pari-2.7.0/config/get_graphic_lib 2014-03-20 21:59:28.000000000 +1300 ++++ pari-2.7.0_a/config/get_graphic_lib 2014-05-05 11:54:45.469333702 +1200 +@@ -7,6 +7,7 @@ + + if test -n "$with_fltk"; then which_graphic_lib=fltk; fi + if test -n "$with_qt"; then which_graphic_lib=Qt; fi ++if test -n "$without_fltk" -a -n "$without_qt"; then which_graphic_lib=none; fi + if test "$fastread" != yes; then + cat << EOT + ========================================================================== +@@ -38,7 +39,7 @@ + case $osname in + darwin) ;; # fltk brings in CoreFoundation, incompatible with pari_daemon + *). ./get_fltk # FLTKDIR, FLTK_LIBS ;; +- if test -z "$FLTKDIR"; then ++ if test -z "`fltk-config --ldflags 2> /dev/null`"; then + case $which_graphic_lib in fltk) which_graphic_lib=none;; esac + else + which_graphic_lib=fltk diff --git a/sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch b/sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch new file mode 100644 index 000000000000..814dc4b2ab9d --- /dev/null +++ b/sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch @@ -0,0 +1,54 @@ +diff -ru src/src/basemath/alglin1.c b/src/basemath/alglin1.c +--- src/src/basemath/alglin1.c 2014-01-29 18:00:27.000000000 +0100 ++++ b/src/basemath/alglin1.c 2014-02-09 01:54:37.676725196 +0100 +@@ -247,6 +247,7 @@ + a = RgM_shallowcopy(a); + for (i=1; i<nbco; i++) + { ++ int garbage = 0; /* Only gerepile() once per loop iteration */ + for(k=i; k<=nbco; k++) + { + gcoeff(a,k,i) = ff->red(E,gcoeff(a,k,i)); +@@ -271,7 +272,7 @@ + for (j=i+1; j<=nbco; j++) + { + gcoeff(a,j,k) = ff->add(E, gcoeff(a,j,k), ff->mul(E,m,gcoeff(a,j,i))); +- if (low_stack(lim, stack_lim(av,1))) ++ if (low_stack(lim, stack_lim(av,1)) && (garbage++ == 0)) + { + if(DEBUGMEM>1) pari_warn(warnmem,"det. col = %ld",i); + gerepileall(av,4, &a,&x,&q,&m); +@@ -3721,6 +3722,7 @@ + a = RgM_shallowcopy(a); + for (i=1; i<nbco; i++) + { ++ int garbage = 0; /* Only gerepile() once per loop iteration */ + k = pivot(a, data, i, NULL); + if (k > nbco) return gerepilecopy(av, gcoeff(a,i,i)); + if (k != i) +@@ -3740,7 +3742,7 @@ + for (j=i+1; j<=nbco; j++) + { + gcoeff(a,j,k) = gsub(gcoeff(a,j,k), gmul(m,gcoeff(a,j,i))); +- if (low_stack(lim, stack_lim(av,3))) ++ if (low_stack(lim, stack_lim(av,3)) && (garbage++ == 0)) + { + if(DEBUGMEM>1) pari_warn(warnmem,"det. col = %ld",i); + gerepileall(av,2, &a,&x); +@@ -3791,6 +3793,7 @@ + { + GEN ci, ck, m; + int diveuc = (gequal1(pprec)==0); ++ int garbage = 0; /* Only gerepile() once per loop iteration */ + + p = gcoeff(a,i,i); + if (gequal0(p)) +@@ -3827,7 +3830,7 @@ + GEN p1 = gsub(gmul(p,gel(ck,j)), gmul(m,gel(ci,j))); + if (diveuc) p1 = mydiv(p1,pprec); + gel(ck,j) = gerepileupto(av2, p1); +- if (low_stack(lim,stack_lim(av,2))) ++ if (low_stack(lim,stack_lim(av,2)) && (garbage++ == 0)) + { + if(DEBUGMEM>1) pari_warn(warnmem,"det. col = %ld",i); + gerepileall(av,2, &a,&pprec); |