Ticket #11130: 11130_spkg.diff
File 11130_spkg.diff, 39.2 KB (added by , 11 years ago) |
---|
-
SPKG.txt
diff -r 4b9a7ea1dd3f SPKG.txt
a b 42 42 in the script spkg-make. Normally, the following should work. In case 43 43 of doubt, have a look at the file spkg-make. 44 44 45 0) Edit the line "svn update -r 1 2623" in spkg-make and set the45 0) Edit the line "svn update -r 13228" in spkg-make and set the 46 46 desired SVN version. 47 47 48 48 1) ./spkg-make … … 80 80 81 81 == Changelog == 82 82 83 === pari-2.5.0.p2 (Jeroen Demeyer, 26 July 2011) === 84 * Ticket #11130: update to PARI stable version 2.5.0, which is 85 equal to svn version 13228. 86 * Moving to this upstream version fixes #10195, #10767, #11604. 87 * Remove all previous upstream patches. 88 * Add current working directory "." to default path in gprc.expect. 89 * Add patches osx_13318_13330.patch from upstream to fix linking on 90 Mac OS X. 91 83 92 === pari-2.4.3.alpha.p7 (Leif Leonhardy, July 16th, 2011) === 84 93 * #11605: Fix typo in spkg-install and add `exit 1` (again) in case 85 94 the build fails. -
gprc.expect
diff -r 4b9a7ea1dd3f gprc.expect
a b 29 29 breakloop = 0 30 30 31 31 32 /* List of directories where gp will look for scripts */ 33 path = "" 32 /* List of directories where gp will look for scripts: 33 * only current working directory */ 34 path = "." 34 35 35 36 /* Location of elldata, seadata, galdata */ 36 37 datadir = "$SAGE_LOCAL/share/pari" -
patches/README.txt
diff -r 4b9a7ea1dd3f patches/README.txt
a b 3 3 longer, or are still but now for a different reason. (Do not delete that!) 4 4 5 5 ====================================================================== 6 Files patched as of pari-2.4.3.alpha.p4:6 Current patches to PARI in Sage: 7 7 ====================================================================== 8 8 9 9 Patches to configuration files: 10 * config/get_ld: cwitty: Disable -rpath. 11 * config/get_tests: John Cremona: Disable testing of ellglobalred in 12 "make test-all" in spkg-check, since it requires 13 the elldata database which we do not include since 14 it is about 14MB. 15 * config/get_config_options: leif: Catch invalid arguments to "--graphic" 10 * get_ld.patch: cwitty: Disable -rpath. 11 * get_tests.patch: John Cremona: Disable testing of ellglobalred in 12 "make test-all" in spkg-check, since it requires the elldata database 13 which we do not include since it is about 18MB. 14 * get_config_options.patch: leif: Catch invalid arguments to "--graphic" 16 15 (and treat such as an error) since otherwise strange compilation errors 17 16 might occur (cf. #9722, too). 18 * config/get_fltk: leif: Explicitly link against libstdc++ when using FLTK17 * get_fltk.patch: leif: Explicitly link against libstdc++ when using FLTK 19 18 (for plotting) to support Fedora 13, and do an extra check for the FLTK 20 19 include dir (cf. #9722). 21 * config/get_X11: leif: Also search */lib64/* for X11 libraries (since on20 * get_X11.patch: leif: Also search */lib64/* for X11 libraries (since on 22 21 some systems this is really a separate directory, i.e. neither a 23 22 symbolic link to */lib/* nor the target of a symbolic link */lib/*; cf. 24 23 #9722, too). 25 * config/get_dlcflags: jdemeyer: Add -fno-common to DLCFLAGS on Darwin.24 * get_dlcflags.patch: jdemeyer: Add -fno-common to DLCFLAGS on Darwin. 26 25 Fixed upstream, but probably in a bad way. 27 * install_doc_no_make.patch: Do not build the documentation when doing 28 install-doc or install-docpdf. We must not build the documentation 29 because that requires tex. On the other hand, to have ? and ?? work 30 within gp, we must install the .tex files (but not .dvi files). So 31 simply not doing install-doc doesn't work. 32 * perl_path.patch: change first line of all perl scripts 33 to "#!/usr/bin/env perl" (#10559). 26 * install_doc_no_make.patch: jdemeyer: Do not *build* the documentation 27 when doing install-doc or install-docpdf. We must not build the 28 documentation because that requires tex. On the other hand, to have ? 29 and ?? work within gp, we must install the .tex files (but not .dvi 30 files). So simply not doing install-doc doesn't work. 31 * osx_13318_13330.patch.patch: jdemeyer: upstream patch (svn revisions 32 13318 and 13330) to fix linking on certain older Mac OS X systems. 33 * perl_path.patch: jdemeyer: change first line of all perl scripts 34 to "#!/usr/bin/env perl" (#10559). Note that this patch will always 35 apply with fuzz 2 because of the svn Id. 34 36 35 37 C files: 36 * src/kernel/gmp/mp.c , src/language/init.c:37 These two are needed so that Sage can catch PARI's error signals.38 * src/kernel/gmp/mp.c: 39 Do not override GMP's memory functions. 38 40 In addition, let PARI use "GMP internals" (access members of GMP 39 41 structures directly) *conditionally*. (We *don't* disable that by 40 42 default, since at least currently this is compatible with both GMP … … 46 48 tracking system, see 47 49 http://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=NNNN 48 50 where NNNN is the bug number): 49 * pari_1084.patch: exotic branch cut convention (#9620). jdemeyer: 50 removed the parts of the patch involving the COMPAT and CHANGES files 51 as they are documentation only and give patch conflicts. Rebased 52 a hunk in src/basemath/trans1.c to make the patch apply cleanly. 53 * pari_1132.patch: nffactor() returns reducible factor (#10279) 54 * pari_1141.patch: factoring non-square-free polynomial over number 55 fields (#10369) 56 * pari_1143.patch: rnfisnorm failing for non-integral elements (#2329) 57 * pari_1144.patch: rnfisnorminit requires leading coefficient 1 to be 58 in ZZ instead of the base field (#2329) 51 * currently no patches 59 52 60 53 ====================================================================== 61 54 Files previously patched: … … 103 96 * Makefile_mv.patch: Fix race condition in parallel "make install", 104 97 see http://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=1148 105 98 Removed because race conditions still remain, instead make -j1 install. 99 * pari_1084.patch: exotic branch cut convention (#9620). jdemeyer: 100 removed the parts of the patch involving the COMPAT and CHANGES files 101 as they are documentation only and give patch conflicts. Rebased 102 a hunk in src/basemath/trans1.c to make the patch apply cleanly. 103 * pari_1132.patch: nffactor() returns reducible factor (#10279) 104 * pari_1141.patch: factoring non-square-free polynomial over number 105 fields (#10369) 106 * pari_1143.patch: rnfisnorm failing for non-integral elements (#2329) 107 * pari_1144.patch: rnfisnorminit requires leading coefficient 1 to be 108 in ZZ instead of the base field (#2329) 109 * src/language/init.c: 110 These was needed so that Sage can catch PARI's error signals. 111 Turns out this is totally not needed since we use err_catch() 112 in devel/sage/sage/libs/pari/pari_err.h -
deleted file patches/init.c.patch
diff -r 4b9a7ea1dd3f patches/init.c.patch
+ - 1 --- src/language/init.c (revision 12541)2 +++ src/language/init.c (working copy)3 @@ -19,6 +19,7 @@4 /* */5 /*******************************************************************/6 #include <string.h>7 +#include <stdlib.h> /* patch for Sage */8 #include "pari.h"9 #include "paripriv.h"10 #include "anal.h"11 @@ -684,6 +685,7 @@12 static void13 pari_exit(void)14 {15 + abort(); /* patch for Sage */16 fprintferr(" *** Error in the PARI system. End of program.\n");17 exit(1);18 } -
patches/mp.c.patch
diff -r 4b9a7ea1dd3f patches/mp.c.patch
a b 1 --- src/kernel/gmp/mp.c 2010-08-22 21:25:46.000000000 +0200 2 +++ src/kernel/gmp/mp.c 2010-09-06 00:34:54.000000000 +0200 3 @@ -56,7 +56,9 @@ 1 Index: src/kernel/gmp/mp.c 2 =================================================================== 3 --- src/kernel/gmp/mp.c (revision 13151) 4 +++ src/kernel/gmp/mp.c (working copy) 5 @@ -45,18 +45,8 @@ 6 /*We need PARI invmod renamed to invmod_pari*/ 7 #define INVMOD_PARI 8 9 -static void *gmp_realloc(void *ptr, size_t old_size, size_t new_size) { 10 - (void)old_size; return (void *) pari_realloc(ptr,new_size); 11 -} 12 - 13 -static void gmp_free(void *ptr, size_t old_size){ 14 - (void)old_size; pari_free(ptr); 15 -} 16 - 4 17 int pari_kernel_init(void) 5 18 { 6 /* Use pari_malloc instead of malloc */ 7 + /* patch for Sage 8 mp_set_memory_functions((void *(*)(size_t)) pari_malloc, gmp_realloc, gmp_free); 9 + */ 19 - /* Use pari_malloc instead of malloc */ 20 - mp_set_memory_functions((void *(*)(size_t)) pari_malloc, gmp_realloc, gmp_free); 10 21 return 0; 11 22 } 12 23 13 @@ - 949,7 +951,16 @@24 @@ -1036,7 +1026,16 @@ 14 25 15 26 /* EXACT INTEGER DIVISION */ 16 27 … … 28 39 static void 29 40 GEN2mpz(mpz_t X, GEN x) 30 41 { 31 @@ -10 08,7 +1019,7 @@42 @@ -1095,7 +1094,7 @@ 32 43 mpz2GEN(z, Z); return z; 33 44 } 34 45 } -
new file patches/osx_13318_13330.patch
diff -r 4b9a7ea1dd3f patches/osx_13318_13330.patch
- + 1 Index: config/get_dlld 2 =================================================================== 3 --- config/get_dlld (revision 13317) 4 +++ config/get_dlld (working copy) 5 @@ -68,7 +68,7 @@ 6 else # DLLD != GNU ld 7 case "$osname" in 8 aix) DLLDFLAGS='-r' ;; 9 - darwin) DLLDFLAGS="-flat_namespace -undefined suppress -dylib_compatibility_version $compat_ver -dylib_current_version $num_ver" ;; 10 + darwin) DLLDFLAGS="-flat_namespace -undefined suppress -compatibility_version $compat_ver -current_version $num_ver" ;; 11 freebsd) DLLDFLAGS='-Bshareable -x' ;; 12 hpux) DLLDFLAGS='-b' ;; 13 irix) DLLDFLAGS='-shared -elf -no_unresolved -all' ;; 14 Index: config/Makefile.SH 15 =================================================================== 16 --- config/Makefile.SH (revision 13329) 17 +++ config/Makefile.SH (working copy) 18 @@ -51,7 +51,7 @@ 19 mingw) 20 export_file='$(LIBPARI).def';; 21 darwin) 22 - ld_install_name="-Wl,-dylib_install_name -Wl,\"$libdir\"/\$(LIBPARI_DYN)";; 23 + ld_install_name="-Wl,-install_name -Wl,\"$libdir\"/\$(LIBPARI_DYN)";; 24 esac 25 26 PLOTCFLAGS= -
deleted file patches/pari_1084.patch
diff -r 4b9a7ea1dd3f patches/pari_1084.patch
+ - 1 Index: src/basemath/trans1.c2 ===================================================================3 --- src/basemath/trans1.c (revision 12623)4 +++ src/basemath/trans1.c (working copy)5 @@ -2134,7 +2134,7 @@6 gel(y,2) = mppi(lg(x)); return y;7 8 case t_COMPLEX:9 - if (gequal0(gel(x,2))) return glog(gel(x,1), prec);10 + if (ismpzero(gel(x,2))) return glog(gel(x,1), prec);11 if (prec >= LOGAGMCX_LIMIT) return logagmcx(x, prec);12 y = cgetg(3,t_COMPLEX);13 gel(y,2) = garg(x,prec);14 Index: src/basemath/trans2.c15 ===================================================================16 --- src/basemath/trans2.c (revision 12623)17 +++ src/basemath/trans2.c (working copy)18 @@ -141,7 +141,8 @@19 case t_REAL:20 return mpatan(x);21 22 - case t_COMPLEX:23 + case t_COMPLEX: /* atan(x) = -i atanh(ix) */24 + if (ismpzero(gel(x,2))) return gatan(gel(x,1), prec);25 av = avma; return gerepilecopy(av, mulcxmI(gath(mulcxI(x),prec)));26 27 case t_INTMOD: case t_PADIC: pari_err(typeer,"gatan");28 @@ -197,10 +198,11 @@29 y = cgetg(3,t_COMPLEX);30 gel(y,1) = Pi2n(-1, lg(x));31 gel(y,2) = mpach(x);32 - if (sx < 0) { togglesign(gel(y,1)); togglesign(gel(y,2)); }33 + if (sx < 0) togglesign(gel(y,1)); else togglesign(gel(y,2));34 return y;35 36 - case t_COMPLEX:37 + case t_COMPLEX: /* asin(z) = -i asinh(iz) */38 + if (ismpzero(gel(x,2))) return gasin(gel(x,1), prec);39 av = avma;40 return gerepilecopy(av, mulcxmI(gash(mulcxI(x), prec)));41 42 @@ -269,12 +271,16 @@43 if (expo(x) < 0) return mpacos(x);44 45 y = cgetg(3,t_COMPLEX); p1 = mpach(x);46 - if (sx < 0) gel(y,1) = mppi(lg(x));47 - else { gel(y,1) = gen_0; togglesign(p1); }48 + if (sx < 0) { gel(y,1) = mppi(lg(x)); togglesign(p1); }49 + else gel(y,1) = gen_0;50 gel(y,2) = p1; return y;51 52 - case t_COMPLEX: av = avma;53 - return gerepilecopy(av, mulcxmI(gach(x,prec)));54 + case t_COMPLEX:55 + if (ismpzero(gel(x,2))) return gacos(gel(x,1), prec);56 + av = avma;57 + p1 = gadd(x, mulcxI(gsqrt(gsubsg(1,gsqr(x)), prec)));58 + y = glog(p1,prec); /* log(x + I*sqrt(1-x^2)) */59 + return gerepilecopy(av, mulcxmI(y));60 61 case t_INTMOD: case t_PADIC: pari_err(typeer,"gacos");62 case t_SER:63 @@ -530,7 +536,7 @@64 }65 /********************************************************************/66 /** **/67 -/** ARG-HYPERBOLIC SINE **/68 +/** AREA HYPERBOLIC SINE **/69 /** **/70 /********************************************************************/71 72 @@ -552,31 +558,23 @@73 GEN74 gash(GEN x, long prec)75 {76 - long sx, sy, sz;77 pari_sp av;78 GEN a, y, p1;79 80 - if (gequal0(x)) return gcopy(x);81 switch(typ(x))82 {83 case t_REAL:84 + if (!signe(x)) return rcopy(x);85 return mpash(x);86 87 - case t_COMPLEX: av = avma;88 + case t_COMPLEX:89 + if (ismpzero(gel(x,2))) return gash(gel(x,1), prec);90 + av = avma;91 + if (ismpzero(gel(x,1))) /* avoid cancellation */92 + return gerepilecopy(av, mulcxI(gasin(gel(x,2), prec)));93 p1 = gadd(x, gsqrt(gaddsg(1,gsqr(x)), prec));94 - y = glog(p1,prec);95 - sz = (typ(y)==t_COMPLEX)? gsigne(gel(y,1)): gsigne(y);96 - if (typ(p1) == t_COMPLEX) {97 - sx = gsigne(gel(p1,1));98 - sy = gsigne(gel(p1,2));99 - } else {100 - sx = gsigne(p1);101 - sy = 0;102 - }103 - if (sx > 0 || (!sx && sy*sz<=0)) return gerepileupto(av, y);104 -105 - p1 = mppi(prec); if (sy<0) setsigne(p1,-1);106 - return gerepileupto(av, gsub(mkcomplex(gen_0,p1), y));107 + y = glog(p1,prec); /* log (x + sqrt(1+x^2)) */108 + return gerepileupto(av, y);109 case t_INTMOD: case t_PADIC: pari_err(typeer,"gash");110 default:111 av = avma; if (!(y = toser_i(x))) break;112 @@ -598,7 +596,7 @@113 }114 /********************************************************************/115 /** **/116 -/** ARG-HYPERBOLIC COSINE **/117 +/** AREA HYPERBOLIC COSINE **/118 /** **/119 /********************************************************************/120 121 @@ -630,17 +628,18 @@122 if (s == 0) b = acos0(e);123 else if (e < 0) b = mpacos(x); /* -1 < x < 1 */124 else {125 - if (!absrnz_egal1(x)) { a = mpach(x); togglesign(a); }126 + if (!absrnz_egal1(x)) a = mpach(x);127 b = mppi(lg(x));128 }129 gel(y,1) = a;130 gel(y,2) = b; return y;131 }132 case t_COMPLEX:133 + if (ismpzero(gel(x,2))) return gach(gel(x,1), prec);134 av = avma;135 - p1 = gadd(x, gsqrt(gaddsg(-1,gsqr(x)), prec)); /* x + sqrt(x^2-1) */136 - y = glog(p1,prec);137 - if (typ(y) == t_COMPLEX && signe(y[2]) < 0) y = gneg(y);138 + p1 = gadd(x, gsqrt(gaddsg(-1,gsqr(x)), prec));139 + y = glog(p1,prec); /* log(x + sqrt(x^2-1)) */140 + if (signe(real_i(y)) < 0) y = gneg(y);141 return gerepileupto(av, y);142 143 case t_INTMOD: case t_PADIC: pari_err(typeer,"gach");144 @@ -674,7 +673,7 @@145 }146 /********************************************************************/147 /** **/148 -/** ARG-HYPERBOLIC TANGENT **/149 +/** AREA HYPERBOLIC TANGENT **/150 /** **/151 /********************************************************************/152 153 @@ -694,26 +693,33 @@154 GEN155 gath(GEN x, long prec)156 {157 + long sx;158 pari_sp av;159 GEN a, y, z;160 161 switch(typ(x))162 {163 case t_REAL:164 - if (!signe(x)) return real_0_bit(expo(x));165 + sx = signe(x);166 + if (!sx) return real_0_bit(expo(x));167 if (expo(x) < 0) return mpath(x);168 169 y = cgetg(3,t_COMPLEX);170 av = avma;171 - z = invr( subrs(x,1) ); setexpo(z, expo(z)+1); /* 2/(x-1)*/172 + z = subrs(x,1);173 + if (!signe(z)) pari_err(talker,"singular argument in atanh");174 + z = invr(z); setexpo(z, expo(z)+1); /* 2/(x-1)*/175 z = addrs(z,1);176 if (!signe(z)) pari_err(talker,"singular argument in atanh");177 z = logr_abs(z);178 - setexpo(z, expo(z)-1);179 + setexpo(z, expo(z)-1); /* (1/2)log((1+x)/(x-1)) */180 gel(y,1) = gerepileuptoleaf(av, z);181 - gel(y,2) = Pi2n(-1, lg(x)); return y;182 + gel(y,2) = Pi2n(-1, lg(x));183 + if (sx > 0) togglesign(gel(y,2));184 + return y;185 186 - case t_COMPLEX:187 + case t_COMPLEX: /* 2/(1-z) - 1 = (1+z) / (1-z) */188 + if (ismpzero(gel(x,2))) return gath(gel(x,1), prec);189 av = avma; z = glog( gaddgs(gdivsg(2,gsubsg(1,x)),-1), prec );190 return gerepileupto(av, gmul2n(z,-1));191 192 Index: src/functions/transcendental/atanh193 ===================================================================194 --- src/functions/transcendental/atanh (revision 12623)195 +++ src/functions/transcendental/atanh (working copy)196 @@ -3,6 +3,6 @@197 C-Name: gath198 Prototype: Gp199 Help: atanh(x): inverse hyperbolic tangent of x.200 -Doc: principal branch of $\text{tanh}^{-1}(x)$, i.e.~such201 - that $\text{Im(atanh}(x))\in{} ]-\pi/2,\pi/2]$. If $x\in \R$ and $|x|>1$ then202 - $\text{atanh}(x)$ is complex.203 +Doc: principal branch of $\text{tanh}^{-1}(x) = log ((1+x)/(1-x)) / 2$. In204 + particular $\text{Im(atanh}(x))\in{} [-\pi/2,\pi/2]$; if $x\in \R$ and205 + $|x|>1$ then $\text{atanh}(x)$ is complex.206 Index: src/functions/transcendental/acosh207 ===================================================================208 --- src/functions/transcendental/acosh (revision 12623)209 +++ src/functions/transcendental/acosh (working copy)210 @@ -3,6 +3,8 @@211 C-Name: gach212 Prototype: Gp213 Help: acosh(x): inverse hyperbolic cosine of x.214 -Doc: principal branch of $\text{cosh}^{-1}(x)$,215 - i.e.~such that $\text{Im(acosh}(x))\in [0,\pi]$. If216 - $x\in \R$ and $x<1$, then $\text{acosh}(x)$ is complex.217 +Doc: principal branch of $\text{cosh}^{-1}(x) = 2218 + \log(\sqrt{(x+1)/2} + \sqrt{(x-1)/2})$. In particular,219 + $\text{Re}(\text{acosh}(x))\geq 0$ and220 + $\text{In}(\text{acosh}(x))\in ]-\pi,\pi]0$; if $x\in \R$ and $x<1$, then221 + $\text{acosh}(x)$ is complex.222 Index: src/functions/transcendental/log223 ===================================================================224 --- src/functions/transcendental/log (revision 12623)225 +++ src/functions/transcendental/log (working copy)226 @@ -6,7 +6,10 @@227 Description:228 (gen):gen:prec glog($1, prec)229 Doc: principal branch of the natural logarithm of230 - $x$, i.e.~such that $\text{Im(log}(x))\in{} ]-\pi,\pi]$. The result is complex231 + $x \in \C^*$, i.e.~such that $\text{Im(log}(x))\in{} ]-\pi,\pi]$.232 + The branch cut lies233 + along the negative real axis, continuous with quadrant 2, i.e.~such that234 + $\lim_{b\to 0^+} \log (a+bi) = \log a$ for $a \in\R^*$. The result is complex235 (with imaginary part equal to $\pi$) if $x\in \R$ and $x < 0$. In general,236 the algorithm uses the formula237 $$\log(x) \approx {\pi\over 2\text{agm}(1, 4/s)} - m \log 2, $$238 Index: src/functions/transcendental/atan239 ===================================================================240 --- src/functions/transcendental/atan (revision 12623)241 +++ src/functions/transcendental/atan (working copy)242 @@ -2,6 +2,10 @@243 Section: transcendental244 C-Name: gatan245 Prototype: Gp246 -Help: atan(x): inverse tangent of x.247 -Doc: principal branch of $\text{tan}^{-1}(x)$, i.e.~such248 - that $\text{Re(atan}(x))\in{} ]-\pi/2,\pi/2[$.249 +Help: atan(x): arc tangent of x.250 +Doc: principal branch of $\text{tan}^{-1}(x) = \log ((1+ix)/(1-ix)) /251 + 2i$. In particular $\text{Re(atan}(x))\in{} ]-\pi/2,\pi/2[$.252 + The branch cut is in two pieces:253 + $]-i\infty,-i[$, continuous with quadrant IV, and $]i,+i \infty[$ continuous254 + with quadrant II. The function satisfies $i \text{atan}(x) =255 + -i\text{atanh}(ix)$ for all $x\neq \pm i$.256 Index: src/functions/transcendental/acos257 ===================================================================258 --- src/functions/transcendental/acos (revision 12623)259 +++ src/functions/transcendental/acos (working copy)260 @@ -2,7 +2,10 @@261 Section: transcendental262 C-Name: gacos263 Prototype: Gp264 -Help: acos(x): inverse cosine of x.265 -Doc: principal branch of $\text{cos}^{-1}(x)$, i.e.~such that266 - $\text{Re(acos}(x))\in [0,\pi]$. If $x\in \R$ and $|x|>1$, then267 - $\text{acos}(x)$ is complex.268 +Help: acos(x): arc cosine of x.269 +Doc: principal branch of $\text{cos}^{-1}(x) = -i \log (x + i\sqrt{1-x^2})$.270 + In particular, $\text{Re(acos}(x))\in [0,\pi]$ and if $x\in \R$ and $|x|>1$,271 + then $\text{acos}(x)$ is complex. The branch cut is in two pieces:272 + $]-\infty,-1]$ , continuous with quadrant II, and $[1,+\infty[$, continuous273 + with quadrant IV. We have $\text{acos}(x) = \pi/2 - \text{asin}(x)$ for all274 + $x$.275 Index: src/functions/transcendental/sqrt276 ===================================================================277 --- src/functions/transcendental/sqrt (revision 12623)278 +++ src/functions/transcendental/sqrt (working copy)279 @@ -6,16 +6,14 @@280 Description:281 (real):gen sqrtr($1)282 (gen):gen:prec gsqrt($1, prec)283 -Doc: principal branch of the square root of $x$,284 - i.e.~such that $\text{Arg}(\text{sqrt}(x))\in{} ]-\pi/2, \pi/2]$, or in other285 - words such that $\Re(\text{sqrt}(x))>0$ or $\Re(\text{sqrt}(x))=0$ and286 - $\Im(\text{sqrt}(x))\ge 0$. If $x\in \R$ and $x<0$, then the result is287 - complex with positive imaginary part.288 +Doc: principal branch of the square root of $x$, defined as $\sqrt{x} =289 + \exp(\log x / 2)$. In particular, we have290 + $\text{Arg}(\text{sqrt}(x))\in{} ]-\pi/2, \pi/2]$, and if $x\in \R$ and $x<0$,291 + then the result is complex with positive imaginary part.292 293 - Intmod a prime and $p$-adics are allowed as arguments. In that case,294 + Intmod a prime $p$ and $p$-adics are allowed as arguments. In that case,295 the square root (if it exists) which is returned is the one whose296 - first $p$-adic digit (or its unique $p$-adic digit in the case of297 - intmods) is in the interval $[0,p/2]$. When the argument is an298 + first $p$-adic digit is in the interval $[0,p/2]$. When the argument is an299 intmod a non-prime (or a non-prime-adic), the result is undefined.300 Variant: For a \typ{PADIC} $x$, the function301 \fun{GEN}{Qp_sqrt}{GEN x} is also available.302 Index: src/functions/transcendental/asin303 ===================================================================304 --- src/functions/transcendental/asin (revision 12623)305 +++ src/functions/transcendental/asin (working copy)306 @@ -2,7 +2,10 @@307 Section: transcendental308 C-Name: gasin309 Prototype: Gp310 -Help: asin(x): inverse sine of x.311 -Doc: principal branch of $\text{sin}^{-1}(x)$, i.e.~such312 - that $\text{Re(asin}(x))\in [-\pi/2,\pi/2]$. If $x\in \R$ and $|x|>1$ then313 - $\text{asin}(x)$ is complex.314 +Help: asin(x): arc sine of x.315 +Doc: principal branch of $\text{sin}^{-1}(x) = -i \log(ix + \sqrt{1 - x^2})$.316 + In particular, $\text{Re(asin}(x))\in [-\pi/2,\pi/2]$ and if $x\in \R$ and317 + $|x|>1$ then $\text{asin}(x)$ is complex. The branch cut is in two pieces:318 + $]-\infty,-1]$, continuous with quadrant II, and $[1,+\infty[$ continuous319 + with quadrant IV. The function satisfies $i \text{asin}(x) =320 + \text{asinh}(ix)$.321 Index: src/functions/transcendental/asinh322 ===================================================================323 --- src/functions/transcendental/asinh (revision 12623)324 +++ src/functions/transcendental/asinh (working copy)325 @@ -3,5 +3,8 @@326 C-Name: gash327 Prototype: Gp328 Help: asinh(x): inverse hyperbolic sine of x.329 -Doc: principal branch of $\text{sinh}^{-1}(x)$, i.e.~such330 - that $\text{Im(asinh}(x))\in [-\pi/2,\pi/2]$.331 +Doc: principal branch of $\text{sinh}^{-1}(x) = \log(x + \sqrt{1+x^2})$. In332 + particular $\text{Im(asinh}(x))\in [-\pi/2,\pi/2]$.333 + The branch cut is in two pieces: [-i oo ,-i], continuous with quadrant III334 + and [i,+i oo [ continuous with quadrant I.335 +336 Index: src/headers/pariinl.h337 ===================================================================338 --- src/headers/pariinl.h (revision 12623)339 +++ src/headers/pariinl.h (working copy)340 @@ -1352,6 +1352,7 @@341 /* MISCELLANEOUS */342 /* */343 /*******************************************************************/344 +INLINE int ismpzero(GEN x) { return is_intreal_t(typ(x)) && !signe(x); }345 INLINE int isintzero(GEN x) { return typ(x) == t_INT && !signe(x); }346 INLINE int isint1(GEN x) { return typ(x)==t_INT && equali1(x); }347 INLINE int isintm1(GEN x){ return typ(x)==t_INT && equalim1(x);}348 Index: src/headers/paridecl.h349 ===================================================================350 --- src/headers/paridecl.h (revision 12623)351 +++ src/headers/paridecl.h (working copy)352 @@ -3027,6 +3027,7 @@353 INLINE int isint1(GEN x);354 INLINE int isintm1(GEN x);355 INLINE int isintzero(GEN x);356 +INLINE int ismpzero(GEN x);357 INLINE int isonstack(GEN x);358 INLINE void killblock(GEN x);359 INLINE GEN leading_term(GEN x);360 Index: doc/usersFUNCS.tex361 ===================================================================362 --- doc/usersFUNCS.tex (revision 12623)363 +++ doc/usersFUNCS.tex (working copy)364 @@ -393,8 +393,9 @@365 @eprog366 367 Note that even if the argument is real, the result may be complex368 -(e.g.~$\text{acos}(2.0)$ or $\text{acosh}(0.0)$).369 -Note also that the principal branch is always chosen.370 +(e.g.~$\text{acos}(2.0)$ or $\text{acosh}(0.0)$). See each individual371 +function help for the definition of the branch cuts and choice of principal372 +value.373 374 \item If the argument is either an integer, a rational, an exact complex375 number or a quadratic number, it is first converted to a real376 @@ -420,7 +421,7 @@377 then the function is evaluated for every possible complex embedding of that378 algebraic number. A column vector of results is returned, with one component379 for each complex embedding. Therefore, the number of components equals380 -the degree of the polynomial defining the number field.381 +the degree of the \typ{POLMOD} modulus.382 383 \item If the argument is an intmod or a $p$-adic, at present only a384 few functions like \kbd{sqrt} (square root), \kbd{sqr} (square), \kbd{log},385 Index: doc/usersch5.tex386 ===================================================================387 --- doc/usersch5.tex (revision 12623)388 +++ doc/usersch5.tex (working copy)389 @@ -6258,6 +6258,9 @@390 otherwise. Contrary to \kbd{isintzero}, this includes recursive objects, for391 instance vectors, whose components are $0$.392 393 +\fun{int}{ismpzero}{GEN x} returns 1 (true) if \kbd{x} is a \typ{INT} or394 +a \typ{REAL} equal to~0.395 +396 \fun{int}{isintzero}{GEN x} returns 1 (true) if \kbd{x} is a \typ{INT}397 equal to~0.398 -
deleted file patches/pari_1132.patch
diff -r 4b9a7ea1dd3f patches/pari_1132.patch
+ - 1 Index: src/test/32/nffactor2 ===================================================================3 --- src/test/32/nffactor (revision 12730)4 +++ src/test/32/nffactor (working copy)5 @@ -691,4 +691,5 @@6 7 [x + Mod(y^7 + 1, y^12 - y^11 + y^9 - y^8 + y^6 - y^4 + y^3 - y + 1) 1]8 9 -Total time spent: 2186910 +[x + (-2*y^3 + y), x + (-4/3*y^3 + 2/3*y), x + (-2/3*y^3 + 1/3*y)]~11 +Total time spent: 3284912 Index: src/test/in/nffactor13 ===================================================================14 --- src/test/in/nffactor (revision 12730)15 +++ src/test/in/nffactor (working copy)16 @@ -70,3 +70,6 @@17 18 \\ Bug #107519 nffactor(polcyclo(21,y), x^2-y^7)20 +21 +\\ Bug #113222 +do(y^4-y^2+1, 3*x^3+(-12*y^3+6*y)*x^2-11*y^2*x+(2*y^3-4*y))23 Index: src/modules/nffactor.c24 ===================================================================25 --- src/modules/nffactor.c (revision 12730)26 +++ src/modules/nffactor.c (working copy)27 @@ -375,36 +375,34 @@28 return u;29 }30 31 -/* Warning: return L->topowden * (best lift) */32 +/* Warning: return L->topowden * (best lift). */33 static GEN34 -nf_bestlift_to_pol(GEN elt, GEN *cu, GEN bound, nflift_t *L)35 +nf_bestlift_to_pol(GEN elt, GEN bound, nflift_t *L)36 {37 pari_sp av = avma;38 GEN u,v = nf_bestlift(elt,bound,L);39 if (!v) return NULL;40 - v = gclone(v); avma = av;41 if (ZV_isscalar(v))42 {43 - if (L->topowden) {44 + if (L->topowden)45 u = mulii(L->topowden, gel(v,1));46 - if (cu) *cu = icopy(gel(v,1));47 - } else {48 + else49 u = icopy(gel(v,1));50 - if (cu) *cu = u;51 - }52 + u = gerepileuptoint(av, u);53 }54 else55 {56 + v = gclone(v); avma = av;57 u = RgV_dotproduct(L->topow, v);58 - if (cu) *cu = typ(u) == t_POL ? ZV_content(v): u;59 + gunclone(v);60 }61 - gunclone(v); return u;62 + return u;63 }64 65 /* return the T->powden * (lift of pol with coefficients of T2-norm <= C)66 - * if it exists */67 + * if it exists. */68 static GEN69 -nf_pol_lift(GEN pol, GEN *c, GEN bound, nfcmbf_t *T)70 +nf_pol_lift(GEN pol, GEN bound, nfcmbf_t *T)71 {72 long i, l = lg(pol);73 GEN t, x = cgetg(l,t_POL);74 @@ -412,13 +410,10 @@75 x[1] = pol[1];76 t = gel(pol,l-1);77 gel(x,l-1) = mul_content(T->L->topowden, t);78 - if (c) *c = t;79 for (i=l-2; i>1; i--)80 {81 - GEN ct;82 - t = nf_bestlift_to_pol(gel(pol,i), c ? &ct: NULL, bound, T->L);83 + t = nf_bestlift_to_pol(gel(pol,i), bound, T->L);84 if (!t) return NULL;85 - if (c) *c = gcdii(*c, ct);86 gel(x,i) = t;87 }88 return x;89 @@ -851,54 +846,29 @@90 }91 92 typedef struct {93 - GEN lt, C, C2, C2lt, C2ltpol;94 + GEN lt, C, C2lt, C2ltpol;95 } div_data;96 97 static void98 init_div_data(div_data *D, GEN pol, GEN C)99 {100 - GEN C2, C2lt, lc = leading_term(pol), lt = is_pm1(lc)? NULL: absi(lc);101 + GEN C2lt, lc = leading_term(pol), lt = is_pm1(lc)? NULL: absi(lc);102 if (C)103 {104 - C2 = sqri(C);105 + GEN C2 = sqri(C);106 C2lt = lt ? mulii(C2, lt): C2;107 }108 else109 - {110 - C2 = NULL;111 C2lt = lt;112 - }113 D->lt = lt;114 D->C = C;115 - D->C2 = C2;116 D->C2lt = C2lt;117 D->C2ltpol = C2lt? RgX_Rg_mul(pol, C2lt): pol;118 }119 static void120 -update_target(div_data *D, GEN cy, GEN pol)121 +update_target(div_data *D, GEN pol)122 {123 - GEN C2ltpol, C2lt;124 - if (D->lt) {125 - GEN Clt;126 - D->lt = diviiexact(D->lt, cy); /* correct leading coeff for cofactor of y */127 - if (D->C)128 - {129 - Clt = mulii(D->C, D->lt);130 - C2lt = mulii(D->C, Clt);131 - }132 - else133 - C2lt = Clt = D->lt;134 - /* cofactor of y has leading coeff C old_lt : must be multiplied by135 - * new_lt / C old_lt = 1/(C*cy) to obtain the new 'pol'136 - * C2ltpol obtained by multiplying further by137 - * C^2 new_lt : pol * C new_lt / cy */138 - C2ltpol = RgX_Rg_mul(RgX_Rg_div(pol,cy), Clt);139 - } else {140 - C2ltpol = D->C? RgX_Rg_mul(pol, D->C): pol;141 - C2lt = D->C2;142 - }143 - D->C2ltpol = C2ltpol;144 - D->C2lt = C2lt;145 + D->C2ltpol = D->C? RgX_Rg_mul(pol, D->C): pol;146 }147 148 /* nb = number of modular factors; return a "good" K such that naive149 @@ -993,7 +963,7 @@150 }151 if (curdeg <= klim) /* trial divide */152 {153 - GEN t, cy, y, q;154 + GEN t, y, q;155 pari_sp av;156 157 av = avma;158 @@ -1026,7 +996,7 @@159 y = FqX_centermod(q, Tpk, pk, pks2);160 }161 /* y = C*lt*\prod_{i in ind} famod[i] */162 - y = nf_pol_lift(y, D.lt ? &cy : NULL, bound, T);163 + y = nf_pol_lift(y, bound, T);164 if (!y)165 {166 if (DEBUGLEVEL>3) fprintferr("@");167 @@ -1043,9 +1013,7 @@168 /* pol in O_K[X] with leading coeff lt in Z,169 * y = C*lt \prod famod[i] is in O_K[X] with leading coeff in Z170 * q = C^2 * lt * pol / y = C * (lt * pol) / (lt*\prod famod[i]), a171 - * K-rational factor, in fact in Z[Y]/nf.pol)[X] as above.172 - * cy is the Z-content of (y/C), i.e. the largest integer such that173 - * (y/C*cy) is in O_K[X]; it divides lt */174 + * K-rational factor, in fact in Z[Y]/nf.pol)[X] as above. */175 176 /* found a factor */177 if (D.C2lt) y = RgX_int_normalize(y); /* monic */178 @@ -1068,7 +1036,7 @@179 if (lfamod < 2*K) goto END;180 i = 1; curdeg = deg[ind[1]];181 182 - update_target(&D, cy, pol);183 + update_target(&D, pol);184 if (DEBUGLEVEL > 2)185 {186 fprintferr("\n"); msgTIMER(&ti, "to find factor %Ps",y);187 @@ -1133,15 +1101,11 @@188 for (i = 1;;)189 {190 pari_sp av = avma;191 - GEN cy;192 if (DEBUGLEVEL) fprintferr("nf_LLL_cmbf: checking factor %ld\n", i);193 y = chk_factors_get(D.lt, famod, gel(piv,i), Tpk, pk);194 195 - if (! (y = nf_pol_lift(y, D.lt ? &cy : NULL, bound, T)) ) return NULL;196 - if (D.lt)197 - gerepileall(av, 2, &y, &cy);198 - else199 - y = gerepilecopy(av, y);200 + if (! (y = nf_pol_lift(y, bound, T)) ) return NULL;201 + y = gerepilecopy(av, y);202 /* y is the candidate factor */203 pol = RgXQX_divrem(D.C2ltpol, y, nfT, ONLY_DIVIDES);204 if (!pol) return NULL;205 @@ -1150,7 +1114,7 @@206 gel(list,i) = y;207 if (++i >= r) break;208 209 - update_target(&D, cy, pol);210 + update_target(&D, pol);211 }212 gel(list,i) = RgX_int_normalize(pol); return list;213 }214 @@ -1527,7 +1491,7 @@215 {216 GEN q, r = gel(z,i);217 218 - r = nf_bestlift_to_pol(ltdn? gmul(ltdn,r): r, NULL, NULL, L);219 + r = nf_bestlift_to_pol(ltdn? gmul(ltdn,r): r, NULL, L);220 gel(Cltdnx_r,2) = gneg(r); /* check P(r) == 0 */221 q = RgXQX_divrem(C2ltdnpol, Cltdnx_r, nfpol, ONLY_DIVIDES); /* integral */222 if (q) { -
deleted file patches/pari_1141.patch
diff -r 4b9a7ea1dd3f patches/pari_1141.patch
+ - 1 Index: src/test/32/nffactor2 ===================================================================3 --- src/test/32/nffactor (revision 12763)4 +++ src/test/32/nffactor (working copy)5 @@ -692,4 +692,5 @@6 [x + Mod(y^7 + 1, y^12 - y^11 + y^9 - y^8 + y^6 - y^4 + y^3 - y + 1) 1]7 8 [x + (-2*y^3 + y), x + (-4/3*y^3 + 2/3*y), x + (-2/3*y^3 + 1/3*y)]~9 -Total time spent: 3284910 +[x + (-1/3*y - 1/3), x + (2/3*y + 2/3)]~11 +Total time spent: 871212 Index: src/test/in/nffactor13 ===================================================================14 --- src/test/in/nffactor (revision 12763)15 +++ src/test/in/nffactor (working copy)16 @@ -73,3 +73,7 @@17 18 \\ Bug #113219 do(y^4-y^2+1, 3*x^3+(-12*y^3+6*y)*x^2-11*y^2*x+(2*y^3-4*y))20 +21 +\\ Bug #114122 +do(y^2-y+1, (x-(1+y)/3)^2*(x+2*(1+y)/3))23 +24 Index: src/modules/nffactor.c25 ===================================================================26 --- src/modules/nffactor.c (revision 12763)27 +++ src/modules/nffactor.c (working copy)28 @@ -450,13 +450,13 @@29 { /* compute valuations mod a prime of degree 1 (avoid coeff explosion) */30 pari_sp av1 = avma;31 long j;32 - GEN quo, p, r, Bp, E = cgetalloc(t_VECSMALL,n+1);33 + GEN quo, p, r, Bp, lb = leading_term(B), E = cgetalloc(t_VECSMALL,n+1);34 byteptr pt = diffptr;35 ulong pp = 0;36 for (;; avma = av1)37 {38 NEXT_PRIME_VIADIFF_CHECK(pp, pt);39 - if (! umodiu(bad,pp)) continue;40 + if (! umodiu(bad,pp) || !umodiu(lb, pp)) continue;41 p = utoipos(pp);42 r = FpX_oneroot(T, p);43 if (!r) continue; -
deleted file patches/pari_1143.patch
diff -r 4b9a7ea1dd3f patches/pari_1143.patch
+ - 1 Index: src/basemath/buch4.c2 ===================================================================3 --- src/basemath/buch4.c (revision 12768)4 +++ src/basemath/buch4.c (working copy)5 @@ -618,8 +618,9 @@6 *S2 = shallowconcat(*S2, idealprimedec(rel,p));7 }8 9 +/* N a t_INT */10 static void11 -fa_pr_append(GEN nf,GEN rel,GEN N,GEN *prod,GEN *S1,GEN *S2)12 +Zfa_pr_append(GEN nf,GEN rel,GEN N,GEN *prod,GEN *S1,GEN *S2)13 {14 if (!is_pm1(N))15 {16 @@ -628,6 +629,18 @@17 for (i=1; i<l; i++) pr_append(nf,rel,gel(v,i),prod,S1,S2);18 }19 }20 +/* N a t_INT or t_FRAC */21 +static void22 +fa_pr_append(GEN nf,GEN rel,GEN N,GEN *prod,GEN *S1,GEN *S2)23 +{24 + if (typ(N) == t_FRAC)25 + {26 + Zfa_pr_append(nf,rel,gel(N,1),prod,S1,S2);27 + Zfa_pr_append(nf,rel,gel(N,2),prod,S1,S2);28 + }29 + else30 + Zfa_pr_append(nf,rel,N,prod,S1,S2);31 +}32 33 static GEN34 pol_up(GEN rnfeq, GEN x, long v) -
deleted file patches/pari_1144.patch
diff -r 4b9a7ea1dd3f patches/pari_1144.patch
+ - 1 Index: src/basemath/base5.c2 ===================================================================3 --- src/basemath/base5.c (revision 12767)4 +++ src/basemath/base5.c (working copy)5 @@ -65,8 +65,11 @@6 long tc = typ(c);7 switch(tc)8 {9 - case t_POLMOD: c = gel(c,2); /* fall through */10 - case t_POL: c = RgX_RgXQ_eval(c, alpha, polabs); break;11 + case t_POLMOD: c = gel(c,2);12 + if (typ(c) != t_POL) break;13 + c = RgX_RgXQ_eval(c, alpha, polabs); break;14 + case t_POL:15 + c = RgX_RgXQ_eval(c, alpha, polabs); break;16 default:17 if (!is_const_t(tc)) pari_err(talker, "incorrect data in eltreltoabs");18 } -
spkg-check
diff -r 4b9a7ea1dd3f spkg-check
a b 44 44 fi 45 45 46 46 echo "The PARI self-tests all passed" 47 exit 048 -
spkg-install
diff -r 4b9a7ea1dd3f spkg-install
a b 148 148 # prefix kernel with_gmp with_readline 149 149 150 150 # Make flags for building (not installing) PARI/GP 151 PARI_MAKEFLAGS="-k"152 151 if [ "$UNAME" = "CYGWIN" ]; then 153 152 # There are weird bugs in PARI's build process on Windows XP 154 153 # under Cygwin. -
spkg-make
diff -r 4b9a7ea1dd3f spkg-make
a b 46 46 if ! [ -d parisvn ]; then 47 47 svn checkout svn://pari.math.u-bordeaux.fr/pari/trunk parisvn 48 48 fi 49 49 cd parisvn 50 50 51 51 # Download galdata.tgz and seadata-small.tgz 52 [ -f parisvn/galdata.tgz ] || wget -O parisvn/galdata.tgz \ 53 http://pari.math.u-bordeaux.fr/pub/pari/packages/galdata.tgz 54 [ -f parisvn/seadata-small.tgz ] || wget -O parisvn/seadata-small.tgz \ 55 http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata-small.tgz 52 wget --timestamping http://pari.math.u-bordeaux.fr/pub/pari/packages/galdata.tgz 53 wget --timestamping http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata-small.tgz 56 54 57 55 58 56 # Use the specified SVN version 59 cd parisvn 60 svn update -r 12623 # 12623 is PARI 2.4.3 57 svn update -r 13228 # svn revision 13228 is PARI 2.5.0 61 58 62 59 63 60 # make pari (must run bison, etc...) but disable optimization to speed … … 69 66 # Copy the needed files to src using a tar pipe. This is based on code 70 67 # from config/settar. 71 68 # 72 # Add edsrc/desc/pari.desc to remove build-time dependency on perl69 # Add src/desc/pari.desc to remove build-time dependency on perl 73 70 # -- Jeroen Demeyer 74 tar c `config/get_MANIFEST && echo src/desc/pari.desc`| ( cd ../src && tar xv )71 tar -c -T <( config/get_MANIFEST && echo src/desc/pari.desc ) | ( cd ../src && tar xv ) 75 72 76 73 # Save svn version (see config/settar) 77 74 svnversion >../src/config/svnversion