# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1366204722 -7200
# Node ID d9713c21438e797f4bc33a6ca1d9d1e2031e6bc8
# Parent 06a3f2c98282375d37b3816bcd7d65d2afe14af6
Additional changes
diff --git a/sage/ext/gen_interpreters.py b/sage/ext/gen_interpreters.py
a
|
b
|
|
193 | 193 | that we have to incref/decref at appropriate places. |
194 | 194 | |
195 | 195 | Third is "auto-reference" types. This is how |
196 | | GMP/MPIR/MPFR/MPFI/flint types work. For these types, functions |
| 196 | GMP/MPIR/MPFR/MPFI/FLINT types work. For these types, functions |
197 | 197 | expect arguments to be passed by reference, and the C assignment |
198 | 198 | operator does not do what we want. In addition, they take |
199 | 199 | advantage of a quirk in C (where arrays are automatically |
… |
… |
|
793 | 793 | class StorageTypeAutoReference(StorageType): |
794 | 794 | r""" |
795 | 795 | StorageTypeAutoReference is a subtype of StorageType that deals with |
796 | | types in the style of GMP/MPIR/MPFR/MPFI/flint, where copies are |
| 796 | types in the style of GMP/MPIR/MPFR/MPFI/FLINT, where copies are |
797 | 797 | not cheap, functions expect arguments to be passed by reference, |
798 | 798 | and the API takes advantage of the C quirk where arrays are |
799 | 799 | automatically converted to pointers to automatically pass |
diff --git a/sage/libs/flint/fmpz_poly.pxi b/sage/libs/flint/fmpz_poly.pxi
a
|
b
|
|
8 | 8 | ctypedef void* fmpz_poly_t |
9 | 9 | |
10 | 10 | void fmpz_poly_init(fmpz_poly_t poly) |
11 | | void fmpz_poly_init2(fmpz_poly_t poly, unsigned long alloc, \ |
12 | | unsigned long limbs) |
| 11 | void fmpz_poly_init2(fmpz_poly_t poly, unsigned long alloc) |
13 | 12 | void fmpz_poly_realloc(fmpz_poly_t poly, unsigned long alloc) |
14 | 13 | |
15 | 14 | void fmpz_poly_fit_length(fmpz_poly_t poly, unsigned long alloc) |
16 | | void fmpz_poly_resize_limbs(fmpz_poly_t poly, unsigned long limbs) |
17 | | void fmpz_poly_fit_limbs(fmpz_poly_t poly, unsigned long limbs) |
18 | | unsigned long fmpz_poly_limbs(fmpz_poly_t poly) |
19 | 15 | |
20 | 16 | void fmpz_poly_clear(fmpz_poly_t poly) |
21 | 17 | |
… |
… |
|
58 | 54 | unsigned long x) |
59 | 55 | void fmpz_poly_scalar_mul_si(fmpz_poly_t output, fmpz_poly_t input, long x) |
60 | 56 | |
61 | | void fmpz_poly_scalar_mul_mpz(fmpz_poly_t output, fmpz_poly_t poly, |
62 | | mpz_t x) |
63 | | void fmpz_poly_scalar_mul_fmpz(fmpz_poly_t output, fmpz_poly_t poly, \ |
| 57 | void fmpz_poly_scalar_mul_fmpz(fmpz_poly_t output, fmpz_poly_t poly, |
64 | 58 | fmpz_t x) |
| 59 | void fmpz_poly_scalar_mul_mpz(fmpz_poly_t output, fmpz_poly_t poly, mpz_t x) |
65 | 60 | |
66 | 61 | void fmpz_poly_scalar_divexact_ui(fmpz_poly_t output, fmpz_poly_t poly, \ |
67 | 62 | unsigned long x) |
68 | 63 | void fmpz_poly_scalar_divexact_si(fmpz_poly_t output, fmpz_poly_t poly, \ |
69 | 64 | long x) |
70 | | void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t output, fmpz_poly_t poly, \ |
71 | | mpz_t x) |
72 | 65 | void fmpz_poly_scalar_divexact_fmpz(fmpz_poly_t output, fmpz_poly_t poly, \ |
73 | 66 | fmpz_t x) |
74 | 67 | |
| 68 | void fmpz_poly_scalar_divexact_mpz( fmpz_poly_t output, fmpz_poly_t poly, mpz_t x) |
| 69 | |
| 70 | void fmpz_poly_scalar_fdiv_ui(fmpz_poly_t output, fmpz_poly_t poly, unsigned long x) |
75 | 71 | void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t output, fmpz_poly_t poly, mpz_t x) |
76 | | void fmpz_poly_scalar_fdiv_ui(fmpz_poly_t output, fmpz_poly_t poly, unsigned long x) |
77 | 72 | |
78 | 73 | void fmpz_poly_div(fmpz_poly_t Q, fmpz_poly_t A, fmpz_poly_t B) |
79 | 74 | void fmpz_poly_divrem(fmpz_poly_t Q, fmpz_poly_t R, fmpz_poly_t A, \ |
… |
… |
|
119 | 114 | void fmpz_poly_derivative(fmpz_poly_t der, fmpz_poly_t poly) |
120 | 115 | void fmpz_poly_evaluate_fmpz(fmpz_t output, fmpz_poly_t poly, fmpz_t val) |
121 | 116 | void fmpz_poly_compose(fmpz_poly_t output, fmpz_poly_t f, fmpz_poly_t g) |
122 | | void fmpz_poly_scalar_fdiv_ui(fmpz_poly_t output, fmpz_poly_t poly, unsigned long x) |
| 117 | void fmpz_poly_scalar_div_ui(fmpz_poly_t output, fmpz_poly_t poly, unsigned long x) |
123 | 118 | |
124 | 119 | unsigned long fmpz_poly_max_limbs(fmpz_poly_t poly) |
diff --git a/sage/libs/flint/ntl_interface.pxd b/sage/libs/flint/ntl_interface.pxd
a
|
b
|
|
6 | 6 | from sage.libs.ntl.ntl_ZZX_decl cimport ZZX_c |
7 | 7 | |
8 | 8 | cdef extern from "flint/NTL-interface.h": |
9 | | unsigned long ZZ_limbs(ZZ_c z) |
10 | 9 | |
11 | 10 | void fmpz_poly_get_ZZX(ZZX_c output, fmpz_poly_t poly) |
12 | 11 | void fmpz_poly_set_ZZX(fmpz_poly_t output, ZZX_c poly) |
13 | 12 | |
14 | | void fmpz_get_mpz(mpz_t res, fmpz_t f) |
| 13 | void fmpz_get_ZZ(ZZ_c output, fmpz_t f) |
15 | 14 | void fmpz_set_ZZ(fmpz_t output, ZZ_c z) |
16 | | |
| 15 | |