1use crate::deps::*;
4use crate::acb_types::*;
5use crate::arb_types::*;
6use crate::flint::*;
7use crate::fmpq_types::*;
8use crate::fmpz_types::*;
9use crate::mpoly_types::*;
10
11
12pub const QQBAR_DEFAULT_PREC: u32 = 128;
13pub const QQBAR_ROOTS_IRREDUCIBLE: u32 = 1;
14pub const QQBAR_ROOTS_UNSORTED: u32 = 2;
15#[repr(C)]
16pub struct qqbar_struct {
17 pub poly: fmpz_poly_struct,
18 pub enclosure: acb_struct,
19}
20#[allow(clippy::unnecessary_operation, clippy::identity_op)]
21const _: () = {
22 ["Size of qqbar_struct"][::std::mem::size_of::<qqbar_struct>() - 120usize];
23 ["Alignment of qqbar_struct"][::std::mem::align_of::<qqbar_struct>() - 8usize];
24 ["Offset of field: qqbar_struct::poly"][::std::mem::offset_of!(qqbar_struct, poly) - 0usize];
25 ["Offset of field: qqbar_struct::enclosure"]
26 [::std::mem::offset_of!(qqbar_struct, enclosure) - 24usize];
27};
28impl Default for qqbar_struct {
29 fn default() -> Self {
30 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
31 unsafe {
32 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
33 s.assume_init()
34 }
35 }
36}
37pub type qqbar_t = [qqbar_struct; 1usize];
38pub type qqbar_ptr = *mut qqbar_struct;
39pub type qqbar_srcptr = *const qqbar_struct;
40extern "C" {
41 pub fn qqbar_init(res: *mut qqbar_struct);
42 pub fn qqbar_clear(res: *mut qqbar_struct);
43 #[link_name = "_qqbar_vec_init__extern"]
44 pub fn _qqbar_vec_init(len: slong) -> qqbar_ptr;
45 #[link_name = "_qqbar_vec_clear__extern"]
46 pub fn _qqbar_vec_clear(vec: qqbar_ptr, len: slong);
47 pub fn qqbar_swap(x: *mut qqbar_struct, y: *mut qqbar_struct);
48 pub fn qqbar_set(res: *mut qqbar_struct, x: *const qqbar_struct);
49 pub fn qqbar_set_si(res: *mut qqbar_struct, x: slong);
50 pub fn qqbar_set_ui(res: *mut qqbar_struct, x: ulong);
51 pub fn qqbar_set_fmpz(res: *mut qqbar_struct, x: *const fmpz);
52 pub fn qqbar_set_fmpq(res: *mut qqbar_struct, x: *const fmpq);
53 pub fn qqbar_set_re_im(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const qqbar_struct);
54 pub fn qqbar_set_d(res: *mut qqbar_struct, x: f64) -> libc::c_int;
55 pub fn qqbar_set_re_im_d(res: *mut qqbar_struct, x: f64, y: f64) -> libc::c_int;
56 #[link_name = "qqbar_degree__extern"]
57 pub fn qqbar_degree(x: *const qqbar_struct) -> slong;
58 #[link_name = "qqbar_is_rational__extern"]
59 pub fn qqbar_is_rational(x: *const qqbar_struct) -> libc::c_int;
60 #[link_name = "qqbar_is_integer__extern"]
61 pub fn qqbar_is_integer(x: *const qqbar_struct) -> libc::c_int;
62 #[link_name = "qqbar_is_algebraic_integer__extern"]
63 pub fn qqbar_is_algebraic_integer(x: *const qqbar_struct) -> libc::c_int;
64 #[link_name = "qqbar_is_zero__extern"]
65 pub fn qqbar_is_zero(x: *const qqbar_struct) -> libc::c_int;
66 #[link_name = "qqbar_is_one__extern"]
67 pub fn qqbar_is_one(x: *const qqbar_struct) -> libc::c_int;
68 #[link_name = "qqbar_is_neg_one__extern"]
69 pub fn qqbar_is_neg_one(x: *const qqbar_struct) -> libc::c_int;
70 #[link_name = "qqbar_is_i__extern"]
71 pub fn qqbar_is_i(x: *const qqbar_struct) -> libc::c_int;
72 #[link_name = "qqbar_is_neg_i__extern"]
73 pub fn qqbar_is_neg_i(x: *const qqbar_struct) -> libc::c_int;
74 pub fn qqbar_sgn_re(x: *const qqbar_struct) -> libc::c_int;
75 pub fn qqbar_sgn_im(x: *const qqbar_struct) -> libc::c_int;
76 #[link_name = "qqbar_is_real__extern"]
77 pub fn qqbar_is_real(x: *const qqbar_struct) -> libc::c_int;
78 pub fn qqbar_height_bits(x: *const qqbar_struct) -> slong;
79 pub fn qqbar_height(res: *mut fmpz, x: *const qqbar_struct);
80 #[link_name = "qqbar_within_limits__extern"]
81 pub fn qqbar_within_limits(
82 x: *const qqbar_struct,
83 deg_limit: slong,
84 bits_limit: slong,
85 ) -> libc::c_int;
86 #[link_name = "qqbar_binop_within_limits__extern"]
87 pub fn qqbar_binop_within_limits(
88 x: *const qqbar_struct,
89 y: *const qqbar_struct,
90 deg_limit: slong,
91 bits_limit: slong,
92 ) -> libc::c_int;
93 pub fn _qqbar_get_fmpq(num: *mut fmpz, den: *mut fmpz, x: *const qqbar_struct);
94 pub fn qqbar_get_fmpq(res: *mut fmpq, x: *const qqbar_struct);
95 pub fn qqbar_get_fmpz(res: *mut fmpz, x: *const qqbar_struct);
96 #[link_name = "qqbar_zero__extern"]
97 pub fn qqbar_zero(res: *mut qqbar_struct);
98 #[link_name = "qqbar_one__extern"]
99 pub fn qqbar_one(res: *mut qqbar_struct);
100 pub fn qqbar_i(res: *mut qqbar_struct);
101 pub fn qqbar_phi(res: *mut qqbar_struct);
102 pub fn qqbar_randtest(
103 res: *mut qqbar_struct,
104 state: *mut flint_rand_struct,
105 deg: slong,
106 bits: slong,
107 );
108 pub fn qqbar_randtest_real(
109 res: *mut qqbar_struct,
110 state: *mut flint_rand_struct,
111 deg: slong,
112 bits: slong,
113 );
114 pub fn qqbar_randtest_nonreal(
115 res: *mut qqbar_struct,
116 state: *mut flint_rand_struct,
117 deg: slong,
118 bits: slong,
119 );
120 pub fn qqbar_print(x: *const qqbar_struct);
121 pub fn qqbar_printn(x: *const qqbar_struct, n: slong);
122 pub fn qqbar_printnd(x: *const qqbar_struct, n: slong);
123 pub fn qqbar_get_str_nd(x: *const qqbar_struct, n: slong) -> *mut libc::c_char;
124 pub fn qqbar_equal(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
125 pub fn qqbar_equal_fmpq_poly_val(
126 x: *const qqbar_struct,
127 f: *const fmpq_poly_struct,
128 y: *const qqbar_struct,
129 ) -> libc::c_int;
130 pub fn qqbar_cmp_re(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
131 pub fn qqbar_cmp_im(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
132 pub fn qqbar_cmpabs_re(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
133 pub fn qqbar_cmpabs_im(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
134 pub fn qqbar_cmpabs(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
135 pub fn qqbar_cmp_root_order(x: *const qqbar_struct, y: *const qqbar_struct) -> libc::c_int;
136 pub fn qqbar_hash(x: *const qqbar_struct) -> ulong;
137 pub fn qqbar_conj(res: *mut qqbar_struct, x: *const qqbar_struct);
138 pub fn qqbar_re(res: *mut qqbar_struct, x: *const qqbar_struct);
139 pub fn qqbar_im(res: *mut qqbar_struct, x: *const qqbar_struct);
140 pub fn qqbar_re_im(res1: *mut qqbar_struct, res2: *mut qqbar_struct, x: *const qqbar_struct);
141 pub fn qqbar_abs(res: *mut qqbar_struct, x: *const qqbar_struct);
142 pub fn qqbar_abs2(res: *mut qqbar_struct, x: *const qqbar_struct);
143 pub fn qqbar_sgn(res: *mut qqbar_struct, x: *const qqbar_struct);
144 pub fn qqbar_csgn(x: *const qqbar_struct) -> libc::c_int;
145 pub fn qqbar_floor(res: *mut fmpz, x: *const qqbar_struct);
146 pub fn qqbar_ceil(res: *mut fmpz, x: *const qqbar_struct);
147 pub fn qqbar_numerator(res: *mut qqbar_struct, y: *const qqbar_struct);
148 pub fn qqbar_denominator(res: *mut fmpz, y: *const qqbar_struct);
149 pub fn qqbar_neg(res: *mut qqbar_struct, x: *const qqbar_struct);
150 pub fn qqbar_add(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const qqbar_struct);
151 pub fn qqbar_add_fmpq(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpq);
152 pub fn qqbar_add_fmpz(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpz);
153 pub fn qqbar_add_ui(res: *mut qqbar_struct, x: *const qqbar_struct, y: ulong);
154 pub fn qqbar_add_si(res: *mut qqbar_struct, x: *const qqbar_struct, y: slong);
155 pub fn qqbar_sub(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const qqbar_struct);
156 pub fn qqbar_sub_fmpq(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpq);
157 pub fn qqbar_sub_fmpz(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpz);
158 pub fn qqbar_sub_ui(res: *mut qqbar_struct, x: *const qqbar_struct, y: ulong);
159 pub fn qqbar_sub_si(res: *mut qqbar_struct, x: *const qqbar_struct, y: slong);
160 pub fn qqbar_fmpq_sub(res: *mut qqbar_struct, x: *const fmpq, y: *const qqbar_struct);
161 pub fn qqbar_fmpz_sub(res: *mut qqbar_struct, x: *const fmpz, y: *const qqbar_struct);
162 pub fn qqbar_ui_sub(res: *mut qqbar_struct, x: ulong, y: *const qqbar_struct);
163 pub fn qqbar_si_sub(res: *mut qqbar_struct, x: slong, y: *const qqbar_struct);
164 pub fn qqbar_mul(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const qqbar_struct);
165 pub fn qqbar_mul_fmpq(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpq);
166 pub fn qqbar_mul_fmpz(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpz);
167 pub fn qqbar_mul_ui(res: *mut qqbar_struct, x: *const qqbar_struct, y: ulong);
168 pub fn qqbar_mul_si(res: *mut qqbar_struct, x: *const qqbar_struct, y: slong);
169 pub fn qqbar_div(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const qqbar_struct);
170 pub fn qqbar_div_fmpq(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpq);
171 pub fn qqbar_div_fmpz(res: *mut qqbar_struct, x: *const qqbar_struct, y: *const fmpz);
172 pub fn qqbar_div_ui(res: *mut qqbar_struct, x: *const qqbar_struct, y: ulong);
173 pub fn qqbar_div_si(res: *mut qqbar_struct, x: *const qqbar_struct, y: slong);
174 pub fn qqbar_fmpq_div(res: *mut qqbar_struct, x: *const fmpq, y: *const qqbar_struct);
175 pub fn qqbar_fmpz_div(res: *mut qqbar_struct, x: *const fmpz, y: *const qqbar_struct);
176 pub fn qqbar_ui_div(res: *mut qqbar_struct, x: ulong, y: *const qqbar_struct);
177 pub fn qqbar_si_div(res: *mut qqbar_struct, x: slong, y: *const qqbar_struct);
178 #[link_name = "qqbar_sqr__extern"]
179 pub fn qqbar_sqr(res: *mut qqbar_struct, x: *const qqbar_struct);
180 pub fn qqbar_inv(res: *mut qqbar_struct, x: *const qqbar_struct);
181 pub fn qqbar_mul_2exp_si(res: *mut qqbar_struct, x: *const qqbar_struct, exp: slong);
182 pub fn qqbar_pow_ui(res: *mut qqbar_struct, x: *const qqbar_struct, e: ulong);
183 pub fn qqbar_pow_si(res: *mut qqbar_struct, x: *const qqbar_struct, n: slong);
184 pub fn qqbar_pow_fmpz(res: *mut qqbar_struct, x: *const qqbar_struct, n: *const fmpz);
185 pub fn qqbar_pow_fmpq(res: *mut qqbar_struct, x: *const qqbar_struct, n: *const fmpq);
186 pub fn qqbar_pow(
187 res: *mut qqbar_struct,
188 x: *const qqbar_struct,
189 e: *const qqbar_struct,
190 ) -> libc::c_int;
191 pub fn _qqbar_fast_detect_simple_principal_surd(x: *const qqbar_struct) -> libc::c_int;
192 pub fn qqbar_root_ui(res: *mut qqbar_struct, x: *const qqbar_struct, n: ulong);
193 #[link_name = "qqbar_sqrt__extern"]
194 pub fn qqbar_sqrt(res: *mut qqbar_struct, x: *const qqbar_struct);
195 #[link_name = "qqbar_sqrt_ui__extern"]
196 pub fn qqbar_sqrt_ui(res: *mut qqbar_struct, x: ulong);
197 #[link_name = "qqbar_rsqrt__extern"]
198 pub fn qqbar_rsqrt(res: *mut qqbar_struct, x: *const qqbar_struct);
199 pub fn qqbar_fmpq_root_ui(res: *mut qqbar_struct, x: *const fmpq, b: ulong);
200 pub fn qqbar_fmpq_pow_si_ui(res: *mut qqbar_struct, x: *const fmpq, a: slong, b: ulong);
201 pub fn qqbar_cache_enclosure(res: *mut qqbar_struct, prec: slong);
202 pub fn qqbar_get_arb(res: *mut arb_struct, x: *const qqbar_struct, prec: slong);
203 pub fn qqbar_get_acb(res: *mut acb_struct, x: *const qqbar_struct, prec: slong);
204 pub fn qqbar_get_arb_re(res: *mut arb_struct, x: *const qqbar_struct, prec: slong);
205 pub fn qqbar_get_arb_im(res: *mut arb_struct, x: *const qqbar_struct, prec: slong);
206 pub fn qqbar_conjugates(res: qqbar_ptr, x: *const qqbar_struct);
207 pub fn _qqbar_evaluate_fmpq_poly(
208 res: *mut qqbar_struct,
209 poly: *const fmpz,
210 den: *const fmpz,
211 len: slong,
212 x: *const qqbar_struct,
213 );
214 pub fn qqbar_evaluate_fmpq_poly(
215 res: *mut qqbar_struct,
216 poly: *const fmpq_poly_struct,
217 x: *const qqbar_struct,
218 );
219 pub fn _qqbar_evaluate_fmpz_poly(
220 res: *mut qqbar_struct,
221 poly: *const fmpz,
222 len: slong,
223 x: *const qqbar_struct,
224 );
225 pub fn qqbar_evaluate_fmpz_poly(
226 res: *mut qqbar_struct,
227 poly: *const fmpz_poly_struct,
228 x: *const qqbar_struct,
229 );
230 pub fn qqbar_evaluate_fmpz_mpoly_iter(
231 res: *mut qqbar_struct,
232 f: *const fmpz_mpoly_struct,
233 x: qqbar_srcptr,
234 deg_limit: slong,
235 bits_limit: slong,
236 ctx: *const fmpz_mpoly_ctx_struct,
237 ) -> libc::c_int;
238 pub fn qqbar_evaluate_fmpz_mpoly_horner(
239 res: *mut qqbar_struct,
240 f: *const fmpz_mpoly_struct,
241 x: qqbar_srcptr,
242 deg_limit: slong,
243 bits_limit: slong,
244 ctx: *const fmpz_mpoly_ctx_struct,
245 ) -> libc::c_int;
246 pub fn qqbar_evaluate_fmpz_mpoly(
247 res: *mut qqbar_struct,
248 f: *const fmpz_mpoly_struct,
249 x: qqbar_srcptr,
250 deg_limit: slong,
251 bits_limit: slong,
252 ctx: *const fmpz_mpoly_ctx_struct,
253 ) -> libc::c_int;
254 pub fn qqbar_roots_fmpz_poly(res: qqbar_ptr, poly: *const fmpz_poly_struct, flags: libc::c_int);
255 pub fn qqbar_roots_fmpq_poly(res: qqbar_ptr, poly: *const fmpq_poly_struct, flags: libc::c_int);
256 pub fn _qqbar_roots_poly_squarefree(
257 roots: qqbar_ptr,
258 coeffs: qqbar_srcptr,
259 len: slong,
260 deg_limit: slong,
261 bits_limit: slong,
262 ) -> libc::c_int;
263 pub fn qqbar_eigenvalues_fmpz_mat(
264 res: qqbar_ptr,
265 mat: *const fmpz_mat_struct,
266 flags: libc::c_int,
267 );
268 pub fn qqbar_eigenvalues_fmpq_mat(
269 res: qqbar_ptr,
270 mat: *const fmpq_mat_struct,
271 flags: libc::c_int,
272 );
273 pub fn qqbar_root_of_unity(res: *mut qqbar_struct, p: slong, q: ulong);
274 pub fn qqbar_is_root_of_unity(
275 p: *mut slong,
276 q: *mut ulong,
277 x: *const qqbar_struct,
278 ) -> libc::c_int;
279 pub fn qqbar_exp_pi_i(res: *mut qqbar_struct, p: slong, q: ulong);
280 pub fn qqbar_cos_pi(res: *mut qqbar_struct, p: slong, q: ulong);
281 pub fn qqbar_sin_pi(res: *mut qqbar_struct, p: slong, q: ulong);
282 pub fn qqbar_tan_pi(res: *mut qqbar_struct, p: slong, q: ulong) -> libc::c_int;
283 pub fn qqbar_cot_pi(res: *mut qqbar_struct, p: slong, q: ulong) -> libc::c_int;
284 pub fn qqbar_sec_pi(res: *mut qqbar_struct, p: slong, q: ulong) -> libc::c_int;
285 pub fn qqbar_csc_pi(res: *mut qqbar_struct, p: slong, q: ulong) -> libc::c_int;
286 pub fn qqbar_log_pi_i(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
287 pub fn qqbar_atan_pi(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
288 pub fn qqbar_asin_pi(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
289 pub fn qqbar_acos_pi(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
290 pub fn qqbar_acot_pi(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
291 pub fn qqbar_asec_pi(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
292 pub fn qqbar_acsc_pi(p: *mut slong, q: *mut ulong, x: *const qqbar_struct) -> libc::c_int;
293 pub fn qqbar_guess(
294 res: *mut qqbar_struct,
295 z: *const acb_struct,
296 max_deg: slong,
297 max_bits: slong,
298 flags: libc::c_int,
299 prec: slong,
300 ) -> libc::c_int;
301 pub fn qqbar_express_in_field(
302 res: *mut fmpq_poly_struct,
303 alpha: *const qqbar_struct,
304 x: *const qqbar_struct,
305 max_bits: slong,
306 flags: libc::c_int,
307 prec: slong,
308 ) -> libc::c_int;
309 pub fn qqbar_get_quadratic(
310 res_a: *mut fmpz,
311 res_b: *mut fmpz,
312 res_c: *mut fmpz,
313 res_q: *mut fmpz,
314 x: *const qqbar_struct,
315 factoring: libc::c_int,
316 );
317 pub fn qqbar_scalar_op(
318 res: *mut qqbar_struct,
319 x: *const qqbar_struct,
320 a: *const fmpz,
321 b: *const fmpz,
322 c: *const fmpz,
323 );
324 pub fn qqbar_fmpz_poly_composed_op(
325 res: *mut fmpz_poly_struct,
326 A: *const fmpz_poly_struct,
327 B: *const fmpz_poly_struct,
328 op: libc::c_int,
329 );
330 pub fn qqbar_binary_op(
331 res: *mut qqbar_struct,
332 x: *const qqbar_struct,
333 y: *const qqbar_struct,
334 op: libc::c_int,
335 );
336 pub fn _qqbar_validate_uniqueness(
337 res: *mut acb_struct,
338 poly: *const fmpz_poly_struct,
339 z: *const acb_struct,
340 max_prec: slong,
341 ) -> libc::c_int;
342 pub fn _qqbar_validate_existence_uniqueness(
343 res: *mut acb_struct,
344 poly: *const fmpz_poly_struct,
345 z: *const acb_struct,
346 prec: slong,
347 ) -> libc::c_int;
348 pub fn _qqbar_enclosure_raw(
349 res: *mut acb_struct,
350 poly: *const fmpz_poly_struct,
351 zin: *const acb_struct,
352 prec: slong,
353 );
354 pub fn qqbar_enclosure_raw(res: *mut acb_struct, x: *const qqbar_struct, prec: slong);
355 pub fn _qqbar_acb_lindep(
356 rel: *mut fmpz,
357 vec: acb_srcptr,
358 len: slong,
359 check: libc::c_int,
360 prec: slong,
361 ) -> libc::c_int;
362}