1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#![allow(non_camel_case_types)]
use crate::deps::*;
use crate::flint::*;
use crate::fmpq::fmpq;
use crate::fmpq_poly::fmpq_poly_struct;
use crate::fmpz::fmpz;
use crate::fmpz_mat::fmpz_mat_struct;
use libc::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct fmpq_mat_struct {
pub entries: *mut fmpq,
pub r: mp_limb_signed_t,
pub c: mp_limb_signed_t,
pub rows: *mut *mut fmpq,
}
pub type fmpq_mat_t = [fmpq_mat_struct; 1usize];
extern "C" {
pub fn fmpq_mat_entry(
mat: *const fmpq_mat_struct,
i: mp_limb_signed_t,
j: mp_limb_signed_t,
) -> *mut fmpq;
pub fn fmpq_mat_entry_num(
mat: *const fmpq_mat_struct,
i: mp_limb_signed_t,
j: mp_limb_signed_t,
) -> *mut fmpz;
pub fn fmpq_mat_entry_den(
mat: *const fmpq_mat_struct,
i: mp_limb_signed_t,
j: mp_limb_signed_t,
) -> *mut fmpz;
pub fn fmpq_mat_nrows(mat: *const fmpq_mat_struct) -> mp_limb_signed_t;
pub fn fmpq_mat_ncols(mat: *const fmpq_mat_struct) -> mp_limb_signed_t;
pub fn fmpq_mat_init(mat: *mut fmpq_mat_struct, rows: mp_limb_signed_t, cols: mp_limb_signed_t);
pub fn fmpq_mat_init_set(mat1: *mut fmpq_mat_struct, mat2: *const fmpq_mat_struct);
pub fn fmpq_mat_clear(mat: *mut fmpq_mat_struct);
pub fn fmpq_mat_swap(mat1: *mut fmpq_mat_struct, mat2: *mut fmpq_mat_struct);
pub fn fmpq_mat_window_init(
window: *mut fmpq_mat_struct,
mat: *const fmpq_mat_struct,
r1: mp_limb_signed_t,
c1: mp_limb_signed_t,
r2: mp_limb_signed_t,
c2: mp_limb_signed_t,
);
pub fn fmpq_mat_window_clear(window: *mut fmpq_mat_struct);
pub fn fmpq_mat_concat_horizontal(
res: *mut fmpq_mat_struct,
mat1: *const fmpq_mat_struct,
mat2: *const fmpq_mat_struct,
);
pub fn fmpq_mat_concat_vertical(
res: *mut fmpq_mat_struct,
mat1: *const fmpq_mat_struct,
mat2: *const fmpq_mat_struct,
);
pub fn fmpq_mat_print(mat: *const fmpq_mat_struct);
pub fn fmpq_mat_randbits(
mat: *mut fmpq_mat_struct,
state: *const flint_rand_s,
bits: mp_limb_t,
);
pub fn fmpq_mat_randtest(
mat: *mut fmpq_mat_struct,
state: *const flint_rand_s,
bits: mp_limb_t,
);
pub fn fmpq_mat_hilbert_matrix(mat: *const fmpq_mat_struct);
pub fn fmpq_mat_set(dest: *mut fmpq_mat_struct, src: *const fmpq_mat_struct);
pub fn fmpq_mat_zero(mat: *mut fmpq_mat_struct);
pub fn fmpq_mat_one(mat: *mut fmpq_mat_struct);
pub fn fmpq_mat_transpose(rop: *mut fmpq_mat_struct, op: *const fmpq_mat_struct);
pub fn fmpq_mat_add(
mat: *mut fmpq_mat_struct,
mat1: *const fmpq_mat_struct,
mat2: *const fmpq_mat_struct,
);
pub fn fmpq_mat_sub(
mat: *mut fmpq_mat_struct,
mat1: *const fmpq_mat_struct,
mat2: *const fmpq_mat_struct,
);
pub fn fmpq_mat_neg(rop: *mut fmpq_mat_struct, op: *const fmpq_mat_struct);
pub fn fmpq_mat_scalar_mul_fmpq(
rop: *mut fmpq_mat_struct,
op: *const fmpq_mat_struct,
x: *const fmpq,
);
pub fn fmpq_mat_scalar_mul_fmpz(
rop: *mut fmpq_mat_struct,
op: *const fmpq_mat_struct,
x: *const fmpz,
);
pub fn fmpq_mat_scalar_div_fmpz(
rop: *mut fmpq_mat_struct,
op: *const fmpq_mat_struct,
x: *const fmpz,
);
pub fn fmpq_mat_equal(mat1: *const fmpq_mat_struct, mat2: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_is_integral(mat: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_is_zero(mat: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_is_one(mat: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_is_empty(mat: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_is_square(mat: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_get_fmpz_mat(dest: *mut fmpz_mat_struct, mat: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_get_fmpz_mat_entrywise(
num: *mut fmpz_mat_struct,
den: *mut fmpz_mat_struct,
mat: *const fmpq_mat_struct,
);
pub fn fmpq_mat_get_fmpz_mat_matwise(
num: *mut fmpz_mat_struct,
den: *mut fmpz,
mat: *const fmpq_mat_struct,
);
pub fn fmpq_mat_get_fmpz_mat_rowwise(
num: *mut fmpz_mat_struct,
den: *mut fmpz,
mat: *const fmpq_mat_struct,
);
pub fn fmpq_mat_get_fmpz_mat_colwise(
num: *mut fmpz_mat_struct,
den: *mut fmpz,
mat: *const fmpq_mat_struct,
);
pub fn fmpq_mat_get_fmpz_mat_rowwise_2(
num: *mut fmpz_mat_struct,
num2: *mut fmpz_mat_struct,
den: *mut fmpz,
mat: *const fmpq_mat_struct,
mat2: *const fmpq_mat_struct,
);
pub fn fmpq_mat_get_fmpz_mat_mod_fmpz(
dest: *mut fmpz_mat_struct,
mat: *const fmpq_mat_struct,
mod_: *const fmpz,
);
pub fn fmpq_mat_set_fmpz_mat(dest: *mut fmpq_mat_struct, src: *const fmpz_mat_struct);
pub fn fmpq_mat_set_fmpz_mat_div_fmpz(
X: *mut fmpq_mat_struct,
Xmod: *const fmpz_mat_struct,
div: *const fmpz,
);
pub fn fmpq_mat_set_fmpz_mat_mod_fmpz(
X: *mut fmpq_mat_struct,
Xmod: *const fmpz_mat_struct,
mod_: *const fmpz,
) -> c_int;
pub fn fmpq_mat_mul_direct(
C: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
);
pub fn fmpq_mat_mul_cleared(
C: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
);
pub fn fmpq_mat_mul(
C: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
);
pub fn fmpq_mat_mul_fmpz_mat(
C: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpz_mat_struct,
);
pub fn fmpq_mat_mul_r_fmpz_mat(
C: *mut fmpq_mat_struct,
A: *const fmpz_mat_struct,
B: *const fmpq_mat_struct,
);
pub fn fmpq_mat_kronecker_product(
C: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
);
pub fn fmpq_mat_swap_rows(
mat: *mut fmpq_mat_struct,
perm: *const mp_limb_signed_t,
r: mp_limb_signed_t,
s: mp_limb_signed_t,
);
pub fn fmpq_mat_invert_rows(mat: *mut fmpq_mat_struct, perm: *const mp_limb_signed_t);
pub fn fmpq_mat_swap_cols(
mat: *mut fmpq_mat_struct,
perm: *const mp_limb_signed_t,
r: mp_limb_signed_t,
s: mp_limb_signed_t,
);
pub fn fmpq_mat_invert_cols(mat: *mut fmpq_mat_struct, perm: *const mp_limb_signed_t);
pub fn fmpq_mat_trace(trace: *mut fmpq, mat: *const fmpq_mat_struct);
pub fn fmpq_mat_det(det: *mut fmpq, mat: *const fmpq_mat_struct);
pub fn fmpq_mat_solve_fmpz_mat_fraction_free(
X: *mut fmpq_mat_struct,
A: *const fmpz_mat_struct,
B: *const fmpz_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve_fraction_free(
X: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve_fmpz_mat_dixon(
X: *mut fmpq_mat_struct,
A: *const fmpz_mat_struct,
B: *const fmpz_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve_dixon(
X: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve_fmpz_mat_multi_mod(
X: *mut fmpq_mat_struct,
A: *const fmpz_mat_struct,
B: *const fmpz_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve_multi_mod(
X: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
) -> c_int;
pub fn fmpq_mat_can_solve_fmpz_mat_multi_mod(
X: *mut fmpq_mat_struct,
A: *const fmpz_mat_struct,
B: *const fmpz_mat_struct,
) -> c_int;
pub fn fmpq_mat_can_solve_multi_mod(
X: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve_fmpz_mat(
X: *mut fmpq_mat_struct,
A: *const fmpz_mat_struct,
B: *const fmpz_mat_struct,
) -> c_int;
pub fn fmpq_mat_solve(
X: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
B: *const fmpq_mat_struct,
) -> c_int;
pub fn fmpq_mat_inv(B: *mut fmpq_mat_struct, A: *const fmpq_mat_struct) -> c_int;
pub fn fmpq_mat_pivot(
perm: *mut mp_limb_signed_t,
mat: *mut fmpq_mat_struct,
r: mp_limb_signed_t,
c: mp_limb_signed_t,
) -> c_int;
pub fn fmpq_mat_rref_classical(
B: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
) -> mp_limb_signed_t;
pub fn fmpq_mat_rref_fraction_free(
B: *mut fmpq_mat_struct,
A: *const fmpq_mat_struct,
) -> mp_limb_signed_t;
pub fn fmpq_mat_rref(B: *mut fmpq_mat_struct, A: *const fmpq_mat_struct) -> mp_limb_signed_t;
pub fn fmpq_mat_gso(B: *mut fmpq_mat_struct, A: *const fmpq_mat_struct);
pub fn fmpq_mat_similarity(A: *mut fmpq_mat_struct, r: mp_limb_signed_t, d: *const fmpq);
pub fn _fmpq_mat_charpoly(coeffs: *mut fmpz, den: *mut fmpz, mat: *const fmpq_mat_struct);
pub fn fmpq_mat_charpoly(pol: *mut fmpq_poly_struct, mat: *const fmpq_mat_struct);
pub fn _fmpq_mat_minpoly(
coeffs: *mut fmpz,
den: *mut fmpz,
mat: *const fmpq_mat_struct,
) -> mp_limb_signed_t;
pub fn fmpq_mat_minpoly(pol: *mut fmpq_poly_struct, mat: *const fmpq_mat_struct);
}