Ticket #9898: 9898_pari_decl.patch
File 9898_pari_decl.patch, 46.8 KB (added by , 12 years ago) |
---|
-
sage/libs/pari/decl.pxi
# HG changeset patch # User Jeroen Demeyer <jdemeyer@cage.ugent.be> # Date 1284577877 -7200 # Node ID f6e6a9e6973d6c81bc2ae397d14b5e5ca31a7be0 # Parent 12663152c47016462d0248e5b32740a5a1c406c4 #9898: Clean up and add functions to sage/libs/pari/decl.pxi #9898: Rename GEN_to_str() to new_gen_to_string() and make it act more like new_gen() #9898: Add gen.gequal() and gen.gequal_long() functions diff -r 12663152c470 -r f6e6a9e6973d sage/libs/pari/decl.pxi
a b 1 1 include '../../ext/cdefs.pxi' 2 2 3 cdef extern from "stdlib.h":4 void free(void *ptr)5 void *malloc(size_t size)6 void *realloc(void *ptr, size_t size)7 void exit (int __status)8 9 cdef extern from "string.h":10 void *memmove(void *dest, void *src, size_t n)11 void *memcpy(void *dest, void *src, size_t n)12 13 3 cdef extern from 'setjmp.h': 14 4 struct __jmp_buf_tag: 15 5 pass … … 22 12 cdef extern from 'pari/paricfg.h': 23 13 char* PARIVERSION 24 14 15 25 16 cdef extern from 'pari/pari.h': 26 17 ctypedef long* GEN 27 ctypedef void entree # fake -- not used28 #ctypedef void FILE # fake -- not used29 ctypedef void pariFILE # fake -- not used30 ctypedef void va_list # fake -- not used31 ctypedef void pari_timer # fake -- not used32 ctypedef void stackzone # fake -- not used33 18 34 int new_galois_format 19 # PARI types: these are actually an enum type, but I can't get Pyrex to "properly" 20 # wrap enums. It doesn't matter as long as they are treated as ints by pyrex. 21 extern int t_INT, t_REAL, t_INTMOD, t_FRAC, t_FFELT, t_COMPLEX, t_PADIC, t_QUAD, \ 22 t_POLMOD, t_POL, t_SER, t_RFRAC, t_QFR, t_QFI, t_VEC, t_COL, \ 23 t_MAT, t_LIST, t_STR, t_VECSMALL, t_CLOSURE 24 25 # PARI stack 26 ctypedef unsigned long pari_sp 27 extern pari_sp avma, bot, top 35 28 36 29 37 30 # parigen.h 38 31 32 extern int BITS_IN_LONG 39 33 extern int DEFAULTPREC # 64 bits precision 40 34 extern int MEDDEFAULTPREC # 128 bits precision 41 35 extern int BIGDEFAULTPREC # 192 bits precision … … 87 81 GEN gi 88 82 GEN gen_0 89 83 GEN gnil 84 extern int INIT_JMPm, INIT_SIGm, INIT_DFTm 85 extern int new_galois_format, precdl 90 86 91 87 # level1.h (incomplete!) 92 88 93 GEN cgetc(long x)94 89 GEN cgetg_copy(long lx, GEN x) 95 90 GEN cgetg(long x, long y) 96 91 GEN cgeti(long x) 97 92 GEN cgetr(long x) 93 long itos(GEN x) 98 94 GEN real_0_bit(long bitprec) 95 GEN stoi(long s) 99 96 100 # misc ... 101 long itos(GEN x) 102 double gtodouble(GEN x) 103 GEN stoi(long s) 104 # These types are actually an enum type, but I can't get Pyrex to "properly" 105 # wrap enums. It doesn't matter as long as they are treated as ints by pyrexc. 106 extern int t_INT, t_REAL, t_INTMOD, t_FRAC, t_FFELT, t_COMPLEX, t_PADIC, t_QUAD, \ 107 t_POLMOD, t_POL, t_SER, t_RFRAC, t_QFR, t_QFI, t_VEC, t_COL, \ 108 t_MAT, t_LIST, t_STR, t_VECSMALL, t_CLOSURE 109 110 extern unsigned long precdl 111 extern char * diffptr 112 113 extern int BITS_IN_LONG 114 115 ctypedef unsigned long pari_sp 116 pari_sp avma, bot, top, zonetop 117 118 GEN sd_realprecision(char* n, int flag) 119 120 121 # Flx.c 97 # Flx.c 122 98 123 99 GEN Fl_to_Flx(ulong x, long sv) 124 100 GEN Flm_to_FlxV(GEN x, long sv) … … 185 161 GEN polx_Flx(long sv) 186 162 GEN zero_Flx(long sv) 187 163 188 # alglin1.c 164 # alglin1.c 189 165 190 166 GEN Flm_deplin(GEN x, ulong p) 191 167 GEN Flm_indexrank(GEN x, ulong p) … … 242 218 GEN matmultodiagonal(GEN x, GEN y) 243 219 GEN matsolvemod0(GEN M, GEN D, GEN Y,long flag) 244 220 long rank(GEN x) 245 GEN row(GEN A, long x1)246 GEN row_i(GEN A, long x0, long x1, long x2)247 221 GEN indexrank(GEN x) 248 222 # we rename sum to pari_sum to avoid conflicts with 249 223 # python's sum function 250 224 GEN pari_sum "sum"(GEN v, long a, long b) 251 225 GEN suppl(GEN x) 252 226 GEN vconcat(GEN A, GEN B) 253 GEN vec_ei(long n, long i)254 227 255 # alglin2.c 228 # alglin2.c 256 229 257 230 GEN ZM_to_zm(GEN z) 258 231 GEN adj(GEN x) … … 286 259 GEN zm_to_ZM(GEN z) 287 260 GEN zx_to_ZX(GEN z) 288 261 289 # anal.c 262 # anal.c 290 263 291 void addhelp( entree *ep, char *s)264 void addhelp(char *e, char *s) 292 265 long delete_var() 293 entree *fetch_named_var(char *s)294 266 long fetch_user_var(char *s) 295 267 long fetch_var() 296 268 GEN gp_read_str(char *s) 297 void freeep(entree *ep) 298 entree *gp_variable(char *s) 299 entree* install(void *f, char *name, char *code) 300 entree *is_entry(char *s) 301 void kill0(entree *ep) 302 long manage_var(long n, entree *ep) 269 void kill0(char *e) 303 270 void name_var(long n, char *s) 304 271 GEN readseq(char *t) 305 272 GEN strtoGENstr(char *s) 306 273 GEN type0(GEN x) 307 274 308 # arith1.c 275 # arith1.c 309 276 310 277 GEN bestappr0(GEN x, GEN a, GEN b) 311 278 GEN bestappr(GEN x, GEN k) … … 345 312 GEN lcmii(GEN a, GEN b) 346 313 GEN mpfact(long n) 347 314 GEN mpfactr(long n, long prec) 348 GEN Fp_inv(GEN a, GEN m)349 GEN Fp_invsafe(GEN a, GEN m)350 315 GEN Fp_pow(GEN a, GEN n, GEN m) 351 316 GEN Fp_sqrt(GEN a, GEN p) 352 317 GEN Fp_sqrtn(GEN a, GEN n, GEN p, GEN *zetan) … … 372 337 GEN znprimroot0(GEN m) 373 338 GEN znstar(GEN x) 374 339 375 # arith2.c 340 # arith2.c 376 341 377 342 GEN addprimes(GEN primes) 378 343 long bigomega(GEN n) … … 417 382 GEN sumdiv(GEN n) 418 383 GEN sumdivk(GEN n,long k) 419 384 420 # base1.c 385 # base1.c 421 386 422 387 GEN bnfnewprec(GEN nf, long prec) 423 388 GEN bnrnewprec(GEN bnr, long prec) … … 441 406 GEN gzetakall(GEN nfz, GEN s, long flag, long prec) 442 407 GEN mathnf0(GEN x,long flag) 443 408 GEN matsnf0(GEN x,long flag) 444 long nf_get_r1(GEN nf)445 long nf_get_r2(GEN nf)446 void nf_get_sign(GEN nf, long *r1, long *r2)447 409 GEN nfinit0(GEN x, long flag, long prec) 448 410 GEN nfnewprec(GEN nf, long prec) 449 411 GEN rootsof1(GEN x) 450 412 GEN tschirnhaus(GEN x) 451 413 452 # base2.c 414 # base2.c 453 415 454 416 GEN base(GEN x, GEN *y) 455 417 GEN base2(GEN x, GEN *y) … … 480 442 GEN rnfpseudobasis(GEN nf, GEN pol) 481 443 GEN rnfsimplifybasis(GEN bnf, GEN order) 482 444 483 # base3.c 445 # base3.c 484 446 485 447 GEN algtobasis(GEN nf, GEN x) 486 448 GEN basistoalg(GEN nf, GEN x) … … 498 460 GEN zidealstar(GEN nf, GEN x) 499 461 GEN znlog(GEN x, GEN g) 500 462 501 # base4.c 463 # base4.c 502 464 503 465 GEN nfreduce(GEN nf, GEN x, GEN ideal) 504 466 GEN idealtwoelt(GEN nf, GEN ix) … … 524 486 GEN idealintersect(GEN nf, GEN x, GEN y) 525 487 GEN idealinv(GEN nf, GEN ix) 526 488 GEN idealred0(GEN nf, GEN ix, GEN vdir) 527 GEN idealred_elt(GEN nf, GEN I)528 489 GEN idealmul(GEN nf, GEN ix, GEN iy) 529 490 GEN idealmul0(GEN nf, GEN ix, GEN iy, long flag, long prec) 530 491 GEN idealmulred(GEN nf, GEN ix, GEN iy) … … 546 507 GEN vecmul(GEN x, GEN y) 547 508 GEN vecpow(GEN x, GEN n) 548 509 549 # base5.c 510 # base5.c 550 511 551 512 GEN matalgtobasis(GEN nf, GEN x) 552 513 GEN matbasistoalg(GEN nf, GEN x) … … 567 528 GEN rnfidealup(GEN rnf, GEN x) 568 529 GEN rnfinit(GEN nf, GEN pol) 569 530 570 # bibli1.c 531 # bibli1.c 571 532 572 533 GEN ZM_zc_mul(GEN x, GEN y) 573 534 GEN ZM_zm_mul(GEN x, GEN y) … … 612 573 char *stackmalloc(size_t N) 613 574 GEN zncoppersmith(GEN P0, GEN N, GEN X, GEN B) 614 575 615 # bibli2.c 576 # bibli2.c 616 577 617 578 GEN binomial(GEN x, long k) 618 579 int cmp_prime_ideal(GEN x, GEN y) … … 662 623 GEN vecsort(GEN x, GEN k) 663 624 GEN vecsort0(GEN x, GEN k, long flag) 664 625 665 # buch1.c 626 # buch1.c 666 627 667 628 GEN buchimag(GEN D, GEN gcbach, GEN gcbach2, GEN gCO) 668 629 GEN buchreal(GEN D, GEN gsens, GEN gcbach, GEN gcbach2, GEN gRELSUP, long prec) … … 671 632 GEN quadhilbert(GEN D, long prec) 672 633 GEN quadray(GEN bnf, GEN f, GEN flag, long prec) 673 634 674 # buch2.c 635 # buch2.c 675 636 676 637 GEN bnfinit0(GEN P,long flag,GEN data,long prec) 677 GEN bnf_get_fu(GEN bignf)678 638 GEN check_and_build_obj(GEN S, int tag, GEN (*build)(GEN)) 679 639 GEN isprincipal(GEN bignf, GEN x) 680 640 GEN bnfisprincipal0(GEN bignf, GEN x,long flall) … … 710 670 GEN bnrclassno(GEN bignf,GEN ideal) 711 671 GEN bnrclassnolist(GEN bnf,GEN listes) 712 672 GEN rnfconductor(GEN bnf, GEN polrel, long flag) 713 GEN rnfkummer(GEN bnr, GEN subgroup, long all, long prec)714 673 GEN rnfnormgroup(GEN bnr, GEN polrel) 715 674 GEN subgrouplist0(GEN bnr, GEN indexbound, long all) 716 675 717 # buch4.c 676 # buch4.c 718 677 719 678 GEN bnfisnorm(GEN bnf,GEN x,long flag,long PREC) 720 679 GEN rnfisnorm(GEN S, GEN x, long flag) … … 723 682 long nfhilbert(GEN bnf,GEN a,GEN b) 724 683 long nfhilbert0(GEN bnf,GEN a,GEN b,GEN p) 725 684 685 # default.c 686 687 extern int d_SILENT, d_ACKNOWLEDGE, d_INITRC, d_RETURN 688 GEN default0(char *a, char *b) 689 long getrealprecision() 690 GEN sd_TeXstyle(char *v, long flag) 691 GEN sd_breakloop(char *v, long flag) 692 GEN sd_colors(char *v, long flag) 693 GEN sd_compatible(char *v, long flag) 694 GEN sd_datadir(char *v, long flag) 695 GEN sd_debug(char *v, long flag) 696 GEN sd_debugfiles(char *v, long flag) 697 GEN sd_debugmem(char *v, long flag) 698 GEN sd_echo(char *v, long flag) 699 GEN sd_factor_add_primes(char *v, long flag) 700 GEN sd_factor_proven(char *v, long flag) 701 GEN sd_format(char *v, long flag) 702 GEN sd_graphcolormap(char *v, long flag) 703 GEN sd_graphcolors(char *v, long flag) 704 GEN sd_help(char *v, long flag) 705 GEN sd_histsize(char *v, long flag) 706 GEN sd_lines(char *v, long flag) 707 GEN sd_log(char *v, long flag) 708 GEN sd_logfile(char *v, long flag) 709 GEN sd_new_galois_format(char *v, long flag) 710 GEN sd_output(char *v, long flag) 711 GEN sd_parisize(char *v, long flag) 712 GEN sd_path(char *v, long flag) 713 GEN sd_prettyprinter(char *v, long flag) 714 GEN sd_primelimit(char *v, long flag) 715 GEN sd_prompt(char *v, long flag) 716 GEN sd_prompt_cont(char *v, long flag) 717 GEN sd_psfile(char *v, long flag) 718 GEN sd_realprecision(char *v, long flag) 719 GEN sd_recover(char *v, long flag) 720 GEN sd_rl(char *v, long flag) 721 GEN sd_secure(char *v, long flag) 722 GEN sd_seriesprecision(char *v, long flag) 723 GEN sd_simplify(char *v, long flag) 724 GEN sd_strictmatch(char *v, long flag) 725 GEN sd_timer(char *v, long flag) 726 long setrealprecision(long n, long *prec) 727 726 728 # ellanal.c 727 729 728 730 GEN ellanalyticrank(GEN e, GEN eps, long prec) 729 731 GEN ellL1(GEN e, long r, long prec) 730 732 731 # elliptic.c 733 # elliptic.c 732 734 733 735 GEN addell(GEN e, GEN z1, GEN z2) 734 736 GEN akell(GEN e, GEN n) … … 763 765 GEN weipell(GEN e, long precdl) 764 766 GEN zell(GEN e, GEN z, long prec) 765 767 766 # es.c 768 # es.c 767 769 768 770 GEN GENtoGENstr(GEN x) 769 771 char* GENtoTeXstr(GEN x) … … 785 787 void (*os_signal(int sig, void (*f)(int)))(int) 786 788 void outmat(GEN x) 787 789 void output(GEN x) 788 void pari_fclose(pariFILE *f)789 pariFILE* pari_fopen(char *s, char *mode)790 pariFILE* pari_safefopen(char *s, char *mode)791 790 char* pari_strdup(char *s) 792 791 char* pari_strndup(char *s, long n) 793 792 char* pari_unique_filename(char *s) … … 802 801 void switchin(char *name) 803 802 void switchout(char *name) 804 803 void texe(GEN g, char format, long dec) 805 pariFILE* try_pipe(char *cmd, int flag)806 804 char* type_name(long t) 807 805 void write0(char *s, GEN g) 808 806 void write1(char *s, GEN g) 809 807 void writetex(char *s, GEN g) 810 808 811 # galconj.c 809 # galconj.c 812 810 813 811 GEN checkgal(GEN gal) 814 812 GEN galoisconj0(GEN nf, long flag, GEN d, long prec) … … 824 822 long numberofconjugates(GEN T, long pdepart) 825 823 GEN vandermondeinverse(GEN L, GEN T, GEN den, GEN prep) 826 824 827 # gen1.c 825 # gen1.c 828 826 829 827 GEN gadd(GEN x, GEN y) 830 828 GEN gaddsg(long x, GEN y) … … 833 831 GEN gsqr(GEN x) 834 832 GEN gsub(GEN x, GEN y) 835 833 836 # gen2.c 834 # gen2.c 837 835 838 836 GEN ZX_mul(GEN x, GEN y) 839 837 GEN cgetp(GEN x) … … 884 882 long Z_pval(GEN n, GEN p) 885 883 long Z_pvalrem(GEN x, GEN p, GEN *py) 886 884 887 # gen3.c 885 # gen3.c 888 886 889 887 GEN ceil_safe(GEN x) 890 888 GEN ceilr(GEN x) 891 889 GEN centerlift(GEN x) 892 890 GEN centerlift0(GEN x,long v) 893 GEN mkcoln(long n, ...)894 GEN mkintn(long n, ...)895 GEN mkpoln(long n, ...)896 GEN mkvecn(long n, ...)897 891 GEN compo(GEN x, long n) 898 892 GEN deg1pol(GEN x1, GEN x0,long v) 899 893 long degree(GEN x) … … 991 985 GEN simplify(GEN x) 992 986 GEN tayl(GEN x, long v, long precdl) 993 987 GEN toser_i(GEN x) 994 GEN truecoeff(GEN x, long n)995 988 GEN trunc0(GEN x, GEN *pte) 996 GEN zerocol(long n)997 GEN zeromat(long m, long n)998 GEN zeropadic(GEN p, long e)999 GEN zeropol(long v)1000 GEN zeroser(long v, long prec)1001 GEN zerovec(long n)1002 989 1003 990 # groupid.c 1004 991 1005 992 long group_ident(GEN G, GEN S) 1006 993 1007 # ifactor1.c994 # hash.c 1008 995 1009 long is_357_power(GEN x, GEN *pt, ulong *mask) 996 ulong hash_GEN(GEN x) 997 998 # ifactor1.c 999 1000 int is_357_power(GEN x, GEN *pt, ulong *mask) 1001 int is_pth_power(GEN x, GEN *pt, ulong *curexp, ulong cutoffbits) 1010 1002 GEN nextprime(GEN n) 1011 1003 GEN precprime(GEN n) 1012 1004 1013 # init.c 1005 # init.c 1014 1006 1015 long TIMER(pari_timer *T)1016 void TIMERstart(pari_timer *T)1017 1007 long allocatemoremem(size_t newsize) 1018 1008 GEN changevar(GEN x, GEN y) 1019 1009 void pari_err(long numerr, ...) 1020 1010 long err_catch(long errnum, jmp_buf *penv) 1021 1011 GEN gcopy(GEN x) 1022 GEN gerepile(pari_sp ltop, pari_sp lbot, GEN q)1023 void gerepileall(pari_sp av, int n, ...)1024 void gerepileallsp(pari_sp av, pari_sp tetpil, int n, ...)1025 void gerepilecoeffs(pari_sp av, GEN x, int n)1026 void gerepilecoeffssp(pari_sp av, pari_sp tetpil, long *g, int n)1027 GEN gerepilecopy(pari_sp av, GEN x)1028 void gerepilemany(pari_sp av, GEN* g[], int n)1029 void gerepilemanysp(pari_sp av, pari_sp tetpil, GEN* g[], int n)1030 GEN gerepileupto(pari_sp av, GEN q)1031 GEN gerepileuptoint(pari_sp av, GEN q)1032 GEN gerepileuptoleaf(pari_sp av, GEN q)1033 char* pari_malloc(size_t bytes)1034 char* pari_realloc(void *pointer,size_t size)1035 1012 void gunclone(GEN x) 1036 void killblock(GEN x)1037 void msgTIMER(pari_timer *T, char *format, ...)1038 1013 void msgtimer(char *format, ...) 1039 1014 GEN newblock(long n) 1040 1015 void pari_close() … … 1046 1021 long timer() 1047 1022 long timer2() 1048 1023 1049 # members.c 1024 # intnum.c 1025 1026 GEN intcirc(void *E, GEN (*eval) (GEN, void *), GEN a, GEN R, GEN tab, long prec) 1027 GEN intfouriercos(void *E, GEN (*eval) (GEN, void *), GEN a, GEN b, GEN x, GEN tab, long prec) 1028 GEN intfourierexp(void *E, GEN (*eval)(GEN, void*), GEN a, GEN b, GEN x, GEN tab, long prec) 1029 GEN intfouriersin(void *E, GEN (*eval) (GEN, void *), GEN a, GEN b, GEN x, GEN tab, long prec) 1030 GEN intfuncinit(void *E, GEN (*eval) (GEN, void *), GEN a, GEN b, long m, long flag, long prec) 1031 GEN intlaplaceinv(void *E, GEN (*eval) (GEN, void *), GEN sig, GEN x, GEN tab, long prec) 1032 GEN intmellininv(void *E, GEN (*eval) (GEN, void *), GEN sig, GEN x, GEN tab, long prec) 1033 GEN intmellininvshort(GEN sig, GEN x, GEN tab, long prec) 1034 GEN intnum(void *E, GEN (*eval) (GEN, void *), GEN a, GEN b, GEN tab, long prec) 1035 GEN intnuminit(GEN a, GEN b, long m, long prec) 1036 GEN intnuminitgen(void *E, GEN (*eval) (GEN, void *), GEN a, GEN b, long m, long flext, long prec) 1037 GEN intnumromb(void *E, GEN (*eval) (GEN, void *), GEN a, GEN b, long flag, long prec) 1038 long intnumstep(long prec) 1039 GEN sumnum(void *E, GEN (*f) (GEN, void *), GEN a, GEN sig, GEN tab, long flag, long prec) 1040 GEN sumnumalt(void *E, GEN (*f) (GEN, void *), GEN a, GEN s, GEN tab, long flag, long prec) 1041 GEN sumnuminit(GEN sig, long m, long sgn, long prec) 1042 1043 # kummer.c 1044 1045 GEN rnfkummer(GEN bnr, GEN subgroup, long all, long prec) 1046 1047 # members.c 1050 1048 1051 1049 GEN member_a1(GEN x) 1052 1050 GEN member_a2(GEN x) … … 1093 1091 GEN member_zk(GEN x) 1094 1092 GEN member_zkst(GEN bid) 1095 1093 1096 # mp.c 1094 # mp.c 1097 1095 1098 1096 int absi_cmp(GEN x, GEN y) 1099 1097 int absi_equal(GEN x, GEN y) … … 1108 1106 void affrr(GEN x, GEN y) 1109 1107 GEN bezout(GEN a, GEN b, GEN *u, GEN *v) 1110 1108 long cbezout(long a,long b,long *uu,long *vv) 1111 void cgiv(GEN x)1112 1109 int cmpii(GEN x, GEN y) 1113 1110 int cmprr(GEN x, GEN y) 1114 1111 int cmpsi(long x, GEN y) … … 1155 1152 ulong umodiu(GEN y, ulong x) 1156 1153 long vals(ulong x) 1157 1154 1158 # nffactor.c 1155 # nffactor.c 1159 1156 1160 1157 GEN nffactor(GEN nf,GEN x) 1161 1158 GEN nffactormod(GEN nf,GEN pol,GEN pr) … … 1163 1160 GEN rnfcharpoly(GEN nf,GEN T,GEN alpha,int n) 1164 1161 GEN rnfdedekind(GEN nf,GEN T,GEN pr) 1165 1162 1166 # part.c 1163 # part.c 1167 1164 1168 1165 GEN numbpart(GEN x) 1169 1166 1170 # perm.c 1167 # perm.c 1171 1168 1172 1169 GEN abelian_group(GEN G) 1173 1170 GEN cyclicgroup(GEN g, long s) … … 1191 1188 GEN groupelts_abelian_group(GEN S) 1192 1189 int perm_commute(GEN p, GEN q) 1193 1190 GEN perm_cycles(GEN v) 1194 GEN perm_inv(GEN x)1195 GEN perm_mul(GEN s, GEN t)1196 1191 long perm_order(GEN perm) 1197 1192 GEN perm_pow(GEN perm, long exp) 1198 1193 GEN quotient_group(GEN C, GEN G) 1199 1194 GEN quotient_perm(GEN C, GEN p) 1200 GEN vec_to_vecsmall(GEN z)1201 1195 GEN vecperm_orbits(GEN v, long n) 1202 GEN vecsmall_append(GEN V, long s)1203 long vecsmall_coincidence(GEN u, GEN v)1204 GEN vecsmall_concat(GEN u, GEN v)1205 GEN vecsmall_copy(GEN x)1206 int vecsmall_lexcmp(GEN x, GEN y)1207 long vecsmall_pack(GEN V, long base, long mod)1208 int vecsmall_prefixcmp(GEN x, GEN y)1209 GEN vecsmall_prepend(GEN V, long s)1210 GEN vecsmall_shorten(GEN v, long n)1211 1196 void vecsmall_sort(GEN V) 1212 GEN vecsmall_to_col(GEN z)1213 GEN vecsmall_to_vec(GEN z)1214 1197 GEN vecsmall_uniq(GEN V) 1215 1198 GEN vecvecsmall_indexsort(GEN x) 1216 1199 GEN vecvecsmall_sort(GEN x) 1217 1200 long vecvecsmall_search(GEN x, GEN y, long flag) 1218 1201 1219 # polarit1.c 1202 # polarit1.c 1220 1203 1221 1204 long Flx_nbfact(GEN z, ulong p) 1222 1205 long Flx_nbroots(GEN f, ulong p) … … 1251 1234 GEN rootpadicfast(GEN f, GEN p, long e) 1252 1235 GEN simplefactmod(GEN f, GEN p) 1253 1236 1254 # polarit2.c 1237 # polarit2.c 1255 1238 1256 1239 GEN Q_content(GEN x) 1257 1240 GEN Q_denom(GEN x) … … 1312 1295 GEN vecbezout(GEN x, GEN y) 1313 1296 GEN vecbezoutres(GEN x, GEN y) 1314 1297 1315 # polarit3.c 1298 # polarit3.c 1316 1299 1317 1300 GEN Fp_pows(GEN A, long k, GEN N) 1318 1301 GEN Fp_powu(GEN x, ulong k, GEN p) … … 1389 1372 GEN ZX_resultant(GEN A, GEN B) 1390 1373 long brent_kung_optpow(long d, long n) 1391 1374 1392 # RgX.c 1375 # RgX.c 1393 1376 1394 1377 int RgX_is_rational(GEN x) 1395 1378 GEN RgM_to_RgXV(GEN x, long v) … … 1415 1398 GEN RgXX_to_RgM(GEN v, long n) 1416 1399 GEN RgXY_swap(GEN x, long n, long w) 1417 1400 1418 # rootpol.c 1401 # rootpol.c 1419 1402 1420 1403 GEN cleanroots(GEN x,long l) 1421 1404 int isrealappr(GEN x, long l) 1422 1405 GEN roots(GEN x,long l) 1423 1406 GEN roots0(GEN x,long flag,long l) 1424 1407 1425 # subcyclo.c 1408 # subcyclo.c 1426 1409 1427 1410 GEN galoissubcyclo(GEN N, GEN sg, long flag, long v) 1428 1411 GEN polsubcyclo(long n, long d, long v) 1429 1412 GEN znstar_small(GEN zn) 1430 1413 1431 # subfield.c 1414 # subfield.c 1432 1415 1433 1416 GEN nfsubfields(GEN nf, long d) 1434 1417 1435 # subgroup.c 1418 # subgroup.c 1436 1419 1437 void forsubgroup(entree *oep, GEN cyc, GEN bound, char *och)1438 1420 GEN subgrouplist(GEN cyc, GEN bound) 1421 void traversesubgroups(GEN cyc, GEN B, void fun(GEN,void*), void *E) 1439 1422 1440 # stark.c 1423 # stark.c 1441 1424 1442 1425 GEN bnrL1(GEN bnr, GEN sbgrp, long flag, long prec) 1443 1426 GEN bnrrootnumber(GEN bnr, GEN chi, long flag, long prec) 1444 1427 GEN bnrstark(GEN bnr, GEN subgroup, long prec) 1445 1428 1446 # sumiter.c 1429 # sumiter.c 1447 1430 1431 GEN derivnum(void *E, GEN (*eval)(GEN,void*), GEN x, long prec) 1448 1432 GEN direuler(void *E, GEN (*eval)(GEN,void*), GEN ga, GEN gb, GEN c) 1449 GEN direuler0(entree *ep, GEN a, GEN b, char *ch, GEN c)1450 GEN divsum(GEN num,entree *ep, char *ch)1451 void fordiv(GEN a, entree *ep, char *ch)1452 void forpari(entree *ep, GEN a, GEN b, char *ch)1453 void forprime(entree *ep, GEN a, GEN b, char *ch)1454 void forstep(entree *ep, GEN a, GEN b, GEN s, char *ch)1455 void forvec(entree *ep, GEN x, char *ch, long flag)1456 1433 GEN forvec_start(GEN x, long flag, GEN *d, GEN (**next)(GEN,GEN)) 1457 GEN intnum(void *E, GEN (*e)(GEN, void*), GEN a,GEN b, GEN tab, long prec)1458 long intnumstep(long prec)1459 GEN intnumromb0(entree *ep, GEN a, GEN b, char *ch, long flag, long prec)1460 GEN intnum0(entree *ep, GEN a, GEN b, char *ch, GEN tab, long prec)1461 GEN intcirc0(entree *ep, GEN a, GEN R, char *ch, GEN tab, long prec)1462 GEN intmellininv0(entree *ep, GEN sig, GEN x, char *ch, GEN tab, long prec)1463 GEN intmellininvshort(GEN sig, GEN x, GEN tab, long prec)1464 GEN intlaplaceinv0(entree *ep, GEN sig, GEN x, char *ch, GEN tab, long prec)1465 GEN intfoursin0(entree *ep, GEN a, GEN b, GEN x, char *ch, GEN tab, long prec)1466 GEN intfourcos0(entree *ep, GEN a, GEN b, GEN x, char *ch, GEN tab, long prec)1467 GEN intfourexp0(entree *ep, GEN a, GEN b, GEN x, char *ch, GEN tab, long prec)1468 GEN sumnum(void *E, GEN (*f)(GEN,void*), GEN a,GEN sig,GEN tab,long flag,long prec)1469 GEN sumnum0(entree *ep, GEN a, GEN sig, char *ch, GEN tab, long flag, long prec)1470 GEN sumnumalt(void *E, GEN (*f)(GEN,void*),GEN a,GEN s,GEN tab,long flag,long prec)1471 GEN sumnumalt0(entree *ep, GEN a, GEN sig, char *ch, GEN tab, long flag, long prec)1472 GEN matrice(GEN nlig, GEN ncol,entree *ep1, entree *ep2, char *ch)1473 1434 GEN polzag(long n, long m) 1474 1435 GEN prodeuler(void *E, GEN (*eval)(GEN,void*), GEN ga, GEN gb, long prec) 1475 GEN prodeuler0(entree *ep, GEN a, GEN b, char *ch, long prec)1476 1436 GEN prodinf(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1477 GEN prodinf0(entree *ep, GEN a, char *ch, long flag, long prec)1478 1437 GEN prodinf1(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1479 GEN produit(entree *ep, GEN a, GEN b, char *ch, GEN x)1480 GEN somme(entree *ep, GEN a, GEN b, char *ch, GEN x)1481 1438 GEN sumalt(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1482 GEN sumalt0(entree *ep, GEN a, char *ch,long flag, long prec)1483 1439 GEN sumalt2(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1484 1440 GEN sumpos(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1485 1441 GEN sumpos2(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1486 GEN sumpos0(entree *ep, GEN a, char *ch, long flag,long prec)1487 1442 GEN suminf(void *E, GEN (*eval)(GEN,void*), GEN a, long prec) 1488 GEN suminf0(entree *ep, GEN a, char *ch, long prec)1489 GEN vecteur(GEN nmax, entree *ep, char *ch)1490 GEN vecteursmall(GEN nmax, entree *ep, char *ch)1491 GEN vvecteur(GEN nmax, entree *ep, char *ch)1492 GEN zbrent0(entree *ep, GEN a, GEN b, char *ch, long prec)1493 1443 GEN zbrent(void *E, GEN (*eval)(GEN,void*), GEN a, GEN b, long prec) 1494 1444 1495 # thue.c 1445 # thue.c 1496 1446 1497 1447 GEN bnfisintnorm(GEN x, GEN y) 1498 1448 GEN thue(GEN thueres, GEN rhs, GEN ne) 1499 1449 GEN thueinit(GEN pol, long flag, long prec) 1500 1450 1501 # trans1.c 1451 # trans1.c 1502 1452 1503 1453 GEN Pi2n(long n, long prec) 1504 1454 GEN PiI2(long prec) … … 1526 1476 GEN mppi(long prec) 1527 1477 GEN mpsin(GEN x) 1528 1478 void mpsincos(GEN x, GEN *s, GEN *c) 1529 GEN sqrtr(GEN x)1530 GEN sqrtnr(GEN x, long n)1531 1479 GEN powgi(GEN x, GEN n) 1532 1480 GEN teich(GEN x) 1533 1481 1534 # trans2.c 1482 # trans2.c 1535 1483 1536 1484 GEN bernfrac(long n) 1537 1485 GEN bernreal(long n, long prec) … … 1552 1500 GEN gth(GEN x, long prec) 1553 1501 void mpbern(long nomb, long prec) 1554 1502 1555 # trans3.c 1503 # trans3.c 1556 1504 1557 1505 GEN agm(GEN x, GEN y, long prec) 1558 1506 GEN dilog(GEN x, long prec) … … 1586 1534 GEN weberf(GEN x, long prec) 1587 1535 GEN weberf2(GEN x, long prec) 1588 1536 1537 # gmp/int.h 1538 long* int_MSW(GEN x) 1539 long* int_LSW(GEN x) 1540 long* int_precW(long * xp) 1541 long* int_nextW(long * xp) 1542 1543 # misc... 1544 extern char* diffptr 1545 1546 1547 # Inline functions in separate file 1548 include 'declinl.pxi' 1549 1589 1550 1590 1551 cdef extern from 'pari/paripriv.h': 1591 1552 struct __x: 1592 char format # e,f,g 1593 long fieldw # 0 (ignored) or field width 1553 char format # e,f,g 1554 long fieldw # 0 (ignored) or field width 1594 1555 long sigd # -1 (all) or number of significant digits printed */ 1595 1556 int sp # 0 = suppress whitespace from output */ 1596 1557 int prettyp # output style: raw, prettyprint, etc */ … … 1603 1564 ctypedef __z gp_data 1604 1565 extern gp_data* GP_DATA 1605 1566 1606 long * int_MSW(GEN x)1607 long * int_LSW(GEN x)1608 long * int_precW(long * xp)1609 long * int_nextW(long * xp)1610 1567 1611 1568 cdef extern: # paristio.h 1612 1569 ctypedef struct PariOUT: -
new file sage/libs/pari/declinl.pxi
diff -r 12663152c470 -r f6e6a9e6973d sage/libs/pari/declinl.pxi
- + 1 r""" 2 Declarations for inline functions from PARI. 3 4 This file contains all declarations from headers/pariinl.h from the 5 PARI distribution. All these functions are simple inline functions. 6 7 8 AUTHORS: 9 10 - Jeroen Demeyer (2010-08-15): initial version 11 12 """ 13 14 cdef extern: 15 16 ################################################################### 17 # # 18 # CONSTRUCTORS # 19 # # 20 ################################################################### 21 22 GEN mkintmod(GEN x, GEN y) 23 GEN mkintmodu(ulong x, ulong y) 24 GEN mkpolmod(GEN x, GEN y) 25 GEN mkfrac(GEN x, GEN y) 26 GEN mkfraccopy(GEN x, GEN y) 27 GEN mkrfrac(GEN x, GEN y) 28 GEN mkcomplex(GEN x, GEN y) 29 GEN gen_I() 30 GEN cgetc(long l) 31 GEN mkquad(GEN n, GEN x, GEN y) 32 GEN mkvecsmall(long x) 33 GEN mkvecsmall2(long x,long y) 34 GEN mkvecsmall3(long x,long y,long z) 35 GEN mkvecsmall4(long x,long y,long z,long t) 36 GEN mkvec(GEN x) 37 GEN mkvec2(GEN x, GEN y) 38 GEN mkvec3(GEN x, GEN y, GEN z) 39 GEN mkvec4(GEN x, GEN y, GEN z, GEN t) 40 GEN mkvec5(GEN x, GEN y, GEN z, GEN t, GEN u) 41 GEN mkvecs(long x) 42 GEN mkvec2s(long x, long y) 43 GEN mkvec3s(long x, long y, long z) 44 GEN mkveccopy(GEN x) 45 GEN mkvec2copy(GEN x, GEN y) 46 GEN mkcol(GEN x) 47 GEN mkcol2(GEN x, GEN y) 48 GEN mkcolcopy(GEN x) 49 GEN mkmat(GEN x) 50 GEN mkmat2(GEN x, GEN y) 51 GEN mkmatcopy(GEN x) 52 GEN pol_x(long v) 53 GEN pol_1(long v) 54 GEN const_vec(long n, GEN x) 55 GEN const_col(long n, GEN x) 56 GEN const_vecsmall(long n, long c) 57 58 ### Zero ### 59 GEN zeropadic(GEN p, long e) 60 GEN zeroser(long v, long e) 61 GEN zeropol(long v) 62 GEN zerocol(long n) 63 GEN zerovec(long n) 64 GEN zeromat(long m, long n) 65 GEN zero_Flx(long sv) 66 GEN zero_Flv(long n) 67 GEN zero_Flm(long m, long n) 68 GEN zero_F2v(long m) 69 GEN zero_F2m(long m, long n) 70 GEN zero_F2m_copy(long m, long n) 71 GEN zeromatcopy(long m, long n) 72 73 GEN col_ei(long n, long i) 74 GEN vec_ei(long n, long i) 75 GEN vecsmall_ei(long n, long i) 76 GEN Rg_col_ei(GEN x, long n, long i) 77 GEN shallowcopy(GEN x) 78 GEN vecsmall_copy(GEN x) 79 GEN vectrunc_init(long l) 80 void vectrunc_append(GEN x, GEN t) 81 GEN vecsmalltrunc_init(long l) 82 void vecsmalltrunc_append(GEN x, long t) 83 84 ################################################################### 85 # # 86 # VEC / COL / VECSMALL # 87 # # 88 ################################################################### 89 90 GEN vec_shorten(GEN v, long n) 91 GEN vec_lengthen(GEN v, long n) 92 GEN vec_setconst(GEN v, GEN x) 93 GEN vecsmall_shorten(GEN v, long n) 94 GEN vecsmall_lengthen(GEN v, long n) 95 GEN vec_to_vecsmall(GEN z) 96 GEN vecsmall_to_vec(GEN z) 97 GEN vecsmall_to_col(GEN z) 98 int vecsmall_lexcmp(GEN x, GEN y) 99 int vecsmall_prefixcmp(GEN x, GEN y) 100 GEN vecsmall_prepend(GEN V, long s) 101 GEN vecsmall_append(GEN V, long s) 102 GEN vecsmall_concat(GEN u, GEN v) 103 long vecsmall_coincidence(GEN u, GEN v) 104 long vecsmall_isin(GEN v, long x) 105 long vecsmall_pack(GEN V, long base, long mod) 106 long vecsmall_max(GEN x) 107 long vecsmall_min(GEN x) 108 int ZV_isscalar(GEN x) 109 int QV_isscalar(GEN x) 110 int RgV_isscalar(GEN x) 111 int RgX_isscalar(GEN x) 112 int RgX_is_rational(GEN x) 113 int RgX_is_ZX(GEN x) 114 int RgX_is_monomial(GEN x) 115 int RgM_is_ZM(GEN x) 116 117 ################################################################### 118 # # 119 # Dynamic arrays implementation # 120 # # 121 ################################################################### 122 123 # Omitted 124 125 ################################################################### 126 # # 127 # EXTRACT # 128 # # 129 ################################################################### 130 131 GEN vecslice(GEN A, long y1, long y2) 132 GEN vecslicepermute(GEN A, GEN p, long y1, long y2) 133 GEN rowslicepermute(GEN A, GEN p, long x1, long x2) 134 GEN rowslice(GEN A, long x1, long x2) 135 GEN row(GEN A, long x0) 136 GEN row_Flm(GEN A, long x0) 137 GEN rowcopy(GEN A, long x0) 138 GEN row_i(GEN A, long x0, long x1, long x2) 139 GEN vecreverse(GEN A) 140 GEN vecpermute(GEN A, GEN p) 141 GEN rowpermute(GEN A, GEN p) 142 void vecselect_p(GEN A, GEN B, GEN p, long init, long lB) 143 void rowselect_p(GEN A, GEN B, GEN p, long init) 144 145 ################################################################### 146 # # 147 # PERMUTATIONS # 148 # # 149 ################################################################### 150 151 GEN identity_perm(long n) 152 GEN cyclic_perm(long n, long d) 153 GEN perm_mul(GEN s, GEN t) 154 GEN perm_inv(GEN x) 155 GEN perm_conj(GEN s, GEN t) 156 157 ################################################################### 158 # # 159 # MALLOC/FREE WRAPPERS # 160 # # 161 ################################################################### 162 163 void pari_free(void *pointer) 164 void* pari_malloc(size_t size) 165 void* pari_realloc(void *pointer, size_t size) 166 void* pari_calloc(size_t size) 167 GEN cgetalloc(long t, size_t l) 168 169 ################################################################### 170 # # 171 # GARBAGE COLLECTION # 172 # # 173 ################################################################### 174 175 GEN icopy_avma(GEN x, pari_sp av) 176 GEN gerepileuptoleaf(pari_sp av, GEN x) 177 GEN gerepileuptoint(pari_sp av, GEN x) 178 GEN gerepileupto(pari_sp av, GEN x) 179 GEN gerepilecopy(pari_sp av, GEN x) 180 void gerepilemany(pari_sp av, GEN* gptr[], int n) 181 void gerepileall(pari_sp av, int n, ...) 182 void gerepilecoeffs(pari_sp av, GEN x, int n) 183 void gerepilecoeffs2(pari_sp av, GEN x, int n, GEN y, int o) 184 void cgiv(GEN x) 185 void killblock(GEN x) 186 int is_universal_constant(GEN x) 187 188 ################################################################### 189 # # 190 # CONVERSION / ASSIGNMENT # 191 # # 192 ################################################################### 193 194 GEN cxcompotor(GEN z, long prec) 195 GEN cxtofp(GEN x, long prec) 196 double gtodouble(GEN x) 197 long gtos(GEN x) 198 GEN absfrac(GEN x) 199 GEN Q_abs(GEN x) 200 GEN gtofp(GEN z, long prec) 201 GEN RgX_gtofp(GEN x, long prec) 202 GEN RgC_gtofp(GEN x, long prec) 203 GEN RgM_gtofp(GEN x, long prec) 204 GEN RgX_fpnorml2(GEN x, long prec) 205 GEN RgC_fpnorml2(GEN x, long prec) 206 GEN RgM_fpnorml2(GEN x, long prec) 207 void affgr(GEN x, GEN y) 208 GEN affc_fixlg(GEN x, GEN res) 209 GEN trunc_safe(GEN x) 210 211 ################################################################### 212 # # 213 # LENGTH CONVERSIONS # 214 # # 215 ################################################################### 216 217 # Omitted 218 219 ################################################################### 220 # # 221 # OPERATIONS MODULO m # 222 # # 223 ################################################################### 224 225 GEN Fp_red(GEN a, GEN m) 226 GEN Fp_add(GEN a, GEN b, GEN m) 227 GEN Fp_sub(GEN a, GEN b, GEN m) 228 GEN Fp_neg(GEN b, GEN m) 229 GEN Fp_center(GEN u, GEN p, GEN ps2) 230 GEN Fp_mul(GEN a, GEN b, GEN m) 231 GEN Fp_sqr(GEN a, GEN m) 232 GEN Fp_mulu(GEN a, ulong b, GEN m) 233 GEN Fp_inv(GEN a, GEN m) 234 GEN Fp_invsafe(GEN a, GEN m) 235 GEN Fp_div(GEN a, GEN b, GEN m) 236 237 ################################################################### 238 # # 239 # GEN SUBTYPES # 240 # # 241 ################################################################### 242 243 int is_const_t(long t) 244 int is_extscalar_t(long t) 245 int is_intreal_t(long t) 246 int is_matvec_t(long t) 247 int is_noncalc_t(long tx) 248 int is_rational_t(long t) 249 int is_recursive_t(long t) 250 int is_scalar_t(long t) 251 int is_vec_t(long t) 252 253 ################################################################### 254 # # 255 # TRANSCENDENTAL # 256 # # 257 ################################################################### 258 259 GEN sqrtr(GEN x) 260 GEN sqrtnr(GEN x, long n) 261 262 ################################################################### 263 # # 264 # MISCELLANEOUS # 265 # # 266 ################################################################### 267 268 int isintzero(GEN x) 269 int isint1(GEN x) 270 int isintm1(GEN x) 271 int equali1(GEN n) 272 int equalim1(GEN n) 273 int is_pm1(GEN n) 274 int is_bigint(GEN n) 275 276 # Many functions omitted 277 278 ### POLYNOMIALS 279 GEN constant_term(GEN x) 280 GEN leading_term(GEN x) 281 long degpol(GEN x) 282 long lgpol(GEN x) 283 GEN truecoeff(GEN x, long n) 284 285 ################################################################### 286 # # 287 # ASSIGNMENTS # 288 # # 289 ################################################################### 290 291 # Omitted 292 293 ################################################################### 294 # # 295 # ELLIPTIC CURVES # 296 # # 297 ################################################################### 298 299 GEN ell_get_a1(GEN e) 300 GEN ell_get_a2(GEN e) 301 GEN ell_get_a3(GEN e) 302 GEN ell_get_a4(GEN e) 303 GEN ell_get_a6(GEN e) 304 GEN ell_get_b2(GEN e) 305 GEN ell_get_b4(GEN e) 306 GEN ell_get_b6(GEN e) 307 GEN ell_get_b8(GEN e) 308 GEN ell_get_c4(GEN e) 309 GEN ell_get_c6(GEN e) 310 GEN ell_get_disc(GEN e) 311 GEN ell_get_j(GEN e) 312 GEN ell_get_roots(GEN e) 313 314 int ell_is_inf(GEN z) 315 int ell_is_padic(GEN x) 316 int ell_is_real(GEN x) 317 318 ################################################################### 319 # # 320 # ALGEBRAIC NUMBER THEORY # 321 # # 322 ################################################################### 323 324 GEN pr_get_p(GEN pr) 325 GEN pr_get_gen(GEN pr) 326 long pr_get_e(GEN pr) 327 long pr_get_f(GEN pr) 328 GEN pr_get_tau(GEN pr) 329 int pr_is_inert(GEN P) 330 GEN pr_norm(GEN pr) 331 332 long nf_get_varn(GEN nf) 333 GEN nf_get_pol(GEN nf) 334 long nf_get_degree(GEN nf) 335 long nf_get_r1(GEN nf) 336 long nf_get_r2(GEN nf) 337 GEN nf_get_disc(GEN nf) 338 GEN nf_get_index(GEN nf) 339 GEN nf_get_M(GEN nf) 340 GEN nf_get_G(GEN nf) 341 GEN nf_get_roundG(GEN nf) 342 GEN nf_get_Tr(GEN nf) 343 GEN nf_get_TrInv(GEN nf) 344 GEN nf_get_roots(GEN nf) 345 GEN nf_get_zk(GEN nf) 346 GEN nf_get_invzk(GEN nf) 347 void nf_get_sign(GEN nf, long *r1, long *r2) 348 349 GEN bnf_get_nf(GEN bnf) 350 GEN bnf_get_clgp(GEN bnf) 351 GEN bnf_get_no(GEN bnf) 352 GEN bnf_get_cyc(GEN bnf) 353 GEN bnf_get_gen(GEN bnf) 354 GEN bnf_get_reg(GEN bnf) 355 GEN bnf_get_logfu(GEN bnf) 356 GEN bnf_get_tuU(GEN bnf) 357 long bnf_get_tuN(GEN bnf) 358 GEN bnf_get_fu(GEN bnf) 359 GEN bnf_get_fu_nocheck(GEN bnf) 360 361 GEN bnr_get_bnf(GEN bnr) 362 GEN bnr_get_bid(GEN bnr) 363 GEN bnr_get_mod(GEN bnr) 364 GEN bnr_get_nf(GEN bnr) 365 GEN bnr_get_no(GEN bnr) 366 GEN bnr_get_cyc(GEN bnr) 367 GEN bnr_get_gen_nocheck(GEN bnr) 368 GEN bnr_get_gen(GEN bnr) 369 370 GEN bid_get_mod(GEN bid) 371 GEN bid_get_ideal(GEN bid) 372 GEN bid_get_arch(GEN bid) 373 GEN bid_get_cyc(GEN bid) 374 GEN bid_get_gen_nocheck(GEN bid) 375 GEN bid_get_gen(GEN bid) 376 377 GEN gal_get_pol(GEN gal) 378 GEN gal_get_p(GEN gal) 379 GEN gal_get_e(GEN gal) 380 GEN gal_get_mod(GEN gal) 381 GEN gal_get_roots(GEN gal) 382 GEN gal_get_invvdm(GEN gal) 383 GEN gal_get_den(GEN gal) 384 GEN gal_get_group(GEN gal) 385 GEN gal_get_gen(GEN gal) 386 GEN gal_get_orders(GEN gal) 387 388 long rnf_get_degree(GEN rnf) 389 390 GEN idealpseudomin(GEN I, GEN G) 391 GEN idealpseudomin_nonscalar(GEN I, GEN G) 392 GEN idealred_elt(GEN nf, GEN I) 393 GEN idealred(GEN nf, GEN I) -
sage/libs/pari/gen.pxd
diff -r 12663152c470 -r f6e6a9e6973d sage/libs/pari/gen.pxd
a b 19 19 cdef class PariInstance(sage.structure.parent_base.ParentWithBase): 20 20 cdef gen PARI_ZERO, PARI_ONE, PARI_TWO 21 21 cdef gen new_gen(self, GEN x) 22 cdef object new_gen_to_string(self, GEN x) 22 23 cdef gen new_gen_noclear(self, GEN x) 23 24 cdef gen new_gen_from_mpz_t(self, mpz_t value) 24 25 cdef gen new_gen_from_mpq_t(self, mpq_t value) … … 34 35 cdef gen new_ref(self, GEN g, gen parent) 35 36 cdef gen _empty_vector(self, long n) 36 37 cdef int get_var(self, v) 37 cdef object GEN_to_str(self, GEN g)38 38 cdef GEN toGEN(self, x, int i) except NULL 39 39 cdef GEN integer_matrix_GEN(self, mpz_t** B, Py_ssize_t nr, Py_ssize_t nc) except <GEN>0 40 40 cdef GEN integer_matrix_permuted_for_hnf_GEN(self, mpz_t** B, Py_ssize_t nr, Py_ssize_t nc) except <GEN>0 -
sage/libs/pari/gen.pyx
diff -r 12663152c470 -r f6e6a9e6973d sage/libs/pari/gen.pyx
a b 412 412 sage_free(<void*> self.b) 413 413 414 414 def __repr__(self): 415 return P.GEN_to_str(self.g) 415 _sig_on 416 return P.new_gen_to_string(self.g) 416 417 417 418 def __hash__(self): 418 return hash(P.GEN_to_str(self.g)) 419 _sig_on 420 return hash(P.new_gen_to_string(self.g)) 419 421 420 422 def _testclass(self): 421 423 import test … … 1435 1437 1436 1438 1437 1439 ########################################### 1440 # Comparisons (from PARI) 1441 ########################################### 1442 1443 def gequal(gen a, b): 1444 r""" 1445 Check whether `a` and `b` are equal using PARI's ``gequal``. 1446 1447 EXAMPLES:: 1448 1449 sage: a = pari(1); b = pari(1.0); c = pari('"some_string"') 1450 sage: a.gequal(a) 1451 True 1452 sage: b.gequal(b) 1453 True 1454 sage: c.gequal(c) 1455 True 1456 sage: a.gequal(b) 1457 True 1458 sage: a.gequal(c) 1459 False 1460 1461 WARNING: this relation is not transitive:: 1462 1463 sage: a = pari('[0]'); b = pari(0); c = pari('[0,0]') 1464 sage: a.gequal(b) 1465 True 1466 sage: b.gequal(c) 1467 True 1468 sage: a.gequal(c) 1469 False 1470 """ 1471 global t0 1472 t0GEN(b) 1473 _sig_on 1474 ret = gequal(a.g, t0) 1475 _sig_off 1476 return ret != 0 1477 1478 def gequal_long(gen a, long b): 1479 r""" 1480 Check whether `a` is equal to the ``long int`` `b` using PARI's ``gequalsg``. 1481 1482 EXAMPLES:: 1483 1484 sage: a = pari(1); b = pari(2.0); c = pari('3*matid(3)') 1485 sage: a.gequal_long(1) 1486 True 1487 sage: a.gequal_long(-1) 1488 False 1489 sage: a.gequal_long(0) 1490 False 1491 sage: b.gequal_long(2) 1492 True 1493 sage: b.gequal_long(-2) 1494 False 1495 sage: c.gequal_long(3) 1496 True 1497 sage: c.gequal_long(-3) 1498 False 1499 """ 1500 _sig_on 1501 ret = gequalsg(b, a.g) 1502 _sig_off 1503 return ret != 0 1504 1505 1506 ########################################### 1438 1507 # arith1.c 1439 1508 ########################################### 1440 1509 def isprime(gen self, flag=0): … … 2182 2251 _sig_on 2183 2252 c = GENtostr(self.g) 2184 2253 v = self.new_gen(strtoGENstr(c)) 2185 free(c)2254 pari_free(c) 2186 2255 return v 2187 2256 2188 2257 … … 8318 8387 _sig_off 8319 8388 return g 8320 8389 8390 cdef object new_gen_to_string(self, GEN x): 8391 """ 8392 Converts a gen to a Python string, free the \*entire\* stack and call 8393 _sig_off. This is meant to be used in place of new_gen(). 8394 """ 8395 cdef char* c 8396 cdef int n 8397 c = GENtostr(x) 8398 s = str(c) 8399 pari_free(c) 8400 global mytop, avma 8401 avma = mytop 8402 _sig_off 8403 return s 8404 8321 8405 cdef void clear_stack(self): 8322 8406 """ 8323 8407 Clear the entire PARI stack and call _sig_off. … … 8694 8778 cdef _an_element_c_impl(self): # override this in Cython 8695 8779 return self.PARI_ZERO 8696 8780 8697 # Commented out by John Cremona 2008-09-06 -- never used and confusing.8698 #8699 # def new_with_prec(self, s, long precision=0):8700 # r"""8701 # pari.new_with_prec(self, s, precision) creates s as a PARI gen8702 # with at least \code{precision} decimal \emph{digits} of precision.8703 # """8704 # global prec8705 # cdef unsigned long old_prec8706 # old_prec = prec8707 # if not precision:8708 # precision = prec8709 # self.set_real_precision(precision)8710 # x = self(s)8711 # self.set_real_precision(old_prec)8712 # return x8713 8714 8781 def new_with_bits_prec(self, s, long precision): 8715 8782 r""" 8716 8783 pari.new_with_bits_prec(self, s, precision) creates s as a PARI … … 8738 8805 return fetch_user_var(s) 8739 8806 return -1 8740 8807 8741 8742 ############################################################8743 # conversion between GEN and string types8744 # Note that string --> GEN evaluates the string in PARI,8745 # where GEN_to_str returns a Python string.8746 ############################################################8747 cdef object GEN_to_str(self, GEN g):8748 cdef char* c8749 cdef int n8750 _sig_off8751 _sig_on8752 c = GENtostr(g)8753 _sig_off8754 s = str(c)8755 free(c)8756 return s8757 8758 8759 8808 ############################################################ 8760 8809 # Initialization 8761 8810 ############################################################ … … 8789 8838 global diffptr, num_primes 8790 8839 if M <= num_primes: 8791 8840 return 8792 #if not silent: 8793 # print "Extending PARI prime table up to %s"%M 8794 free(<void*> diffptr) 8841 pari_free(<void*> diffptr) 8795 8842 num_primes = M 8796 8843 diffptr = initprimes(M) 8797 8844