1use crate::deps::*;
4use crate::ca_types::*;
5use crate::fexpr::*;
6use crate::flint::*;
7use crate::fmpq_types::*;
8use crate::fmpz_types::*;
9use crate::gr_types::*;
10
11
12extern "C" {
13 #[link_name = "ca_mat_entry_ptr__extern"]
14 pub fn ca_mat_entry_ptr(mat: *mut ca_mat_struct, i: slong, j: slong) -> ca_ptr;
15 pub fn ca_mat_init(mat: *mut ca_mat_struct, r: slong, c: slong, ctx: *mut ca_ctx_struct);
16 pub fn ca_mat_clear(mat: *mut ca_mat_struct, ctx: *mut ca_ctx_struct);
17 #[link_name = "ca_mat_swap__extern"]
18 pub fn ca_mat_swap(mat1: *mut ca_mat_struct, mat2: *mut ca_mat_struct, ctx: *mut ca_ctx_struct);
19 pub fn ca_mat_window_init(
20 window: *mut ca_mat_struct,
21 mat: *const ca_mat_struct,
22 r1: slong,
23 c1: slong,
24 r2: slong,
25 c2: slong,
26 ctx: *mut ca_ctx_struct,
27 );
28 #[link_name = "ca_mat_window_clear__extern"]
29 pub fn ca_mat_window_clear(UNUSED_window: *mut ca_mat_struct, UNUSED_ctx: *mut ca_ctx_struct);
30 #[link_name = "ca_mat_is_empty__extern"]
31 pub fn ca_mat_is_empty(mat: *const ca_mat_struct) -> libc::c_int;
32 #[link_name = "ca_mat_is_square__extern"]
33 pub fn ca_mat_is_square(mat: *const ca_mat_struct) -> libc::c_int;
34 pub fn ca_mat_set(dest: *mut ca_mat_struct, src: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
35 pub fn ca_mat_set_fmpz_mat(
36 dest: *mut ca_mat_struct,
37 src: *const fmpz_mat_struct,
38 ctx: *mut ca_ctx_struct,
39 );
40 pub fn ca_mat_set_fmpq_mat(
41 dest: *mut ca_mat_struct,
42 src: *const fmpq_mat_struct,
43 ctx: *mut ca_ctx_struct,
44 );
45 pub fn ca_mat_set_ca(y: *mut ca_mat_struct, x: *const ca_struct, ctx: *mut ca_ctx_struct);
46 pub fn ca_mat_get_fexpr(
47 res: *mut fexpr_struct,
48 A: *const ca_mat_struct,
49 flags: ulong,
50 ctx: *mut ca_ctx_struct,
51 );
52 pub fn ca_mat_transfer(
53 res: *mut ca_mat_struct,
54 res_ctx: *mut ca_ctx_struct,
55 src: *const ca_mat_struct,
56 src_ctx: *mut ca_ctx_struct,
57 );
58 pub fn ca_mat_randtest(
59 mat: *mut ca_mat_struct,
60 state: *mut flint_rand_struct,
61 len: slong,
62 bits: slong,
63 ctx: *mut ca_ctx_struct,
64 );
65 pub fn ca_mat_randtest_rational(
66 mat: *mut ca_mat_struct,
67 state: *mut flint_rand_struct,
68 bits: slong,
69 ctx: *mut ca_ctx_struct,
70 );
71 pub fn ca_mat_randops(
72 mat: *mut ca_mat_struct,
73 state: *mut flint_rand_struct,
74 count: slong,
75 ctx: *mut ca_ctx_struct,
76 );
77 pub fn ca_mat_print(mat: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
78 pub fn ca_mat_printn(mat: *const ca_mat_struct, digits: slong, ctx: *mut ca_ctx_struct);
79 pub fn ca_mat_zero(mat: *mut ca_mat_struct, ctx: *mut ca_ctx_struct);
80 pub fn ca_mat_one(mat: *mut ca_mat_struct, ctx: *mut ca_ctx_struct);
81 pub fn ca_mat_ones(mat: *mut ca_mat_struct, ctx: *mut ca_ctx_struct);
82 pub fn ca_mat_pascal(mat: *mut ca_mat_struct, triangular: libc::c_int, ctx: *mut ca_ctx_struct);
83 pub fn ca_mat_stirling(mat: *mut ca_mat_struct, kind: libc::c_int, ctx: *mut ca_ctx_struct);
84 pub fn ca_mat_hilbert(mat: *mut ca_mat_struct, ctx: *mut ca_ctx_struct);
85 pub fn ca_mat_dft(res: *mut ca_mat_struct, type_: libc::c_int, ctx: *mut ca_ctx_struct);
86 pub fn ca_mat_check_equal(
87 A: *const ca_mat_struct,
88 B: *const ca_mat_struct,
89 ctx: *mut ca_ctx_struct,
90 ) -> truth_t;
91 pub fn ca_mat_check_is_zero(A: *const ca_mat_struct, ctx: *mut ca_ctx_struct) -> truth_t;
92 pub fn ca_mat_check_is_one(A: *const ca_mat_struct, ctx: *mut ca_ctx_struct) -> truth_t;
93 pub fn ca_mat_transpose(
94 B: *mut ca_mat_struct,
95 A: *const ca_mat_struct,
96 ctx: *mut ca_ctx_struct,
97 );
98 pub fn ca_mat_conj(B: *mut ca_mat_struct, A: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
99 pub fn ca_mat_conj_transpose(
100 mat1: *mut ca_mat_struct,
101 mat2: *const ca_mat_struct,
102 ctx: *mut ca_ctx_struct,
103 );
104 pub fn ca_mat_add_ca(
105 y: *mut ca_mat_struct,
106 a: *const ca_mat_struct,
107 x: *const ca_struct,
108 ctx: *mut ca_ctx_struct,
109 );
110 pub fn ca_mat_sub_ca(
111 y: *mut ca_mat_struct,
112 a: *const ca_mat_struct,
113 x: *const ca_struct,
114 ctx: *mut ca_ctx_struct,
115 );
116 pub fn ca_mat_addmul_ca(
117 y: *mut ca_mat_struct,
118 a: *const ca_mat_struct,
119 x: *const ca_struct,
120 ctx: *mut ca_ctx_struct,
121 );
122 pub fn ca_mat_submul_ca(
123 y: *mut ca_mat_struct,
124 a: *const ca_mat_struct,
125 x: *const ca_struct,
126 ctx: *mut ca_ctx_struct,
127 );
128 pub fn ca_mat_neg(dest: *mut ca_mat_struct, src: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
129 pub fn ca_mat_add(
130 res: *mut ca_mat_struct,
131 mat1: *const ca_mat_struct,
132 mat2: *const ca_mat_struct,
133 ctx: *mut ca_ctx_struct,
134 );
135 pub fn ca_mat_sub(
136 res: *mut ca_mat_struct,
137 mat1: *const ca_mat_struct,
138 mat2: *const ca_mat_struct,
139 ctx: *mut ca_ctx_struct,
140 );
141 pub fn ca_mat_mul(
142 C: *mut ca_mat_struct,
143 A: *const ca_mat_struct,
144 B: *const ca_mat_struct,
145 ctx: *mut ca_ctx_struct,
146 );
147 pub fn ca_mat_mul_classical(
148 C: *mut ca_mat_struct,
149 A: *const ca_mat_struct,
150 B: *const ca_mat_struct,
151 ctx: *mut ca_ctx_struct,
152 );
153 pub fn ca_mat_mul_same_nf(
154 C: *mut ca_mat_struct,
155 A: *const ca_mat_struct,
156 B: *const ca_mat_struct,
157 K: *mut ca_field_struct,
158 ctx: *mut ca_ctx_struct,
159 );
160 #[link_name = "ca_mat_mul_si__extern"]
161 pub fn ca_mat_mul_si(
162 B: *mut ca_mat_struct,
163 A: *const ca_mat_struct,
164 c: slong,
165 ctx: *mut ca_ctx_struct,
166 );
167 #[link_name = "ca_mat_mul_fmpz__extern"]
168 pub fn ca_mat_mul_fmpz(
169 B: *mut ca_mat_struct,
170 A: *const ca_mat_struct,
171 c: *const fmpz,
172 ctx: *mut ca_ctx_struct,
173 );
174 #[link_name = "ca_mat_mul_fmpq__extern"]
175 pub fn ca_mat_mul_fmpq(
176 B: *mut ca_mat_struct,
177 A: *const ca_mat_struct,
178 c: *const fmpq,
179 ctx: *mut ca_ctx_struct,
180 );
181 #[link_name = "ca_mat_mul_ca__extern"]
182 pub fn ca_mat_mul_ca(
183 B: *mut ca_mat_struct,
184 A: *const ca_mat_struct,
185 c: *const ca_struct,
186 ctx: *mut ca_ctx_struct,
187 );
188 #[link_name = "ca_mat_div_si__extern"]
189 pub fn ca_mat_div_si(
190 B: *mut ca_mat_struct,
191 A: *const ca_mat_struct,
192 c: slong,
193 ctx: *mut ca_ctx_struct,
194 );
195 #[link_name = "ca_mat_div_fmpz__extern"]
196 pub fn ca_mat_div_fmpz(
197 B: *mut ca_mat_struct,
198 A: *const ca_mat_struct,
199 c: *const fmpz,
200 ctx: *mut ca_ctx_struct,
201 );
202 #[link_name = "ca_mat_div_fmpq__extern"]
203 pub fn ca_mat_div_fmpq(
204 B: *mut ca_mat_struct,
205 A: *const ca_mat_struct,
206 c: *const fmpq,
207 ctx: *mut ca_ctx_struct,
208 );
209 #[link_name = "ca_mat_div_ca__extern"]
210 pub fn ca_mat_div_ca(
211 B: *mut ca_mat_struct,
212 A: *const ca_mat_struct,
213 c: *const ca_struct,
214 ctx: *mut ca_ctx_struct,
215 );
216 #[link_name = "ca_mat_sqr__extern"]
217 pub fn ca_mat_sqr(res: *mut ca_mat_struct, A: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
218 pub fn ca_mat_pow_ui_binexp(
219 B: *mut ca_mat_struct,
220 A: *const ca_mat_struct,
221 exp: ulong,
222 ctx: *mut ca_ctx_struct,
223 );
224 pub fn _ca_mat_ca_poly_evaluate(
225 y: *mut ca_mat_struct,
226 poly: ca_srcptr,
227 len: slong,
228 x: *const ca_mat_struct,
229 ctx: *mut ca_ctx_struct,
230 );
231 pub fn ca_mat_ca_poly_evaluate(
232 res: *mut ca_mat_struct,
233 f: *const ca_poly_struct,
234 a: *const ca_mat_struct,
235 ctx: *mut ca_ctx_struct,
236 );
237 pub fn ca_mat_trace(trace: *mut ca_struct, mat: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
238 pub fn ca_mat_find_pivot(
239 pivot_row: *mut slong,
240 mat: *mut ca_mat_struct,
241 start_row: slong,
242 end_row: slong,
243 column: slong,
244 ctx: *mut ca_ctx_struct,
245 ) -> truth_t;
246 #[link_name = "_ca_mat_swap_rows__extern"]
247 pub fn _ca_mat_swap_rows(mat: *mut ca_mat_struct, perm: *mut slong, r: slong, s: slong);
248 pub fn ca_mat_lu_classical(
249 rank: *mut slong,
250 P: *mut slong,
251 LU: *mut ca_mat_struct,
252 A: *const ca_mat_struct,
253 rank_check: libc::c_int,
254 ctx: *mut ca_ctx_struct,
255 ) -> libc::c_int;
256 pub fn ca_mat_lu_recursive(
257 rank: *mut slong,
258 P: *mut slong,
259 LU: *mut ca_mat_struct,
260 A: *const ca_mat_struct,
261 rank_check: libc::c_int,
262 ctx: *mut ca_ctx_struct,
263 ) -> libc::c_int;
264 pub fn ca_mat_lu(
265 rank: *mut slong,
266 P: *mut slong,
267 LU: *mut ca_mat_struct,
268 A: *const ca_mat_struct,
269 rank_check: libc::c_int,
270 ctx: *mut ca_ctx_struct,
271 ) -> libc::c_int;
272 pub fn ca_mat_fflu(
273 rank: *mut slong,
274 P: *mut slong,
275 LU: *mut ca_mat_struct,
276 den: *mut ca_struct,
277 A: *const ca_mat_struct,
278 rank_check: libc::c_int,
279 ctx: *mut ca_ctx_struct,
280 ) -> libc::c_int;
281 pub fn ca_mat_rref_fflu(
282 rank: *mut slong,
283 R: *mut ca_mat_struct,
284 A: *const ca_mat_struct,
285 ctx: *mut ca_ctx_struct,
286 ) -> libc::c_int;
287 pub fn ca_mat_rref_lu(
288 rank: *mut slong,
289 R: *mut ca_mat_struct,
290 A: *const ca_mat_struct,
291 ctx: *mut ca_ctx_struct,
292 ) -> libc::c_int;
293 pub fn ca_mat_rref(
294 rank: *mut slong,
295 R: *mut ca_mat_struct,
296 A: *const ca_mat_struct,
297 ctx: *mut ca_ctx_struct,
298 ) -> libc::c_int;
299 pub fn ca_mat_nonsingular_lu(
300 P: *mut slong,
301 LU: *mut ca_mat_struct,
302 A: *const ca_mat_struct,
303 ctx: *mut ca_ctx_struct,
304 ) -> truth_t;
305 pub fn ca_mat_nonsingular_fflu(
306 P: *mut slong,
307 LU: *mut ca_mat_struct,
308 den: *mut ca_struct,
309 A: *const ca_mat_struct,
310 ctx: *mut ca_ctx_struct,
311 ) -> truth_t;
312 pub fn ca_mat_nonsingular_solve_adjugate(
313 X: *mut ca_mat_struct,
314 A: *const ca_mat_struct,
315 B: *const ca_mat_struct,
316 ctx: *mut ca_ctx_struct,
317 ) -> truth_t;
318 pub fn ca_mat_nonsingular_solve_fflu(
319 X: *mut ca_mat_struct,
320 A: *const ca_mat_struct,
321 B: *const ca_mat_struct,
322 ctx: *mut ca_ctx_struct,
323 ) -> truth_t;
324 pub fn ca_mat_nonsingular_solve_lu(
325 X: *mut ca_mat_struct,
326 A: *const ca_mat_struct,
327 B: *const ca_mat_struct,
328 ctx: *mut ca_ctx_struct,
329 ) -> truth_t;
330 pub fn ca_mat_nonsingular_solve(
331 X: *mut ca_mat_struct,
332 A: *const ca_mat_struct,
333 B: *const ca_mat_struct,
334 ctx: *mut ca_ctx_struct,
335 ) -> truth_t;
336 pub fn ca_mat_inv(
337 X: *mut ca_mat_struct,
338 A: *const ca_mat_struct,
339 ctx: *mut ca_ctx_struct,
340 ) -> truth_t;
341 pub fn ca_mat_solve_tril_classical(
342 X: *mut ca_mat_struct,
343 L: *const ca_mat_struct,
344 B: *const ca_mat_struct,
345 unit: libc::c_int,
346 ctx: *mut ca_ctx_struct,
347 );
348 pub fn ca_mat_solve_tril_recursive(
349 X: *mut ca_mat_struct,
350 L: *const ca_mat_struct,
351 B: *const ca_mat_struct,
352 unit: libc::c_int,
353 ctx: *mut ca_ctx_struct,
354 );
355 pub fn ca_mat_solve_tril(
356 X: *mut ca_mat_struct,
357 L: *const ca_mat_struct,
358 B: *const ca_mat_struct,
359 unit: libc::c_int,
360 ctx: *mut ca_ctx_struct,
361 );
362 pub fn ca_mat_solve_triu_classical(
363 X: *mut ca_mat_struct,
364 U: *const ca_mat_struct,
365 B: *const ca_mat_struct,
366 unit: libc::c_int,
367 ctx: *mut ca_ctx_struct,
368 );
369 pub fn ca_mat_solve_triu_recursive(
370 X: *mut ca_mat_struct,
371 U: *const ca_mat_struct,
372 B: *const ca_mat_struct,
373 unit: libc::c_int,
374 ctx: *mut ca_ctx_struct,
375 );
376 pub fn ca_mat_solve_triu(
377 X: *mut ca_mat_struct,
378 U: *const ca_mat_struct,
379 B: *const ca_mat_struct,
380 unit: libc::c_int,
381 ctx: *mut ca_ctx_struct,
382 );
383 pub fn ca_mat_solve_lu_precomp(
384 X: *mut ca_mat_struct,
385 perm: *const slong,
386 A: *const ca_mat_struct,
387 B: *const ca_mat_struct,
388 ctx: *mut ca_ctx_struct,
389 );
390 pub fn ca_mat_solve_fflu_precomp(
391 X: *mut ca_mat_struct,
392 perm: *const slong,
393 A: *const ca_mat_struct,
394 den: *const ca_struct,
395 B: *const ca_mat_struct,
396 ctx: *mut ca_ctx_struct,
397 );
398 pub fn ca_mat_rank(
399 rank: *mut slong,
400 A: *const ca_mat_struct,
401 ctx: *mut ca_ctx_struct,
402 ) -> libc::c_int;
403 pub fn ca_mat_right_kernel(
404 X: *mut ca_mat_struct,
405 A: *const ca_mat_struct,
406 ctx: *mut ca_ctx_struct,
407 ) -> libc::c_int;
408 pub fn ca_mat_det_berkowitz(
409 det: *mut ca_struct,
410 A: *const ca_mat_struct,
411 ctx: *mut ca_ctx_struct,
412 );
413 pub fn ca_mat_det_lu(
414 det: *mut ca_struct,
415 A: *const ca_mat_struct,
416 ctx: *mut ca_ctx_struct,
417 ) -> libc::c_int;
418 pub fn ca_mat_det_bareiss(
419 det: *mut ca_struct,
420 A: *const ca_mat_struct,
421 ctx: *mut ca_ctx_struct,
422 ) -> libc::c_int;
423 pub fn ca_mat_det_cofactor(
424 det: *mut ca_struct,
425 A: *const ca_mat_struct,
426 ctx: *mut ca_ctx_struct,
427 );
428 pub fn ca_mat_det(det: *mut ca_struct, A: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
429 pub fn ca_mat_adjugate_cofactor(
430 adj: *mut ca_mat_struct,
431 det: *mut ca_struct,
432 A: *const ca_mat_struct,
433 ctx: *mut ca_ctx_struct,
434 );
435 pub fn ca_mat_adjugate_charpoly(
436 adj: *mut ca_mat_struct,
437 det: *mut ca_struct,
438 A: *const ca_mat_struct,
439 ctx: *mut ca_ctx_struct,
440 );
441 pub fn ca_mat_adjugate(
442 adj: *mut ca_mat_struct,
443 det: *mut ca_struct,
444 A: *const ca_mat_struct,
445 ctx: *mut ca_ctx_struct,
446 );
447 pub fn _ca_mat_charpoly_berkowitz(
448 cp: ca_ptr,
449 mat: *const ca_mat_struct,
450 ctx: *mut ca_ctx_struct,
451 );
452 pub fn ca_mat_charpoly_berkowitz(
453 cp: *mut ca_poly_struct,
454 mat: *const ca_mat_struct,
455 ctx: *mut ca_ctx_struct,
456 );
457 pub fn _ca_mat_charpoly_danilevsky(
458 p: ca_ptr,
459 A: *const ca_mat_struct,
460 ctx: *mut ca_ctx_struct,
461 ) -> libc::c_int;
462 pub fn ca_mat_charpoly_danilevsky(
463 cp: *mut ca_poly_struct,
464 mat: *const ca_mat_struct,
465 ctx: *mut ca_ctx_struct,
466 ) -> libc::c_int;
467 pub fn _ca_mat_charpoly(cp: ca_ptr, mat: *const ca_mat_struct, ctx: *mut ca_ctx_struct);
468 pub fn ca_mat_charpoly(
469 cp: *mut ca_poly_struct,
470 mat: *const ca_mat_struct,
471 ctx: *mut ca_ctx_struct,
472 );
473 pub fn ca_mat_companion(
474 A: *mut ca_mat_struct,
475 poly: *const ca_poly_struct,
476 ctx: *mut ca_ctx_struct,
477 ) -> libc::c_int;
478 pub fn ca_mat_eigenvalues(
479 lambda: *mut ca_vec_struct,
480 exp: *mut ulong,
481 mat: *const ca_mat_struct,
482 ctx: *mut ca_ctx_struct,
483 ) -> libc::c_int;
484 pub fn ca_mat_diagonalization(
485 D: *mut ca_mat_struct,
486 P: *mut ca_mat_struct,
487 A: *const ca_mat_struct,
488 ctx: *mut ca_ctx_struct,
489 ) -> truth_t;
490 pub fn ca_mat_set_jordan_blocks(
491 mat: *mut ca_mat_struct,
492 lambda: *const ca_vec_struct,
493 num_blocks: slong,
494 block_lambda: *mut slong,
495 block_size: *mut slong,
496 ctx: *mut ca_ctx_struct,
497 );
498 pub fn ca_mat_jordan_blocks(
499 lambda: *mut ca_vec_struct,
500 num_blocks: *mut slong,
501 block_lambda: *mut slong,
502 block_size: *mut slong,
503 A: *const ca_mat_struct,
504 ctx: *mut ca_ctx_struct,
505 ) -> libc::c_int;
506 pub fn ca_mat_jordan_transformation(
507 mat: *mut ca_mat_struct,
508 lambda: *const ca_vec_struct,
509 num_blocks: slong,
510 block_lambda: *mut slong,
511 block_size: *mut slong,
512 A: *const ca_mat_struct,
513 ctx: *mut ca_ctx_struct,
514 ) -> libc::c_int;
515 pub fn ca_mat_jordan_form(
516 J: *mut ca_mat_struct,
517 P: *mut ca_mat_struct,
518 A: *const ca_mat_struct,
519 ctx: *mut ca_ctx_struct,
520 ) -> libc::c_int;
521 pub fn ca_mat_exp(
522 res: *mut ca_mat_struct,
523 A: *const ca_mat_struct,
524 ctx: *mut ca_ctx_struct,
525 ) -> libc::c_int;
526 pub fn ca_mat_log(
527 res: *mut ca_mat_struct,
528 A: *const ca_mat_struct,
529 ctx: *mut ca_ctx_struct,
530 ) -> truth_t;
531 pub fn _ca_mat_same_field(A: *const ca_mat_struct, ctx: *mut ca_ctx_struct) -> ca_field_ptr;
532 pub fn _ca_mat_same_field2(
533 A: *const ca_mat_struct,
534 B: *const ca_mat_struct,
535 ctx: *mut ca_ctx_struct,
536 ) -> ca_field_ptr;
537}