Commit 9d7ea99d authored by Frederic HAN's avatar Frederic HAN
Browse files

0.5.4-r1 update doctest

parent 66afdec5
......@@ -289,3 +289,5 @@ Changelog
- 0.5.4:
+ update giac.dll windows binary to giac 1.2.3-57 with subsop patch
and rowreduction-R55929 patch
+ post1: update win64 giac.dll to fix: interface with pari; matrix mul
for integers
......@@ -621,8 +621,8 @@ cdef class GiacSetting(Pygen):
>>> from giacpy import giacsettings,giac
>>> giacsettings.proba_epsilon=0;giac('proba_epsilon')
0.0
>>> giacsettings.proba_epsilon=10**(-15);giac('proba_epsilon')
1e-15
>>> giacsettings.proba_epsilon=10**(-15);giac('proba_epsilon')=='1e-15'
True
"""
def __get__(self):
......@@ -881,7 +881,7 @@ cdef class Pygen:
Convert a giac integer (type Pygen in python) to a Python <int>
>>> a=giac('2*pi')
>>> list(range(a.floor()))
>>> list(range((a.floor()).__int__()))
[0, 1, 2, 3, 4, 5]
"""
......@@ -4981,6 +4981,17 @@ def moretests():
-515377520732011331036461129765621272702107522001
>>> giac(-11**1000)
-2469932918005826334124088385085221477709733385238396234869182951830739390375433175367866116456946191973803561189036523363533798726571008961243792655536655282201820357872673322901148243453211756020067624545609411212063417307681204817377763465511222635167942816318177424600927358163388910854695041070577642045540560963004207926938348086979035423732739933235077042750354729095729602516751896320598857608367865475244863114521391548985943858154775884418927768284663678512441565517194156946312753546771163991252528017732162399536497445066348868438762510366191040118080751580689254476068034620047646422315123643119627205531371694188794408120267120500325775293645416335230014278578281272863450085145349124727476223298887655183167465713337723258182649072572861625150703747030550736347589416285606367521524529665763903537989935510874657420361426804068643262800901916285076966174176854351055183740078763891951775452021781225066361670593917001215032839838911476044840388663443684517735022039957481918726697789827894303408292584258328090724141496484460001
>>> v=[1,58,1387,17715,131260,578697,1538013,2648041,3687447,4993299,5858116,5979221,5239798,4098561,3176188,1660466,705432]
>>> giac(v)*v
175925584603774
>>> giac([v])*(giac([v]).transpose())
matrix[[175925584603774]]
>>> v=giac('pari()')
>>> if len(v)>200:
... giac('pari(18446744073709551616)')
... else:
... giac('2^64')
18446744073709551616
"""
return
......
......@@ -132,7 +132,7 @@ setup(
name='giacpy',
version='0.5.4',
version='0.5.4-r1',
description='A Cython frontend to the c++ library giac. (Computer Algebra System)',
author='Frederic Han',
author_email="frederic.han@imj-prg.fr",
......
Index: /trunk/geogebra/giac/src/giac/cpp/vecteur.cc
===================================================================
--- src/vecteur.cc (revision 55928)
+++ src/vecteur.cc (revision 55929)
@@ -7180,5 +7180,5 @@
int polydim=0;
int totaldeg=0;
- vector<int> maxdegj(as);
+ vector<int> maxdegj(a0s);
for (unsigned int i=0;i<as;++i){
int maxdegi=0;
@@ -7214,5 +7214,5 @@
for (unsigned int i=0;i<as;++i){
vecteur resxi;
- resxi.reserve(totaldeg+1);
+ resxi.reserve(a0s); // was (totaldeg+1);
for (unsigned int j=0;j<a0s;++j){
const gen & tmp = (*res[i]._VECTptr)[j];
@@ -7243,5 +7243,5 @@
res1=mtran(res1);
Z[x]=vecteur(res1.begin()+lmax,res1.end());
- }
+ } // if (fullreduction)
} // end for x
if (x==totaldeg+1){
@@ -7289,5 +7289,15 @@
}
return 1;
- } // end if interpolation ok (x==totaldeg+1)
+ } // if interpolation ok (x==totaldeg+1)
+ else { // back convert from poly1 to polynome
+ for (unsigned int i=0;i<as;++i){
+ for (unsigned int j=0;j<a0s;++j){
+ gen & tmp = (*res[i]._VECTptr)[j];
+ if (tmp.type==_VECT){
+ tmp=poly12polynome(*tmp._VECTptr,1,polydim);
+ }
+ }
+ }
+ }
} // end if polydim
}
--- src/prog.cc~ 2017-07-09 08:57:19.000000000 +0200
+++ src/prog.cc 2017-08-16 12:03:02.693976660 +0200
@@ -2744,6 +2744,8 @@
// replace in g using equalities in v
gen subsop(const vecteur & g,const vecteur & v,const gen & sommet,GIAC_CONTEXT){
+ if (v.size()==2 && !v[0].is_symb_of_sommet(at_equal))
+ return subsop(g,vecteur(1,symb_equal(v[0],v[1])),sommet,contextptr);
gen newsommet=sommet;
vecteur res(g);
const_iterateur it=v.begin(),itend=v.end();
Index: /trunk/geogebra/giac/src/giac/cpp/vecteur.cc
===================================================================
--- src/vecteur.cc (revision 55928)
+++ src/vecteur.cc (revision 55929)
@@ -7180,5 +7180,5 @@
int polydim=0;
int totaldeg=0;
- vector<int> maxdegj(as);
+ vector<int> maxdegj(a0s);
for (unsigned int i=0;i<as;++i){
int maxdegi=0;
@@ -7214,5 +7214,5 @@
for (unsigned int i=0;i<as;++i){
vecteur resxi;
- resxi.reserve(totaldeg+1);
+ resxi.reserve(a0s); // was (totaldeg+1);
for (unsigned int j=0;j<a0s;++j){
const gen & tmp = (*res[i]._VECTptr)[j];
@@ -7243,5 +7243,5 @@
res1=mtran(res1);
Z[x]=vecteur(res1.begin()+lmax,res1.end());
- }
+ } // if (fullreduction)
} // end for x
if (x==totaldeg+1){
@@ -7289,5 +7289,15 @@
}
return 1;
- } // end if interpolation ok (x==totaldeg+1)
+ } // if interpolation ok (x==totaldeg+1)
+ else { // back convert from poly1 to polynome
+ for (unsigned int i=0;i<as;++i){
+ for (unsigned int j=0;j<a0s;++j){
+ gen & tmp = (*res[i]._VECTptr)[j];
+ if (tmp.type==_VECT){
+ tmp=poly12polynome(*tmp._VECTptr,1,polydim);
+ }
+ }
+ }
+ }
} // end if polydim
}
--- src/prog.cc~ 2017-07-09 08:57:19.000000000 +0200
+++ src/prog.cc 2017-08-16 12:03:02.693976660 +0200
@@ -2744,6 +2744,8 @@
// replace in g using equalities in v
gen subsop(const vecteur & g,const vecteur & v,const gen & sommet,GIAC_CONTEXT){
+ if (v.size()==2 && !v[0].is_symb_of_sommet(at_equal))
+ return subsop(g,vecteur(1,symb_equal(v[0],v[1])),sommet,contextptr);
gen newsommet=sommet;
vecteur res(g);
const_iterateur it=v.begin(),itend=v.end();
--- src/pari.h 2016-01-10 09:19:50.000000000 +0100
+++ src.new/pari.h 2017-08-30 01:25:55.576646358 +0200
@@ -8,7 +8,12 @@
namespace giac {
#endif // ndef NO_NAMESPACE_GIAC
class gen;
+ // pari defines long as long long ifdef _WIN64
+#if defined(_WIN64) && defined(HAVE_LIBPARI)
+ typedef long long * GEN;
+#else
typedef long * GEN;
+#endif
// print e as a PARI parsable string, varnum is the # of the var for poly1
// std::string pariprint(const gen & e,int varnum,GIAC_CONTEXT);
@@ -29,7 +34,11 @@
bool pari_lift_combine(const vecteur & a,const std::vector<vecteur> & factmod,gen & modulo,std::vector<vecteur> & res);
gen _pari(const gen & args,GIAC_CONTEXT);
std::string pari_help(const gen & g);
+#if defined(_WIN64) && defined(HAVE_LIBPARI)
+ bool pari_polroots(const vecteur & p,vecteur & res,long long l,GIAC_CONTEXT);
+#else
bool pari_polroots(const vecteur & p,vecteur & res,long l,GIAC_CONTEXT);
+#endif
gen GEN2gen(const GEN & G,const vecteur & vars);
GEN gen2GEN(const gen & e,const vecteur & vars,GIAC_CONTEXT);
bool pari_polresultant(const gen & p,const gen & q,const vecteur & lv,gen & res,GIAC_CONTEXT);
--- src/pari.cc 2017-03-20 09:54:53.000000000 +0100
+++ src.new/pari.cc 2017-08-30 01:29:20.680064131 +0200
@@ -140,7 +140,7 @@
long Gpl=lgefint(G)-2;
// use one of the following code depending how pari codes long integers
// Code 1
-#if !defined(__APPLE__) && !defined(WIN32)
+#if !defined(__APPLE__) && !defined(WIN32) || defined(WIN64)
ref_mpz_t * mz = new ref_mpz_t;
mpz_realloc2(mz->z,32*Gpl);
mpz_import(mz->z,Gpl,-1,sizeof(GEN),0,0,&G[2]);
@@ -199,11 +199,11 @@
reverse(res.begin(),res.end());
long vn=varn(G);
gen x;
- if (vn<long(vars.size())){
+ if (vn<(long)(vars.size())){
x=vars[vn];
return symb_horner(res,x);
}
- if (!vars.empty() && vn==long(vars.size())){
+ if (!vars.empty() && vn==(long)(vars.size())){
x=vars[vn-1];
return symb_horner(res,x);
}
--- src/vecteur.cc 2017-06-05 20:23:05.000000000 +0200
+++ src.new/vecteur.cc 2017-08-30 11:54:47.041785662 +0200
@@ -4343,7 +4343,7 @@
if (it->type==_INT_){
if (jt->type==_INT_){
longlong x=longlong(it->val)*jt->val;
-#ifdef x86_64
+#if defined(x86_64) && !defined(WIN64)
if (x>=0)
mpz_add_ui(*tmp._ZINTptr,*tmp._ZINTptr,x);
else
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment