1use crate::deps::*;
4use crate::flint::*;
5use crate::gr_types::*;
6use crate::mpoly_types::*;
7
8
9#[repr(C)]
10pub struct gr_mpoly_struct {
11 pub coeffs: gr_ptr,
12 pub exps: *mut ulong,
13 pub length: slong,
14 pub bits: flint_bitcnt_t,
15 pub coeffs_alloc: slong,
16 pub exps_alloc: slong,
17}
18#[allow(clippy::unnecessary_operation, clippy::identity_op)]
19const _: () = {
20 ["Size of gr_mpoly_struct"][::std::mem::size_of::<gr_mpoly_struct>() - 48usize];
21 ["Alignment of gr_mpoly_struct"][::std::mem::align_of::<gr_mpoly_struct>() - 8usize];
22 ["Offset of field: gr_mpoly_struct::coeffs"]
23 [::std::mem::offset_of!(gr_mpoly_struct, coeffs) - 0usize];
24 ["Offset of field: gr_mpoly_struct::exps"]
25 [::std::mem::offset_of!(gr_mpoly_struct, exps) - 8usize];
26 ["Offset of field: gr_mpoly_struct::length"]
27 [::std::mem::offset_of!(gr_mpoly_struct, length) - 16usize];
28 ["Offset of field: gr_mpoly_struct::bits"]
29 [::std::mem::offset_of!(gr_mpoly_struct, bits) - 24usize];
30 ["Offset of field: gr_mpoly_struct::coeffs_alloc"]
31 [::std::mem::offset_of!(gr_mpoly_struct, coeffs_alloc) - 32usize];
32 ["Offset of field: gr_mpoly_struct::exps_alloc"]
33 [::std::mem::offset_of!(gr_mpoly_struct, exps_alloc) - 40usize];
34};
35impl Default for gr_mpoly_struct {
36 fn default() -> Self {
37 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
38 unsafe {
39 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
40 s.assume_init()
41 }
42 }
43}
44pub type gr_mpoly_t = [gr_mpoly_struct; 1usize];
45#[repr(C)]
46#[derive(Debug, Copy, Clone)]
47pub struct _gr_mpoly_ctx_struct {
48 pub cctx: *mut gr_ctx_struct,
49 pub mctx: *mut mpoly_ctx_struct,
50 pub vars: *mut *mut libc::c_char,
51}
52#[allow(clippy::unnecessary_operation, clippy::identity_op)]
53const _: () = {
54 ["Size of _gr_mpoly_ctx_struct"][::std::mem::size_of::<_gr_mpoly_ctx_struct>() - 24usize];
55 ["Alignment of _gr_mpoly_ctx_struct"][::std::mem::align_of::<_gr_mpoly_ctx_struct>() - 8usize];
56 ["Offset of field: _gr_mpoly_ctx_struct::cctx"]
57 [::std::mem::offset_of!(_gr_mpoly_ctx_struct, cctx) - 0usize];
58 ["Offset of field: _gr_mpoly_ctx_struct::mctx"]
59 [::std::mem::offset_of!(_gr_mpoly_ctx_struct, mctx) - 8usize];
60 ["Offset of field: _gr_mpoly_ctx_struct::vars"]
61 [::std::mem::offset_of!(_gr_mpoly_ctx_struct, vars) - 16usize];
62};
63impl Default for _gr_mpoly_ctx_struct {
64 fn default() -> Self {
65 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
66 unsafe {
67 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
68 s.assume_init()
69 }
70 }
71}
72pub type gr_mpoly_ctx_struct = gr_ctx_struct;
73pub type gr_mpoly_ctx_t = [gr_mpoly_ctx_struct; 1usize];
74extern "C" {
75 pub fn gr_mpoly_ctx_init_rand(
76 ctx: *mut gr_mpoly_ctx_struct,
77 state: *mut flint_rand_struct,
78 base_ring: *mut gr_ctx_struct,
79 max_nvars: slong,
80 );
81 pub fn gr_mpoly_ctx_clear(ctx: *mut gr_mpoly_ctx_struct);
82 pub fn gr_mpoly_ctx_init(
83 ctx: *mut gr_mpoly_ctx_struct,
84 base_ring: *mut gr_ctx_struct,
85 nvars: slong,
86 ord: ordering_t,
87 );
88 pub fn gr_mpoly_ctx_set_gen_names(
89 ctx: *mut gr_mpoly_ctx_struct,
90 s: *mut *const libc::c_char,
91 ) -> libc::c_int;
92 pub fn gr_mpoly_gens(res: *mut gr_vec_struct, ctx: *mut gr_mpoly_ctx_struct) -> libc::c_int;
93 pub fn gr_mpoly_gens_recursive(
94 vec: *mut gr_vec_struct,
95 ctx: *mut gr_mpoly_ctx_struct,
96 ) -> libc::c_int;
97 pub fn gr_mpoly_ctx_write(
98 out: *mut gr_stream_struct,
99 ctx: *mut gr_mpoly_ctx_struct,
100 ) -> libc::c_int;
101 pub fn gr_mpoly_ctx_is_ring(ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
102 pub fn gr_mpoly_ctx_is_zero_ring(ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
103 pub fn gr_mpoly_ctx_is_commutative_ring(ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
104 pub fn gr_mpoly_ctx_is_integral_domain(ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
105 pub fn gr_mpoly_ctx_is_field(ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
106 pub fn gr_mpoly_ctx_is_threadsafe(ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
107 #[link_name = "gr_mpoly_init__extern"]
108 pub fn gr_mpoly_init(A: *mut gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct);
109 pub fn gr_mpoly_init3(
110 A: *mut gr_mpoly_struct,
111 alloc: slong,
112 bits: flint_bitcnt_t,
113 ctx: *mut gr_mpoly_ctx_struct,
114 );
115 pub fn gr_mpoly_init2(A: *mut gr_mpoly_struct, alloc: slong, ctx: *mut gr_mpoly_ctx_struct);
116 #[link_name = "gr_mpoly_clear__extern"]
117 pub fn gr_mpoly_clear(A: *mut gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct);
118 pub fn _gr_mpoly_fit_length(
119 coeffs: *mut gr_ptr,
120 coeffs_alloc: *mut slong,
121 exps: *mut *mut ulong,
122 exps_alloc: *mut slong,
123 N: slong,
124 length: slong,
125 cctx: *mut gr_ctx_struct,
126 );
127 pub fn gr_mpoly_fit_length(A: *mut gr_mpoly_struct, len: slong, ctx: *mut gr_mpoly_ctx_struct);
128 pub fn gr_mpoly_fit_bits(
129 A: *mut gr_mpoly_struct,
130 bits: flint_bitcnt_t,
131 ctx: *mut gr_mpoly_ctx_struct,
132 );
133 pub fn gr_mpoly_fit_length_fit_bits(
134 A: *mut gr_mpoly_struct,
135 len: slong,
136 bits: flint_bitcnt_t,
137 ctx: *mut gr_mpoly_ctx_struct,
138 );
139 pub fn gr_mpoly_fit_length_reset_bits(
140 A: *mut gr_mpoly_struct,
141 len: slong,
142 bits: flint_bitcnt_t,
143 ctx: *mut gr_mpoly_ctx_struct,
144 );
145 #[link_name = "_gr_mpoly_set_length__extern"]
146 pub fn _gr_mpoly_set_length(
147 A: *mut gr_mpoly_struct,
148 newlen: slong,
149 ctx: *mut gr_mpoly_ctx_struct,
150 );
151 #[link_name = "gr_mpoly_length__extern"]
152 pub fn gr_mpoly_length(x: *const gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct) -> slong;
153 pub fn _gr_mpoly_normalise(A: *mut gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct);
154 #[link_name = "gr_mpoly_swap__extern"]
155 pub fn gr_mpoly_swap(
156 A: *mut gr_mpoly_struct,
157 B: *mut gr_mpoly_struct,
158 ctx: *mut gr_mpoly_ctx_struct,
159 );
160 #[link_name = "gr_mpoly_set_shallow__extern"]
161 pub fn gr_mpoly_set_shallow(
162 res: *mut gr_mpoly_struct,
163 poly: *const gr_mpoly_struct,
164 ctx: *mut gr_mpoly_ctx_struct,
165 );
166 pub fn gr_mpoly_set(
167 A: *mut gr_mpoly_struct,
168 B: *const gr_mpoly_struct,
169 ctx: *mut gr_mpoly_ctx_struct,
170 ) -> libc::c_int;
171 #[link_name = "gr_mpoly_zero__extern"]
172 pub fn gr_mpoly_zero(A: *mut gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct) -> libc::c_int;
173 pub fn gr_mpoly_is_zero(A: *const gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
174 pub fn gr_mpoly_gen(
175 A: *mut gr_mpoly_struct,
176 var: slong,
177 ctx: *mut gr_mpoly_ctx_struct,
178 ) -> libc::c_int;
179 pub fn gr_mpoly_is_gen(
180 A: *const gr_mpoly_struct,
181 var: slong,
182 ctx: *mut gr_mpoly_ctx_struct,
183 ) -> truth_t;
184 pub fn gr_mpoly_equal(
185 A: *const gr_mpoly_struct,
186 B: *const gr_mpoly_struct,
187 ctx: *mut gr_mpoly_ctx_struct,
188 ) -> truth_t;
189 pub fn _gr_mpoly_push_exp_ui(
190 A: *mut gr_mpoly_struct,
191 exp: *const ulong,
192 ctx: *mut gr_mpoly_ctx_struct,
193 );
194 pub fn gr_mpoly_push_term_scalar_ui(
195 A: *mut gr_mpoly_struct,
196 c: gr_srcptr,
197 exp: *const ulong,
198 ctx: *mut gr_mpoly_ctx_struct,
199 ) -> libc::c_int;
200 pub fn _gr_mpoly_push_exp_fmpz(
201 A: *mut gr_mpoly_struct,
202 exp: *const fmpz,
203 ctx: *mut gr_mpoly_ctx_struct,
204 );
205 pub fn gr_mpoly_push_term_scalar_fmpz(
206 A: *mut gr_mpoly_struct,
207 c: gr_srcptr,
208 exp: *const fmpz,
209 ctx: *mut gr_mpoly_ctx_struct,
210 ) -> libc::c_int;
211 pub fn gr_mpoly_sort_terms(A: *mut gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct);
212 pub fn gr_mpoly_combine_like_terms(
213 A: *mut gr_mpoly_struct,
214 ctx: *mut gr_mpoly_ctx_struct,
215 ) -> libc::c_int;
216 pub fn gr_mpoly_is_canonical(
217 A: *const gr_mpoly_struct,
218 ctx: *mut gr_mpoly_ctx_struct,
219 ) -> truth_t;
220 pub fn gr_mpoly_assert_canonical(A: *const gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct);
221 pub fn gr_mpoly_randtest_bits(
222 A: *mut gr_mpoly_struct,
223 state: *mut flint_rand_struct,
224 length: slong,
225 exp_bits: flint_bitcnt_t,
226 ctx: *mut gr_mpoly_ctx_struct,
227 ) -> libc::c_int;
228 pub fn gr_mpoly_randtest_bound(
229 A: *mut gr_mpoly_struct,
230 state: *mut flint_rand_struct,
231 length: slong,
232 exp_bound: ulong,
233 ctx: *mut gr_mpoly_ctx_struct,
234 ) -> libc::c_int;
235 #[link_name = "_gr_mpoly_randtest_default__extern"]
236 pub fn _gr_mpoly_randtest_default(
237 res: *mut gr_mpoly_struct,
238 state: *mut flint_rand_struct,
239 ctx: *mut gr_mpoly_ctx_struct,
240 ) -> libc::c_int;
241 pub fn gr_mpoly_write_pretty(
242 out: *mut gr_stream_struct,
243 A: *const gr_mpoly_struct,
244 ctx: *mut gr_mpoly_ctx_struct,
245 ) -> libc::c_int;
246 pub fn gr_mpoly_write(
247 out: *mut gr_stream_struct,
248 poly: *mut gr_mpoly_struct,
249 ctx: *mut gr_mpoly_ctx_struct,
250 ) -> libc::c_int;
251 pub fn gr_mpoly_print_pretty(
252 A: *const gr_mpoly_struct,
253 ctx: *mut gr_mpoly_ctx_struct,
254 ) -> libc::c_int;
255 pub fn gr_mpoly_set_other(
256 res: *mut gr_mpoly_struct,
257 A: gr_srcptr,
258 A_ctx: *mut gr_ctx_struct,
259 ctx: *mut gr_mpoly_ctx_struct,
260 ) -> libc::c_int;
261 pub fn gr_mpoly_set_scalar(
262 A: *mut gr_mpoly_struct,
263 c: gr_srcptr,
264 ctx: *mut gr_mpoly_ctx_struct,
265 ) -> libc::c_int;
266 pub fn gr_mpoly_set_ui(
267 A: *mut gr_mpoly_struct,
268 c: ulong,
269 ctx: *mut gr_mpoly_ctx_struct,
270 ) -> libc::c_int;
271 pub fn gr_mpoly_set_si(
272 A: *mut gr_mpoly_struct,
273 c: slong,
274 ctx: *mut gr_mpoly_ctx_struct,
275 ) -> libc::c_int;
276 pub fn gr_mpoly_set_fmpz(
277 A: *mut gr_mpoly_struct,
278 c: *const fmpz,
279 ctx: *mut gr_mpoly_ctx_struct,
280 ) -> libc::c_int;
281 pub fn gr_mpoly_set_fmpq(
282 A: *mut gr_mpoly_struct,
283 c: *const fmpq,
284 ctx: *mut gr_mpoly_ctx_struct,
285 ) -> libc::c_int;
286 #[link_name = "gr_mpoly_one__extern"]
287 pub fn gr_mpoly_one(A: *mut gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct) -> libc::c_int;
288 pub fn gr_mpoly_is_one(A: *const gr_mpoly_struct, ctx: *mut gr_mpoly_ctx_struct) -> truth_t;
289 pub fn gr_mpoly_get_coeff_scalar_fmpz(
290 c: gr_ptr,
291 A: *const gr_mpoly_struct,
292 exp: *const fmpz,
293 ctx: *mut gr_mpoly_ctx_struct,
294 ) -> libc::c_int;
295 pub fn gr_mpoly_get_coeff_scalar_ui(
296 c: gr_ptr,
297 A: *const gr_mpoly_struct,
298 exp: *const ulong,
299 ctx: *mut gr_mpoly_ctx_struct,
300 ) -> libc::c_int;
301 pub fn gr_mpoly_set_coeff_scalar_fmpz(
302 A: *mut gr_mpoly_struct,
303 c: gr_srcptr,
304 exp: *const fmpz,
305 ctx: *mut gr_mpoly_ctx_struct,
306 ) -> libc::c_int;
307 pub fn gr_mpoly_set_coeff_ui_fmpz(
308 A: *mut gr_mpoly_struct,
309 c: ulong,
310 exp: *const fmpz,
311 ctx: *mut gr_mpoly_ctx_struct,
312 ) -> libc::c_int;
313 pub fn gr_mpoly_set_coeff_si_fmpz(
314 A: *mut gr_mpoly_struct,
315 c: slong,
316 exp: *const fmpz,
317 ctx: *mut gr_mpoly_ctx_struct,
318 ) -> libc::c_int;
319 pub fn gr_mpoly_set_coeff_fmpz_fmpz(
320 A: *mut gr_mpoly_struct,
321 c: *const fmpz,
322 exp: *const fmpz,
323 ctx: *mut gr_mpoly_ctx_struct,
324 ) -> libc::c_int;
325 pub fn gr_mpoly_set_coeff_fmpq_fmpz(
326 A: *mut gr_mpoly_struct,
327 c: *const fmpq,
328 exp: *const fmpz,
329 ctx: *mut gr_mpoly_ctx_struct,
330 ) -> libc::c_int;
331 pub fn gr_mpoly_set_coeff_scalar_ui(
332 poly: *mut gr_mpoly_struct,
333 c: gr_srcptr,
334 exp: *const ulong,
335 ctx: *mut gr_mpoly_ctx_struct,
336 ) -> libc::c_int;
337 pub fn gr_mpoly_set_coeff_ui_ui(
338 A: *mut gr_mpoly_struct,
339 c: ulong,
340 exp: *const ulong,
341 ctx: *mut gr_mpoly_ctx_struct,
342 ) -> libc::c_int;
343 pub fn gr_mpoly_set_coeff_si_ui(
344 A: *mut gr_mpoly_struct,
345 c: slong,
346 exp: *const ulong,
347 ctx: *mut gr_mpoly_ctx_struct,
348 ) -> libc::c_int;
349 pub fn gr_mpoly_set_coeff_fmpz_ui(
350 A: *mut gr_mpoly_struct,
351 c: *const fmpz,
352 exp: *const ulong,
353 ctx: *mut gr_mpoly_ctx_struct,
354 ) -> libc::c_int;
355 pub fn gr_mpoly_set_coeff_fmpq_ui(
356 A: *mut gr_mpoly_struct,
357 c: *const fmpq,
358 exp: *const ulong,
359 ctx: *mut gr_mpoly_ctx_struct,
360 ) -> libc::c_int;
361 pub fn gr_mpoly_neg(
362 A: *mut gr_mpoly_struct,
363 B: *const gr_mpoly_struct,
364 ctx: *mut gr_mpoly_ctx_struct,
365 ) -> libc::c_int;
366 pub fn gr_mpoly_add(
367 A: *mut gr_mpoly_struct,
368 B: *const gr_mpoly_struct,
369 C: *const gr_mpoly_struct,
370 ctx: *mut gr_mpoly_ctx_struct,
371 ) -> libc::c_int;
372 pub fn gr_mpoly_sub(
373 A: *mut gr_mpoly_struct,
374 B: *const gr_mpoly_struct,
375 C: *const gr_mpoly_struct,
376 ctx: *mut gr_mpoly_ctx_struct,
377 ) -> libc::c_int;
378 pub fn gr_mpoly_mul(
379 poly1: *mut gr_mpoly_struct,
380 poly2: *const gr_mpoly_struct,
381 poly3: *const gr_mpoly_struct,
382 ctx: *mut gr_mpoly_ctx_struct,
383 ) -> libc::c_int;
384 pub fn gr_mpoly_mul_johnson(
385 poly1: *mut gr_mpoly_struct,
386 poly2: *const gr_mpoly_struct,
387 poly3: *const gr_mpoly_struct,
388 ctx: *mut gr_mpoly_ctx_struct,
389 ) -> libc::c_int;
390 pub fn gr_mpoly_mul_monomial(
391 A: *mut gr_mpoly_struct,
392 B: *const gr_mpoly_struct,
393 C: *const gr_mpoly_struct,
394 ctx: *mut gr_mpoly_ctx_struct,
395 ) -> libc::c_int;
396 pub fn gr_mpoly_mul_scalar(
397 A: *mut gr_mpoly_struct,
398 B: *const gr_mpoly_struct,
399 c: gr_srcptr,
400 ctx: *mut gr_mpoly_ctx_struct,
401 ) -> libc::c_int;
402 pub fn gr_mpoly_mul_si(
403 A: *mut gr_mpoly_struct,
404 B: *const gr_mpoly_struct,
405 c: slong,
406 ctx: *mut gr_mpoly_ctx_struct,
407 ) -> libc::c_int;
408 pub fn gr_mpoly_mul_ui(
409 A: *mut gr_mpoly_struct,
410 B: *const gr_mpoly_struct,
411 c: ulong,
412 ctx: *mut gr_mpoly_ctx_struct,
413 ) -> libc::c_int;
414 pub fn gr_mpoly_mul_fmpz(
415 A: *mut gr_mpoly_struct,
416 B: *const gr_mpoly_struct,
417 c: *const fmpz,
418 ctx: *mut gr_mpoly_ctx_struct,
419 ) -> libc::c_int;
420 pub fn gr_mpoly_mul_fmpq(
421 A: *mut gr_mpoly_struct,
422 B: *const gr_mpoly_struct,
423 c: *const fmpq,
424 ctx: *mut gr_mpoly_ctx_struct,
425 ) -> libc::c_int;
426 pub fn gr_mpoly_inv(
427 res: *mut gr_mpoly_struct,
428 poly: *const gr_mpoly_struct,
429 ctx: *mut gr_mpoly_ctx_struct,
430 ) -> libc::c_int;
431 pub fn gr_mpoly_canonical_associate(
432 res: *mut gr_mpoly_struct,
433 u: *mut gr_mpoly_struct,
434 poly: *const gr_mpoly_struct,
435 ctx: *mut gr_mpoly_ctx_struct,
436 ) -> libc::c_int;
437 pub fn gr_mpoly_derivative(
438 A: *mut gr_mpoly_struct,
439 B: *const gr_mpoly_struct,
440 var: slong,
441 ctx: *mut gr_mpoly_ctx_struct,
442 ) -> libc::c_int;
443 pub fn gr_mpoly_integral(
444 A: *mut gr_mpoly_struct,
445 B: *const gr_mpoly_struct,
446 var: slong,
447 ctx: *mut gr_mpoly_ctx_struct,
448 ) -> libc::c_int;
449}