|
| 1 | +from flint.flintlib.types.flint cimport slong, fmpz_struct, fmpz_t |
| 2 | +from flint.flintlib.types.fmpz_mod cimport fmpz_mod_ctx_t, fmpz_mod_mat_t, fmpz_mod_poly_t |
| 3 | + |
| 4 | +cdef extern from *: |
| 5 | + """ |
| 6 | + /* |
| 7 | + * fmpz_mod_mat function signatures were changed in FLINT 3.1.0 |
| 8 | + */ |
| 9 | + #if __FLINT_RELEASE >= 30100 /* Flint 3.1.0 or later */ |
| 10 | +
|
| 11 | + #define compat_fmpz_mod_mat_init(mat, rows, cols, ctx) fmpz_mod_mat_init(mat, rows, cols, ctx) |
| 12 | + #define compat_fmpz_mod_mat_init_set(mat, src, ctx) fmpz_mod_mat_init_set(mat, src, ctx) |
| 13 | + #define compat_fmpz_mod_mat_clear(mat, ctx) fmpz_mod_mat_clear(mat, ctx) |
| 14 | + #define compat_fmpz_mod_mat_set(A, B, ctx) fmpz_mod_mat_set(A, B, ctx) |
| 15 | + #define compat_fmpz_mod_mat_nrows(mat, ctx) fmpz_mod_mat_nrows(mat, ctx) |
| 16 | + #define compat_fmpz_mod_mat_ncols(mat, ctx) fmpz_mod_mat_ncols(mat, ctx) |
| 17 | + #define compat_fmpz_mod_mat_entry(mat, i, j) fmpz_mod_mat_entry(mat, i, j) |
| 18 | + #define compat_fmpz_mod_mat_set_entry(mat, i, j, val, ctx) fmpz_mod_mat_set_entry(mat, i, j, val, ctx) |
| 19 | + #define compat_fmpz_mod_mat_one(mat, ctx) fmpz_mod_mat_one(mat, ctx) |
| 20 | + #define compat_fmpz_mod_mat_equal(mat1, mat2, ctx) fmpz_mod_mat_equal(mat1, mat2, ctx) |
| 21 | + #define compat_fmpz_mod_mat_is_zero(mat, ctx) fmpz_mod_mat_is_zero(mat, ctx) |
| 22 | + #define compat_fmpz_mod_mat_neg(B, A, ctx) fmpz_mod_mat_neg(B, A, ctx) |
| 23 | + #define compat_fmpz_mod_mat_add(C, A, B, ctx) fmpz_mod_mat_add(C, A, B, ctx) |
| 24 | + #define compat_fmpz_mod_mat_sub(C, A, B, ctx) fmpz_mod_mat_sub(C, A, B, ctx) |
| 25 | + #define compat_fmpz_mod_mat_scalar_mul_fmpz(B, A, c, ctx) fmpz_mod_mat_scalar_mul_fmpz(B, A, c, ctx) |
| 26 | + #define compat_fmpz_mod_mat_mul(C, A, B, ctx) fmpz_mod_mat_mul(C, A, B, ctx) |
| 27 | + #define compat_fmpz_mod_mat_inv(B, A, ctx) fmpz_mod_mat_inv(B, A, ctx) |
| 28 | + #define compat_fmpz_mod_mat_transpose(B, A, ctx) fmpz_mod_mat_transpose(B, A, ctx) |
| 29 | + #define compat_fmpz_mod_mat_solve(X, A, B, ctx) fmpz_mod_mat_solve(X, A, B, ctx) |
| 30 | + #define compat_fmpz_mod_mat_rref(mat, ctx) fmpz_mod_mat_rref(mat, mat, ctx) |
| 31 | + #define compat_fmpz_mod_mat_charpoly(p, M, ctx) fmpz_mod_mat_charpoly(p, M, ctx) |
| 32 | + #define compat_fmpz_mod_mat_minpoly(p, M, ctx) fmpz_mod_mat_minpoly(p, M, ctx) |
| 33 | +
|
| 34 | + #else /* Flint 3.0.0 or 3.0.1 */ |
| 35 | +
|
| 36 | + #define compat_fmpz_mod_mat_init(mat, rows, cols, ctx) fmpz_mod_mat_init(mat, rows, cols, ctx->n) |
| 37 | + #define compat_fmpz_mod_mat_init_set(mat, src, ctx) fmpz_mod_mat_init_set(mat, src) |
| 38 | + #define compat_fmpz_mod_mat_clear(mat, ctx) fmpz_mod_mat_clear(mat) |
| 39 | + #define compat_fmpz_mod_mat_set(A, B, ctx) fmpz_mod_mat_set(A, B) |
| 40 | + #define compat_fmpz_mod_mat_nrows(mat, ctx) fmpz_mod_mat_nrows(mat) |
| 41 | + #define compat_fmpz_mod_mat_ncols(mat, ctx) fmpz_mod_mat_ncols(mat) |
| 42 | + #define compat_fmpz_mod_mat_entry(mat, i, j) fmpz_mod_mat_entry(mat, i, j) |
| 43 | + #define compat_fmpz_mod_mat_set_entry(mat, i, j, val, ctx) fmpz_mod_mat_set_entry(mat, i, j, val) |
| 44 | + #define compat_fmpz_mod_mat_one(mat, ctx) fmpz_mod_mat_one(mat) |
| 45 | + #define compat_fmpz_mod_mat_equal(mat1, mat2, ctx) fmpz_mod_mat_equal(mat1, mat2) |
| 46 | + #define compat_fmpz_mod_mat_is_zero(mat, ctx) fmpz_mod_mat_is_zero(mat) |
| 47 | + #define compat_fmpz_mod_mat_neg(B, A, ctx) fmpz_mod_mat_neg(B, A) |
| 48 | + #define compat_fmpz_mod_mat_add(C, A, B, ctx) fmpz_mod_mat_add(C, A, B) |
| 49 | + #define compat_fmpz_mod_mat_sub(C, A, B, ctx) fmpz_mod_mat_sub(C, A, B) |
| 50 | + #define compat_fmpz_mod_mat_scalar_mul_fmpz(B, A, c, ctx) fmpz_mod_mat_scalar_mul_fmpz(B, A, c) |
| 51 | + #define compat_fmpz_mod_mat_mul(C, A, B, ctx) fmpz_mod_mat_mul(C, A, B) |
| 52 | + #define compat_fmpz_mod_mat_inv(B, A, ctx) fmpz_mod_mat_inv(B, A) |
| 53 | + #define compat_fmpz_mod_mat_transpose(B, A, ctx) fmpz_mod_mat_transpose(B, A) |
| 54 | + #define compat_fmpz_mod_mat_solve(X, A, B, ctx) fmpz_mod_mat_solve(X, A, B) |
| 55 | + #define compat_fmpz_mod_mat_rref(mat, ctx) fmpz_mod_mat_rref(NULL, mat) |
| 56 | + #define compat_fmpz_mod_mat_charpoly(p, M, ctx) fmpz_mod_mat_charpoly(p, M, ctx) |
| 57 | + #define compat_fmpz_mod_mat_minpoly(p, M, ctx) fmpz_mod_mat_minpoly(p, M, ctx) |
| 58 | +
|
| 59 | + #endif |
| 60 | + """ |
| 61 | + |
| 62 | + |
| 63 | +cdef extern from "flint/fmpz_mod_mat.h": |
| 64 | + void compat_fmpz_mod_mat_init(fmpz_mod_mat_t mat, slong rows, slong cols, const fmpz_mod_ctx_t ctx) |
| 65 | + void compat_fmpz_mod_mat_init_set(fmpz_mod_mat_t mat, const fmpz_mod_mat_t src, const fmpz_mod_ctx_t ctx) |
| 66 | + void compat_fmpz_mod_mat_clear(fmpz_mod_mat_t mat, fmpz_mod_ctx_t ctx) |
| 67 | + void compat_fmpz_mod_mat_set(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t ctx) |
| 68 | + slong compat_fmpz_mod_mat_nrows(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) |
| 69 | + slong compat_fmpz_mod_mat_ncols(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) |
| 70 | + fmpz_struct * compat_fmpz_mod_mat_entry(const fmpz_mod_mat_t mat, slong i, slong j) |
| 71 | + void compat_fmpz_mod_mat_set_entry(fmpz_mod_mat_t mat, slong i, slong j, const fmpz_t val, const fmpz_mod_ctx_t ctx) |
| 72 | + void compat_fmpz_mod_mat_one(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) |
| 73 | + int compat_fmpz_mod_mat_equal(const fmpz_mod_mat_t mat1, const fmpz_mod_mat_t mat2, const fmpz_mod_ctx_t ctx) |
| 74 | + int compat_fmpz_mod_mat_is_zero(const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) |
| 75 | + void compat_fmpz_mod_mat_neg(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t ctx) |
| 76 | + void compat_fmpz_mod_mat_add(fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, const fmpz_mod_ctx_t ctx) |
| 77 | + void compat_fmpz_mod_mat_sub(fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, const fmpz_mod_ctx_t ctx) |
| 78 | + void compat_fmpz_mod_mat_scalar_mul_fmpz(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, fmpz_t c, const fmpz_mod_ctx_t ctx) |
| 79 | + void compat_fmpz_mod_mat_mul(fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, const fmpz_mod_ctx_t ctx) |
| 80 | + int compat_fmpz_mod_mat_inv(fmpz_mod_mat_t B, fmpz_mod_mat_t A, const fmpz_mod_ctx_t ctx) |
| 81 | + void compat_fmpz_mod_mat_transpose(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, const fmpz_mod_ctx_t ctx) |
| 82 | + int compat_fmpz_mod_mat_solve(fmpz_mod_mat_t X, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, const fmpz_mod_ctx_t ctx) |
| 83 | + slong compat_fmpz_mod_mat_rref(fmpz_mod_mat_t mat, const fmpz_mod_ctx_t ctx) |
| 84 | + void compat_fmpz_mod_mat_charpoly(fmpz_mod_poly_t p, const fmpz_mod_mat_t M, const fmpz_mod_ctx_t ctx) |
| 85 | + void compat_fmpz_mod_mat_minpoly(fmpz_mod_poly_t p, const fmpz_mod_mat_t M, const fmpz_mod_ctx_t ctx) |
| 86 | + # |
| 87 | + # The functions below are unused. The signatures shown are for Flint < 3.1.0 |
| 88 | + # Probably compat_ versions are needed but each signature should be checked |
| 89 | + # against Flint 3.1.0 or later. For now we comment these out. |
| 90 | + # |
| 91 | + # void _fmpz_mod_mat_set_mod(fmpz_mod_mat_t mat, const fmpz_t n) |
| 92 | + # void fmpz_mod_mat_zero(fmpz_mod_mat_t mat) |
| 93 | + # void fmpz_mod_mat_swap(fmpz_mod_mat_t mat1, fmpz_mod_mat_t mat2) |
| 94 | + # void fmpz_mod_mat_swap_entrywise(fmpz_mod_mat_t mat1, fmpz_mod_mat_t mat2) |
| 95 | + # int fmpz_mod_mat_is_empty(const fmpz_mod_mat_t mat) |
| 96 | + # int fmpz_mod_mat_is_square(const fmpz_mod_mat_t mat) |
| 97 | + # void _fmpz_mod_mat_reduce(fmpz_mod_mat_t mat) |
| 98 | + # void fmpz_mod_mat_randtest(fmpz_mod_mat_t mat, flint_rand_t state) |
| 99 | + # void fmpz_mod_mat_window_init(fmpz_mod_mat_t window, const fmpz_mod_mat_t mat, slong r1, slong c1, slong r2, slong c2) |
| 100 | + # void fmpz_mod_mat_window_clear(fmpz_mod_mat_t window) |
| 101 | + # void fmpz_mod_mat_concat_horizontal(fmpz_mod_mat_t res, const fmpz_mod_mat_t mat1, const fmpz_mod_mat_t mat2) |
| 102 | + # void fmpz_mod_mat_concat_vertical(fmpz_mod_mat_t res, const fmpz_mod_mat_t mat1, const fmpz_mod_mat_t mat2) |
| 103 | + # void fmpz_mod_mat_print_pretty(const fmpz_mod_mat_t mat) |
| 104 | + # void fmpz_mod_mat_set_fmpz_mat(fmpz_mod_mat_t A, const fmpz_mat_t B) |
| 105 | + # void fmpz_mod_mat_get_fmpz_mat(fmpz_mat_t A, const fmpz_mod_mat_t B) |
| 106 | + # void fmpz_mod_mat_scalar_mul_si(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, slong c) |
| 107 | + # void fmpz_mod_mat_scalar_mul_ui(fmpz_mod_mat_t B, const fmpz_mod_mat_t A, ulong c) |
| 108 | + # # unimported types {'thread_pool_handle'} |
| 109 | + # # void _fmpz_mod_mat_mul_classical_threaded_pool_op(fmpz_mod_mat_t D, const fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, int op, thread_pool_handle * threads, slong num_threads) |
| 110 | + # void _fmpz_mod_mat_mul_classical_threaded_op(fmpz_mod_mat_t D, const fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B, int op) |
| 111 | + # void fmpz_mod_mat_mul_classical_threaded(fmpz_mod_mat_t C, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B) |
| 112 | + # void fmpz_mod_mat_sqr(fmpz_mod_mat_t B, const fmpz_mod_mat_t A) |
| 113 | + # void fmpz_mod_mat_mul_fmpz_vec(fmpz_struct * c, const fmpz_mod_mat_t A, const fmpz_struct * b, slong blen) |
| 114 | + # void fmpz_mod_mat_mul_fmpz_vec_ptr(fmpz_struct * const * c, const fmpz_mod_mat_t A, const fmpz_struct * const * b, slong blen) |
| 115 | + # void fmpz_mod_mat_fmpz_vec_mul(fmpz_struct * c, const fmpz_struct * a, slong alen, const fmpz_mod_mat_t B) |
| 116 | + # void fmpz_mod_mat_fmpz_vec_mul_ptr(fmpz_struct * const * c, const fmpz_struct * const * a, slong alen, const fmpz_mod_mat_t B) |
| 117 | + # void fmpz_mod_mat_trace(fmpz_t trace, const fmpz_mod_mat_t mat) |
| 118 | + # void fmpz_mod_mat_strong_echelon_form(fmpz_mod_mat_t mat) |
| 119 | + # slong fmpz_mod_mat_howell_form(fmpz_mod_mat_t mat) |
| 120 | + # slong fmpz_mod_mat_lu(slong * P, fmpz_mod_mat_t A, int rank_check) |
| 121 | + # void fmpz_mod_mat_solve_tril(fmpz_mod_mat_t X, const fmpz_mod_mat_t L, const fmpz_mod_mat_t B, int unit) |
| 122 | + # void fmpz_mod_mat_solve_triu(fmpz_mod_mat_t X, const fmpz_mod_mat_t U, const fmpz_mod_mat_t B, int unit) |
| 123 | + # int fmpz_mod_mat_can_solve(fmpz_mod_mat_t X, const fmpz_mod_mat_t A, const fmpz_mod_mat_t B) |
| 124 | + # void fmpz_mod_mat_similarity(fmpz_mod_mat_t M, slong r, fmpz_t d) |
0 commit comments