Ticket #4965: 4965-pxi-to-pxd.patch

File 4965-pxi-to-pxd.patch, 28.2 KB (added by Robert Bradshaw, 14 years ago)

move pxi declarations to pxd

  • sage/libs/flint/long_extras.pxd

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1232054044 28800
    # Node ID a498fea7b84798acf4af2e4145f76e065346142b
    # Parent  1018082fa889e5ac11e41a5124523e1a26e79f3f
    [mq]: pxi-to-pxd
    
    diff -r 1018082fa889 -r a498fea7b847 sage/libs/flint/long_extras.pxd
    a b  
    22include "../../ext/cdefs.pxi"
    33
    44include "flint.pxi"
    5 include "long_extras.pxi"
     5
     6
     7cdef extern from "FLINT/long_extras.h":
     8
     9    cdef unsigned long z_randint(unsigned long limit)
     10
     11    cdef unsigned long z_randbits(unsigned long bits)
     12
     13    cdef unsigned long z_randprime(unsigned long bits)
     14
     15    cdef double z_precompute_inverse(unsigned long n)
     16
     17    cdef double z_precompute_inverse2(unsigned long n)
     18
     19    cdef double z_ll_precompute_inverse(unsigned long n)
     20
     21    cdef unsigned long z_addmod(unsigned long a, unsigned long b, unsigned long p)
     22
     23    cdef unsigned long z_submod(unsigned long a, unsigned long b, unsigned long p)
     24
     25    cdef unsigned long z_negmod(unsigned long a, unsigned long p)
     26
     27    cdef unsigned long z_mod_precomp(unsigned long a, unsigned long n, double ninv)
     28
     29    cdef unsigned long z_div2_precomp(unsigned long a, unsigned long n, double ninv)
     30
     31    cdef unsigned long z_mod2_precomp(unsigned long a, unsigned long n, double ninv)
     32
     33    cdef unsigned long z_ll_mod_precomp(unsigned long a_hi, unsigned long a_lo, unsigned long n, double ninv)
     34
     35    cdef unsigned long z_mulmod_precomp(unsigned long a, unsigned long b, unsigned long n, double ninv)
     36
     37    cdef unsigned long z_mulmod2_precomp(unsigned long a, unsigned long b, unsigned long n, double ninv)
     38
     39    cdef unsigned long z_powmod(unsigned long a, long exp, unsigned long n)
     40
     41    cdef unsigned long z_powmod2(unsigned long a, long exp, unsigned long n)
     42
     43    cdef unsigned long z_powmod_precomp(unsigned long a, long exp, unsigned long n, double ninv)
     44
     45    cdef unsigned long z_powmod2_precomp(unsigned long a, long exp, unsigned long n, double ninv)
     46
     47    cdef int z_legendre_precomp(unsigned long a, unsigned long p, double pinv)
     48
     49    cdef int z_jacobi(long x, unsigned long y)
     50
     51    cdef int z_ispseudoprime_fermat(unsigned long n, unsigned long i)
     52
     53    cdef int z_isprime(unsigned long n)
     54
     55    cdef int z_isprime_precomp(unsigned long n, double ninv)
     56
     57    cdef unsigned long z_nextprime(unsigned long n)
     58
     59    cdef int z_isprime_pocklington(unsigned long n, unsigned long iterations)
     60
     61    cdef int z_ispseudoprime_lucas_ab(unsigned long n, int a, int b)
     62
     63    cdef int z_ispseudoprime_lucas(unsigned long n)
     64
     65    cdef unsigned long z_pow(unsigned long a, unsigned long exp)
     66
     67    cdef unsigned long z_sqrtmod(unsigned long a, unsigned long p)
     68
     69    cdef unsigned long z_cuberootmod(unsigned long * cuberoot1, unsigned long a, unsigned long p)
     70
     71    cdef unsigned long z_invert(unsigned long a, unsigned long p)
     72   
     73    cdef long z_gcd_invert(long* a, long x, long y)
     74
     75    cdef long z_extgcd(long* a, long* b, long x, long y)
     76
     77    cdef unsigned long z_gcd(long x, long y)
     78
     79    cdef unsigned long z_intsqrt(unsigned long r)
     80
     81    cdef int z_issquare(long x)
     82
     83    cdef unsigned long z_CRT(unsigned long x1, unsigned long n1, unsigned long x2, unsigned long n2)
     84
     85    cdef int z_issquarefree(unsigned long n)
     86
     87    cdef int z_remove_precomp(unsigned long * n, unsigned long p, double pinv)
     88
     89    cdef int z_remove(unsigned long * n, unsigned long p)
     90
     91    cdef unsigned long z_factor_SQUFOF(unsigned long n)
     92
     93    cdef unsigned long z_primitive_root(unsigned long p)
     94
     95    cdef unsigned long z_primitive_root_precomp(unsigned long p, double p_inv)
  • deleted file sage/libs/flint/long_extras.pxi

    diff -r 1018082fa889 -r a498fea7b847 sage/libs/flint/long_extras.pxi
    + -  
    1 cdef extern from "FLINT/long_extras.h":
    2 
    3     cdef unsigned long z_randint(unsigned long limit)
    4 
    5     cdef unsigned long z_randbits(unsigned long bits)
    6 
    7     cdef unsigned long z_randprime(unsigned long bits)
    8 
    9     cdef double z_precompute_inverse(unsigned long n)
    10 
    11     cdef double z_precompute_inverse2(unsigned long n)
    12 
    13     cdef double z_ll_precompute_inverse(unsigned long n)
    14 
    15     cdef unsigned long z_addmod(unsigned long a, unsigned long b, unsigned long p)
    16 
    17     cdef unsigned long z_submod(unsigned long a, unsigned long b, unsigned long p)
    18 
    19     cdef unsigned long z_negmod(unsigned long a, unsigned long p)
    20 
    21     cdef unsigned long z_mod_precomp(unsigned long a, unsigned long n, double ninv)
    22 
    23     cdef unsigned long z_div2_precomp(unsigned long a, unsigned long n, double ninv)
    24 
    25     cdef unsigned long z_mod2_precomp(unsigned long a, unsigned long n, double ninv)
    26 
    27     cdef unsigned long z_ll_mod_precomp(unsigned long a_hi, unsigned long a_lo, unsigned long n, double ninv)
    28 
    29     cdef unsigned long z_mulmod_precomp(unsigned long a, unsigned long b, unsigned long n, double ninv)
    30 
    31     cdef unsigned long z_mulmod2_precomp(unsigned long a, unsigned long b, unsigned long n, double ninv)
    32 
    33     cdef unsigned long z_powmod(unsigned long a, long exp, unsigned long n)
    34 
    35     cdef unsigned long z_powmod2(unsigned long a, long exp, unsigned long n)
    36 
    37     cdef unsigned long z_powmod_precomp(unsigned long a, long exp, unsigned long n, double ninv)
    38 
    39     cdef unsigned long z_powmod2_precomp(unsigned long a, long exp, unsigned long n, double ninv)
    40 
    41     cdef int z_legendre_precomp(unsigned long a, unsigned long p, double pinv)
    42 
    43     cdef int z_jacobi(long x, unsigned long y)
    44 
    45     cdef int z_ispseudoprime_fermat(unsigned long n, unsigned long i)
    46 
    47     cdef int z_isprime(unsigned long n)
    48 
    49     cdef int z_isprime_precomp(unsigned long n, double ninv)
    50 
    51     cdef unsigned long z_nextprime(unsigned long n)
    52 
    53     cdef int z_isprime_pocklington(unsigned long n, unsigned long iterations)
    54 
    55     cdef int z_ispseudoprime_lucas_ab(unsigned long n, int a, int b)
    56 
    57     cdef int z_ispseudoprime_lucas(unsigned long n)
    58 
    59     cdef unsigned long z_pow(unsigned long a, unsigned long exp)
    60 
    61     cdef unsigned long z_sqrtmod(unsigned long a, unsigned long p)
    62 
    63     cdef unsigned long z_cuberootmod(unsigned long * cuberoot1, unsigned long a, unsigned long p)
    64 
    65     cdef unsigned long z_invert(unsigned long a, unsigned long p)
    66    
    67     cdef long z_gcd_invert(long* a, long x, long y)
    68 
    69     cdef long z_extgcd(long* a, long* b, long x, long y)
    70 
    71     cdef unsigned long z_gcd(long x, long y)
    72 
    73     cdef unsigned long z_intsqrt(unsigned long r)
    74 
    75     cdef int z_issquare(long x)
    76 
    77     cdef unsigned long z_CRT(unsigned long x1, unsigned long n1, unsigned long x2, unsigned long n2)
    78 
    79     cdef int z_issquarefree(unsigned long n)
    80 
    81     cdef int z_remove_precomp(unsigned long * n, unsigned long p, double pinv)
    82 
    83     cdef int z_remove(unsigned long * n, unsigned long p)
    84 
    85     cdef unsigned long z_factor_SQUFOF(unsigned long n)
    86 
    87     cdef unsigned long z_primitive_root(unsigned long p)
    88 
    89     cdef unsigned long z_primitive_root_precomp(unsigned long p, double p_inv)
  • sage/libs/flint/zmod_poly.pxd

    diff -r 1018082fa889 -r a498fea7b847 sage/libs/flint/zmod_poly.pxd
    a b  
    22include "../../ext/cdefs.pxi"
    33
    44include "flint.pxi"
    5 include "zmod_poly.pxi"
     5
     6from flint import *
     7
     8cdef extern from "FLINT/zmod_poly.h":
     9    ctypedef struct zmod_poly_struct:
     10        unsigned long *coeffs
     11        unsigned long alloc
     12        unsigned long length
     13        unsigned long p
     14        double p_inv
     15
     16    ctypedef zmod_poly_struct* zmod_poly_t
     17
     18    cdef void zmod_poly_init(zmod_poly_t poly, unsigned long p)
     19    cdef void zmod_poly_init_precomp(zmod_poly_t poly, unsigned long p, double p_inv)
     20    cdef void zmod_poly_init2(zmod_poly_t poly, unsigned long p, unsigned long alloc)
     21    cdef void zmod_poly_init2_precomp(zmod_poly_t poly, unsigned long p, double p_inv, unsigned long alloc)
     22    cdef void zmod_poly_clear(zmod_poly_t poly)
     23
     24    cdef void zmod_poly_realloc(zmod_poly_t poly, unsigned long alloc)
     25    # _bits_ only applies to newly allocated coefficients, not existing ones...
     26
     27    # this non-inlined version REQUIRES that alloc > poly->alloc
     28    void __zmod_poly_fit_length(zmod_poly_t poly, unsigned long alloc)
     29
     30    # this is arranged so that the initial comparison (very frequent) is inlined,
     31    # but the actual allocation (infrequent) is not
     32    cdef void zmod_poly_fit_length(zmod_poly_t poly, unsigned long alloc)
     33
     34    # ------------------------------------------------------
     35    # Setting/retrieving coefficients
     36
     37    cdef unsigned long zmod_poly_get_coeff_ui(zmod_poly_t poly, unsigned long n)
     38
     39    cdef unsigned long _zmod_poly_get_coeff_ui(zmod_poly_t poly, unsigned long n)
     40
     41    cdef void zmod_poly_set_coeff_ui(zmod_poly_t poly, unsigned long n, unsigned long c)
     42
     43    cdef void _zmod_poly_set_coeff_ui(zmod_poly_t poly, unsigned long n, unsigned long c)
     44
     45    # ------------------------------------------------------
     46    # String conversions and I/O
     47
     48    cdef int zmod_poly_from_string(zmod_poly_t poly, char* s)
     49    cdef char* zmod_poly_to_string(zmod_poly_t poly)
     50    cdef void zmod_poly_print(zmod_poly_t poly)
     51    cdef void zmod_poly_fprint(zmod_poly_t poly, FILE* f)
     52    cdef int zmod_poly_read(zmod_poly_t poly)
     53    cdef int zmod_poly_fread(zmod_poly_t poly, FILE* f)
     54
     55    # ------------------------------------------------------
     56    # Length and degree
     57
     58    cdef void __zmod_poly_normalise(zmod_poly_t poly)
     59    cdef int __zmod_poly_normalised(zmod_poly_t poly)
     60    cdef void zmod_poly_truncate(zmod_poly_t poly, unsigned long length)
     61
     62    cdef unsigned long zmod_poly_length(zmod_poly_t poly)
     63
     64    cdef long zmod_poly_degree(zmod_poly_t poly)
     65
     66    cdef unsigned long zmod_poly_modulus(zmod_poly_t poly)
     67
     68    cdef double zmod_poly_precomputed_inverse(zmod_poly_t poly)
     69
     70    # ------------------------------------------------------
     71    # Assignment
     72
     73    cdef void _zmod_poly_set(zmod_poly_t res, zmod_poly_t poly)
     74    cdef void zmod_poly_set(zmod_poly_t res, zmod_poly_t poly)
     75
     76    cdef void zmod_poly_zero(zmod_poly_t poly)
     77
     78    cdef void zmod_poly_swap(zmod_poly_t poly1, zmod_poly_t poly2)
     79
     80    #
     81    # Subpolynomials
     82    #
     83
     84    cdef void _zmod_poly_attach(zmod_poly_t output, zmod_poly_t input)
     85
     86    cdef void zmod_poly_attach(zmod_poly_t output, zmod_poly_t input)
     87
     88    #
     89    # Attach input shifted right by n to output
     90    #
     91
     92    cdef void _zmod_poly_attach_shift(zmod_poly_t output, zmod_poly_t input, unsigned long n)
     93
     94    cdef void zmod_poly_attach_shift(zmod_poly_t output, zmod_poly_t input, unsigned long n)
     95
     96    #
     97    # Attach input to first n coefficients of input
     98    #
     99
     100    cdef void _zmod_poly_attach_truncate(zmod_poly_t output,  zmod_poly_t input, unsigned long n)
     101
     102    cdef void zmod_poly_attach_truncate(zmod_poly_t output, zmod_poly_t input, unsigned long n)
     103
     104    #
     105    # Comparison functions
     106    #
     107
     108    cdef int zmod_poly_equal(zmod_poly_t poly1, zmod_poly_t poly2)
     109
     110    cdef int zmod_poly_is_one(zmod_poly_t poly1)
     111
     112    #
     113    # Reversal
     114    #
     115
     116    cdef void _zmod_poly_reverse(zmod_poly_t output, zmod_poly_t input, unsigned long length)
     117    cdef void zmod_poly_reverse(zmod_poly_t output, zmod_poly_t input, unsigned long length)
     118
     119    #
     120    # Monic polys
     121    #
     122
     123    cdef void zmod_poly_make_monic(zmod_poly_t output, zmod_poly_t pol)
     124
     125    #
     126    # Addition and subtraction
     127    #
     128
     129    cdef void zmod_poly_add(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     130    cdef void zmod_poly_add_without_mod(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     131    cdef void zmod_poly_sub(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     132    cdef void _zmod_poly_sub(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     133    cdef void zmod_poly_neg(zmod_poly_t res, zmod_poly_t poly)
     134
     135    #
     136    # Shifting functions
     137    #
     138
     139    cdef void zmod_poly_left_shift(zmod_poly_t res, zmod_poly_t poly, unsigned long k)
     140    cdef void zmod_poly_right_shift(zmod_poly_t res, zmod_poly_t poly, unsigned long k)
     141
     142    #
     143    # Polynomial multiplication
     144    #
     145    # All multiplication functions require that the modulus be no more than FLINT_BITS-1 bits
     146    #
     147
     148    cdef void zmod_poly_mul(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     149    cdef void zmod_poly_sqr(zmod_poly_t res, zmod_poly_t poly)
     150
     151    # Requires that poly1 bits + poly2 bits + log_length is not greater than 2*FLINT_BITS
     152
     153    cdef void zmod_poly_mul_KS(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input)
     154    cdef void _zmod_poly_mul_KS(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input)
     155
     156    cdef void zmod_poly_mul_KS_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input, unsigned long trunc)
     157    cdef void _zmod_poly_mul_KS_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input, unsigned long trunc)
     158
     159    cdef void _zmod_poly_mul_classical(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     160    cdef void __zmod_poly_mul_classical_mod_last(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits)
     161    cdef void __zmod_poly_mul_classical_mod_throughout(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits)
     162    cdef void zmod_poly_mul_classical(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     163    cdef void _zmod_poly_sqr_classical(zmod_poly_t res, zmod_poly_t poly)
     164    cdef void zmod_poly_sqr_classical(zmod_poly_t res, zmod_poly_t poly)
     165
     166    cdef void _zmod_poly_mul_classical_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
     167    cdef void __zmod_poly_mul_classical_trunc_mod_last(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
     168    cdef void __zmod_poly_mul_classical_trunc_mod_throughout(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
     169    cdef void zmod_poly_mul_classical_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
     170
     171    cdef void _zmod_poly_mul_classical_trunc_left(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
     172    cdef void __zmod_poly_mul_classical_trunc_left_mod_last(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
     173    cdef void __zmod_poly_mul_classical_trunc_left_mod_throughout(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
     174    cdef void zmod_poly_mul_classical_trunc_left(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
     175
     176    cdef void zmod_poly_mul_trunc_n(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
     177    cdef void zmod_poly_mul_trunc_left_n(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
     178
     179    #
     180    # Bit packing functions
     181    #
     182
     183    cdef unsigned long zmod_poly_bits(zmod_poly_t poly)
     184    cdef void _zmod_poly_bit_pack_mpn(mp_limb_t * res, zmod_poly_t poly, unsigned long bits, unsigned long length)
     185    cdef void _zmod_poly_bit_unpack_mpn(zmod_poly_t poly, mp_limb_t *mpn, unsigned long length, unsigned long bits)
     186
     187    cdef void print_binary(unsigned long n, unsigned long len)
     188    cdef void print_binary2(unsigned long n, unsigned long len, unsigned long space_bit)
     189
     190    #
     191    # Scalar multiplication
     192    #
     193
     194    cdef void _zmod_poly_scalar_mul(zmod_poly_t res, zmod_poly_t poly, unsigned long scalar)
     195    cdef void zmod_poly_scalar_mul(zmod_poly_t res, zmod_poly_t poly, unsigned long scalar)
     196    cdef void __zmod_poly_scalar_mul_without_mod(zmod_poly_t res, zmod_poly_t poly, unsigned long scalar)
     197
     198    #
     199    # Division
     200    #
     201
     202    cdef void zmod_poly_divrem_classical(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
     203    cdef void __zmod_poly_divrem_classical_mod_last(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
     204    cdef void zmod_poly_div_classical(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
     205    cdef void __zmod_poly_div_classical_mod_last(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
     206    cdef void zmod_poly_div_divconquer_recursive(zmod_poly_t Q, zmod_poly_t BQ, zmod_poly_t A, zmod_poly_t B)
     207    cdef void zmod_poly_divrem_divconquer(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
     208    cdef void zmod_poly_div_divconquer(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
     209
     210    #
     211    # Newton Inversion
     212    #
     213
     214    cdef void zmod_poly_newton_invert_basecase(zmod_poly_t Q_inv, zmod_poly_t Q, unsigned long n)
     215    cdef void zmod_poly_newton_invert(zmod_poly_t Q_inv, zmod_poly_t Q, unsigned long n)
     216
     217    #
     218    # Newton Division
     219    #
     220
     221    cdef void zmod_poly_div_series(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B, unsigned long n)
     222    cdef void zmod_poly_div_newton(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
     223    cdef void zmod_poly_divrem_newton(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
     224
     225    cdef void zmod_poly_divrem(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
     226
     227    cdef void zmod_poly_div(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
     228
     229    #
     230    # Resultant
     231    #
     232
     233    cdef unsigned long zmod_poly_resultant_euclidean(zmod_poly_t a, zmod_poly_t b)
     234
     235    cdef unsigned long zmod_poly_resultant(zmod_poly_t a, zmod_poly_t b)
     236
     237    #
     238    # GCD
     239    #
     240
     241    cdef void zmod_poly_gcd(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     242    cdef int zmod_poly_gcd_invert(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
     243    cdef void zmod_poly_xgcd(zmod_poly_t res, zmod_poly_t s, zmod_poly_t t, zmod_poly_t poly1, zmod_poly_t poly2)
     244
     245
     246    # FLINT 1.1 will have:
     247    # cdef void zmod_poly_powmod(zmod_poly_t res, zmod_poly_t pol, long exp, zmod_poly_t f)
  • deleted file sage/libs/flint/zmod_poly.pxi

    diff -r 1018082fa889 -r a498fea7b847 sage/libs/flint/zmod_poly.pxi
    + -  
    1 cdef extern from "FLINT/zmod_poly.h":
    2     ctypedef struct zmod_poly_struct:
    3         unsigned long *coeffs
    4         unsigned long alloc
    5         unsigned long length
    6         unsigned long p
    7         double p_inv
    8 
    9     ctypedef zmod_poly_struct* zmod_poly_t
    10 
    11     cdef void zmod_poly_init(zmod_poly_t poly, unsigned long p)
    12     cdef void zmod_poly_init_precomp(zmod_poly_t poly, unsigned long p, double p_inv)
    13     cdef void zmod_poly_init2(zmod_poly_t poly, unsigned long p, unsigned long alloc)
    14     cdef void zmod_poly_init2_precomp(zmod_poly_t poly, unsigned long p, double p_inv, unsigned long alloc)
    15     cdef void zmod_poly_clear(zmod_poly_t poly)
    16 
    17     cdef void zmod_poly_realloc(zmod_poly_t poly, unsigned long alloc)
    18     # _bits_ only applies to newly allocated coefficients, not existing ones...
    19 
    20     # this non-inlined version REQUIRES that alloc > poly->alloc
    21     void __zmod_poly_fit_length(zmod_poly_t poly, unsigned long alloc)
    22 
    23     # this is arranged so that the initial comparison (very frequent) is inlined,
    24     # but the actual allocation (infrequent) is not
    25     cdef void zmod_poly_fit_length(zmod_poly_t poly, unsigned long alloc)
    26 
    27     # ------------------------------------------------------
    28     # Setting/retrieving coefficients
    29 
    30     cdef unsigned long zmod_poly_get_coeff_ui(zmod_poly_t poly, unsigned long n)
    31 
    32     cdef unsigned long _zmod_poly_get_coeff_ui(zmod_poly_t poly, unsigned long n)
    33 
    34     cdef void zmod_poly_set_coeff_ui(zmod_poly_t poly, unsigned long n, unsigned long c)
    35 
    36     cdef void _zmod_poly_set_coeff_ui(zmod_poly_t poly, unsigned long n, unsigned long c)
    37 
    38     # ------------------------------------------------------
    39     # String conversions and I/O
    40 
    41     cdef int zmod_poly_from_string(zmod_poly_t poly, char* s)
    42     cdef char* zmod_poly_to_string(zmod_poly_t poly)
    43     cdef void zmod_poly_print(zmod_poly_t poly)
    44     cdef void zmod_poly_fprint(zmod_poly_t poly, FILE* f)
    45     cdef int zmod_poly_read(zmod_poly_t poly)
    46     cdef int zmod_poly_fread(zmod_poly_t poly, FILE* f)
    47 
    48     # ------------------------------------------------------
    49     # Length and degree
    50 
    51     cdef void __zmod_poly_normalise(zmod_poly_t poly)
    52     cdef int __zmod_poly_normalised(zmod_poly_t poly)
    53     cdef void zmod_poly_truncate(zmod_poly_t poly, unsigned long length)
    54 
    55     cdef unsigned long zmod_poly_length(zmod_poly_t poly)
    56 
    57     cdef long zmod_poly_degree(zmod_poly_t poly)
    58 
    59     cdef unsigned long zmod_poly_modulus(zmod_poly_t poly)
    60 
    61     cdef double zmod_poly_precomputed_inverse(zmod_poly_t poly)
    62 
    63     # ------------------------------------------------------
    64     # Assignment
    65 
    66     cdef void _zmod_poly_set(zmod_poly_t res, zmod_poly_t poly)
    67     cdef void zmod_poly_set(zmod_poly_t res, zmod_poly_t poly)
    68 
    69     cdef void zmod_poly_zero(zmod_poly_t poly)
    70 
    71     cdef void zmod_poly_swap(zmod_poly_t poly1, zmod_poly_t poly2)
    72 
    73     #
    74     # Subpolynomials
    75     #
    76 
    77     cdef void _zmod_poly_attach(zmod_poly_t output, zmod_poly_t input)
    78 
    79     cdef void zmod_poly_attach(zmod_poly_t output, zmod_poly_t input)
    80 
    81     #
    82     # Attach input shifted right by n to output
    83     #
    84 
    85     cdef void _zmod_poly_attach_shift(zmod_poly_t output, zmod_poly_t input, unsigned long n)
    86 
    87     cdef void zmod_poly_attach_shift(zmod_poly_t output, zmod_poly_t input, unsigned long n)
    88 
    89     #
    90     # Attach input to first n coefficients of input
    91     #
    92 
    93     cdef void _zmod_poly_attach_truncate(zmod_poly_t output,  zmod_poly_t input, unsigned long n)
    94 
    95     cdef void zmod_poly_attach_truncate(zmod_poly_t output, zmod_poly_t input, unsigned long n)
    96 
    97     #
    98     # Comparison functions
    99     #
    100 
    101     cdef int zmod_poly_equal(zmod_poly_t poly1, zmod_poly_t poly2)
    102 
    103     cdef int zmod_poly_is_one(zmod_poly_t poly1)
    104 
    105     #
    106     # Reversal
    107     #
    108 
    109     cdef void _zmod_poly_reverse(zmod_poly_t output, zmod_poly_t input, unsigned long length)
    110     cdef void zmod_poly_reverse(zmod_poly_t output, zmod_poly_t input, unsigned long length)
    111 
    112     #
    113     # Monic polys
    114     #
    115 
    116     cdef void zmod_poly_make_monic(zmod_poly_t output, zmod_poly_t pol)
    117 
    118     #
    119     # Addition and subtraction
    120     #
    121 
    122     cdef void zmod_poly_add(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    123     cdef void zmod_poly_add_without_mod(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    124     cdef void zmod_poly_sub(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    125     cdef void _zmod_poly_sub(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    126     cdef void zmod_poly_neg(zmod_poly_t res, zmod_poly_t poly)
    127 
    128     #
    129     # Shifting functions
    130     #
    131 
    132     cdef void zmod_poly_left_shift(zmod_poly_t res, zmod_poly_t poly, unsigned long k)
    133     cdef void zmod_poly_right_shift(zmod_poly_t res, zmod_poly_t poly, unsigned long k)
    134 
    135     #
    136     # Polynomial multiplication
    137     #
    138     # All multiplication functions require that the modulus be no more than FLINT_BITS-1 bits
    139     #
    140 
    141     cdef void zmod_poly_mul(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    142     cdef void zmod_poly_sqr(zmod_poly_t res, zmod_poly_t poly)
    143 
    144     # Requires that poly1 bits + poly2 bits + log_length is not greater than 2*FLINT_BITS
    145 
    146     cdef void zmod_poly_mul_KS(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input)
    147     cdef void _zmod_poly_mul_KS(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input)
    148 
    149     cdef void zmod_poly_mul_KS_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input, unsigned long trunc)
    150     cdef void _zmod_poly_mul_KS_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits_input, unsigned long trunc)
    151 
    152     cdef void _zmod_poly_mul_classical(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    153     cdef void __zmod_poly_mul_classical_mod_last(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits)
    154     cdef void __zmod_poly_mul_classical_mod_throughout(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits)
    155     cdef void zmod_poly_mul_classical(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    156     cdef void _zmod_poly_sqr_classical(zmod_poly_t res, zmod_poly_t poly)
    157     cdef void zmod_poly_sqr_classical(zmod_poly_t res, zmod_poly_t poly)
    158 
    159     cdef void _zmod_poly_mul_classical_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
    160     cdef void __zmod_poly_mul_classical_trunc_mod_last(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
    161     cdef void __zmod_poly_mul_classical_trunc_mod_throughout(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
    162     cdef void zmod_poly_mul_classical_trunc(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
    163 
    164     cdef void _zmod_poly_mul_classical_trunc_left(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
    165     cdef void __zmod_poly_mul_classical_trunc_left_mod_last(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
    166     cdef void __zmod_poly_mul_classical_trunc_left_mod_throughout(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long bits, unsigned long trunc)
    167     cdef void zmod_poly_mul_classical_trunc_left(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
    168 
    169     cdef void zmod_poly_mul_trunc_n(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
    170     cdef void zmod_poly_mul_trunc_left_n(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2, unsigned long trunc)
    171 
    172     #
    173     # Bit packing functions
    174     #
    175 
    176     cdef unsigned long zmod_poly_bits(zmod_poly_t poly)
    177     cdef void _zmod_poly_bit_pack_mpn(mp_limb_t * res, zmod_poly_t poly, unsigned long bits, unsigned long length)
    178     cdef void _zmod_poly_bit_unpack_mpn(zmod_poly_t poly, mp_limb_t *mpn, unsigned long length, unsigned long bits)
    179 
    180     cdef void print_binary(unsigned long n, unsigned long len)
    181     cdef void print_binary2(unsigned long n, unsigned long len, unsigned long space_bit)
    182 
    183     #
    184     # Scalar multiplication
    185     #
    186 
    187     cdef void _zmod_poly_scalar_mul(zmod_poly_t res, zmod_poly_t poly, unsigned long scalar)
    188     cdef void zmod_poly_scalar_mul(zmod_poly_t res, zmod_poly_t poly, unsigned long scalar)
    189     cdef void __zmod_poly_scalar_mul_without_mod(zmod_poly_t res, zmod_poly_t poly, unsigned long scalar)
    190 
    191     #
    192     # Division
    193     #
    194 
    195     cdef void zmod_poly_divrem_classical(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
    196     cdef void __zmod_poly_divrem_classical_mod_last(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
    197     cdef void zmod_poly_div_classical(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
    198     cdef void __zmod_poly_div_classical_mod_last(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
    199     cdef void zmod_poly_div_divconquer_recursive(zmod_poly_t Q, zmod_poly_t BQ, zmod_poly_t A, zmod_poly_t B)
    200     cdef void zmod_poly_divrem_divconquer(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
    201     cdef void zmod_poly_div_divconquer(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
    202 
    203     #
    204     # Newton Inversion
    205     #
    206 
    207     cdef void zmod_poly_newton_invert_basecase(zmod_poly_t Q_inv, zmod_poly_t Q, unsigned long n)
    208     cdef void zmod_poly_newton_invert(zmod_poly_t Q_inv, zmod_poly_t Q, unsigned long n)
    209 
    210     #
    211     # Newton Division
    212     #
    213 
    214     cdef void zmod_poly_div_series(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B, unsigned long n)
    215     cdef void zmod_poly_div_newton(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
    216     cdef void zmod_poly_divrem_newton(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
    217 
    218     cdef void zmod_poly_divrem(zmod_poly_t Q, zmod_poly_t R, zmod_poly_t A, zmod_poly_t B)
    219 
    220     cdef void zmod_poly_div(zmod_poly_t Q, zmod_poly_t A, zmod_poly_t B)
    221 
    222     #
    223     # Resultant
    224     #
    225 
    226     cdef unsigned long zmod_poly_resultant_euclidean(zmod_poly_t a, zmod_poly_t b)
    227 
    228     cdef unsigned long zmod_poly_resultant(zmod_poly_t a, zmod_poly_t b)
    229 
    230     #
    231     # GCD
    232     #
    233 
    234     cdef void zmod_poly_gcd(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    235     cdef int zmod_poly_gcd_invert(zmod_poly_t res, zmod_poly_t poly1, zmod_poly_t poly2)
    236     cdef void zmod_poly_xgcd(zmod_poly_t res, zmod_poly_t s, zmod_poly_t t, zmod_poly_t poly1, zmod_poly_t poly2)
    237 
    238 
    239     # FLINT 1.1 will have:
    240     # cdef void zmod_poly_powmod(zmod_poly_t res, zmod_poly_t pol, long exp, zmod_poly_t f)