arb_sys/
mag.rs

1#![allow(non_camel_case_types)]
2
3//! *See the [Arb documentation](https://arblib.org/).
4
5use crate::fmpr::fmpr_struct;
6use flint_sys::deps::*;
7use flint_sys::flint::*;
8use flint_sys::fmpq::fmpq;
9use flint_sys::fmpz::fmpz;
10use libc::{c_char, c_int, FILE};
11
12#[repr(C)]
13#[derive(Debug, Copy, Clone)]
14pub struct mag_struct {
15    pub exp: fmpz,
16    pub man: mp_limb_t,
17}
18
19pub type mag_t = [mag_struct; 1usize];
20pub type mag_ptr = *mut mag_struct;
21pub type mag_srcptr = *const mag_struct;
22
23extern "C" {
24    pub fn mag_init(x: *mut mag_struct);
25    pub fn mag_init_set(x: *mut mag_struct, y: *const mag_struct);
26    pub fn mag_clear(x: *mut mag_struct);
27    pub fn mag_swap(x: *mut mag_struct, y: *mut mag_struct);
28    pub fn mag_set(x: *mut mag_struct, y: *const mag_struct);
29    pub fn mag_zero(x: *mut mag_struct);
30    pub fn mag_one(x: *mut mag_struct);
31    pub fn mag_is_special(x: *const mag_struct) -> c_int;
32    pub fn mag_is_zero(x: *const mag_struct) -> c_int;
33    pub fn mag_inf(x: *mut mag_struct);
34    pub fn mag_is_inf(x: *const mag_struct) -> c_int;
35    pub fn mag_is_finite(x: *const mag_struct) -> c_int;
36    pub fn mag_equal(x: *const mag_struct, y: *const mag_struct) -> c_int;
37    pub fn mag_mul(z: *mut mag_struct,
38                   x: *const mag_struct, y: *const mag_struct);
39    pub fn mag_mul_lower(z: *mut mag_struct,
40                         x: *const mag_struct, y: *const mag_struct);
41    pub fn mag_addmul(z: *mut mag_struct,
42                      x: *const mag_struct, y: *const mag_struct);
43    pub fn mag_add_2exp_fmpz(z: *mut mag_struct,
44                             x: *const mag_struct, e: *const fmpz);
45    pub fn mag_add(z: *mut mag_struct,
46                   x: *const mag_struct, y: *const mag_struct);
47    pub fn mag_add_lower(z: *mut mag_struct,
48                         x: *const mag_struct, y: *const mag_struct);
49    pub fn mag_add_ui(z: *mut mag_struct,
50                      x: *const mag_struct, y: mp_limb_t);
51    pub fn mag_add_ui_lower(res: *mut mag_struct,
52                            x: *const mag_struct, y: mp_limb_t);
53    pub fn mag_add_ui_2exp_si(
54        z: *mut mag_struct,
55        x: *const mag_struct,
56        y: mp_limb_t,
57        e: mp_limb_signed_t,
58    );
59    pub fn mag_div(z: *mut mag_struct,
60                   x: *const mag_struct, y: *const mag_struct);
61    pub fn mag_div_lower(z: *mut mag_struct,
62                         x: *const mag_struct, y: *const mag_struct);
63    pub fn mag_inv(res: *mut mag_struct, x: *const mag_struct);
64    pub fn mag_inv_lower(res: *mut mag_struct, x: *const mag_struct);
65    pub fn mag_mul_2exp_si(z: *mut mag_struct,
66                           x: *const mag_struct, y: mp_limb_signed_t);
67    pub fn mag_mul_2exp_fmpz(z: *mut mag_struct,
68                             x: *const mag_struct, y: *const fmpz);
69    pub fn mag_sub(z: *mut mag_struct,
70                   x: *const mag_struct, y: *const mag_struct);
71    pub fn mag_sub_lower(z: *mut mag_struct,
72                         x: *const mag_struct, y: *const mag_struct);
73    pub fn mag_fast_init_set(x: *mut mag_struct, y: *const mag_struct);
74    pub fn mag_fast_zero(x: *mut mag_struct);
75    pub fn mag_fast_is_zero(x: *const mag_struct) -> c_int;
76    pub fn mag_fast_mul(z: *mut mag_struct,
77                        x: *const mag_struct, y: *const mag_struct);
78    pub fn mag_fast_mul_2exp_si(z: *mut mag_struct,
79                                x: *const mag_struct, y: mp_limb_signed_t);
80    pub fn mag_fast_addmul(z: *mut mag_struct,
81                           x: *const mag_struct, y: *const mag_struct);
82    pub fn mag_fast_add_2exp_si(z: *mut mag_struct,
83                                x: *const mag_struct, e: mp_limb_signed_t);
84    pub fn mag_set_d(z: *mut mag_struct, x: f64);
85    pub fn mag_set_d_lower(z: *mut mag_struct, x: f64);
86    pub fn mag_set_d_2exp_fmpz(z: *mut mag_struct, c: f64, exp: *const fmpz);
87    pub fn mag_set_d_2exp_fmpz_lower(z: *mut mag_struct, c: f64, exp: *const fmpz);
88    pub fn mag_set_fmpz_2exp_fmpz(z: *mut mag_struct, man: *const fmpz, exp: *const fmpz);
89    pub fn mag_set_fmpr(x: *mut mag_struct, y: *const fmpr_struct);
90    pub fn mag_get_fmpr(x: *mut fmpr_struct, r: *const mag_struct);
91    pub fn mag_randtest_special(
92        x: *mut mag_struct,
93        state: *mut flint_rand_s,
94        expbits: mp_limb_signed_t,
95    );
96    pub fn mag_randtest(x: *mut mag_struct, state: *mut flint_rand_s, expbits: mp_limb_signed_t);
97    pub fn mag_fprint(file: *mut FILE, x: *const mag_struct);
98    pub fn mag_fprintd(file: *mut FILE, x: *const mag_struct, d: mp_limb_signed_t);
99    pub fn mag_print(x: *const mag_struct);
100    pub fn mag_printd(x: *const mag_struct, d: mp_limb_signed_t);
101    pub fn mag_get_fmpq(y: *mut fmpq, x: *const mag_struct);
102    pub fn mag_get_fmpz(res: *mut fmpz, x: *const mag_struct);
103    pub fn mag_get_fmpz_lower(res: *mut fmpz, x: *const mag_struct);
104    pub fn mag_cmp(x: *const mag_struct, y: *const mag_struct) -> c_int;
105    pub fn mag_cmp_2exp_si(x: *const mag_struct, e: mp_limb_signed_t) -> c_int;
106    pub fn mag_min(z: *mut mag_struct,
107                   x: *const mag_struct, y: *const mag_struct);
108    pub fn mag_max(z: *mut mag_struct,
109                   x: *const mag_struct, y: *const mag_struct);
110    pub fn _mag_vec_init(n: mp_limb_signed_t) -> mag_ptr;
111    pub fn _mag_vec_clear(v: mag_ptr, n: mp_limb_signed_t);
112    pub fn mag_get_d(z: *const mag_struct) -> f64;
113    pub fn mag_get_d_log2_approx(x: *const mag_struct) -> f64;
114    pub fn mag_d_log_upper_bound(x: f64) -> f64;
115    pub fn mag_d_log_lower_bound(x: f64) -> f64;
116    pub fn mag_log1p(z: *mut mag_struct, x: *const mag_struct);
117    pub fn mag_log_ui(t: *mut mag_struct, n: mp_limb_t);
118    pub fn mag_log(z: *mut mag_struct, x: *const mag_struct);
119    pub fn mag_log_lower(z: *mut mag_struct, x: *const mag_struct);
120    pub fn mag_neg_log(z: *mut mag_struct, x: *const mag_struct);
121    pub fn mag_neg_log_lower(z: *mut mag_struct, x: *const mag_struct);
122    pub fn mag_exp(y: *mut mag_struct, x: *const mag_struct);
123    pub fn mag_exp_lower(y: *mut mag_struct, x: *const mag_struct);
124    pub fn mag_expinv(res: *mut mag_struct, x: *const mag_struct);
125    pub fn mag_expinv_lower(y: *mut mag_struct, x: *const mag_struct);
126    pub fn mag_expm1(y: *mut mag_struct, x: *const mag_struct);
127    pub fn mag_exp_tail(z: *mut mag_struct, x: *const mag_struct, N: mp_limb_t);
128    pub fn mag_sinh(y: *mut mag_struct, x: *const mag_struct);
129    pub fn mag_sinh_lower(y: *mut mag_struct, x: *const mag_struct);
130    pub fn mag_cosh(y: *mut mag_struct, x: *const mag_struct);
131    pub fn mag_cosh_lower(y: *mut mag_struct, x: *const mag_struct);
132    pub fn mag_pow_ui(z: *mut mag_struct, x: *const mag_struct, e: mp_limb_t);
133    pub fn mag_pow_ui_lower(z: *mut mag_struct,
134                            x: *const mag_struct, e: mp_limb_t);
135    pub fn mag_pow_fmpz(z: *mut mag_struct,
136                        x: *const mag_struct, e: *const fmpz);
137    pub fn mag_pow_fmpz_lower(z: *mut mag_struct,
138                              x: *const mag_struct, e: *const fmpz);
139    pub fn mag_const_pi(res: *mut mag_struct);
140    pub fn mag_const_pi_lower(res: *mut mag_struct);
141    pub fn mag_atan(res: *mut mag_struct, x: *const mag_struct);
142    pub fn mag_atan_lower(res: *mut mag_struct, x: *const mag_struct);
143    pub fn mag_fac_ui(z: *mut mag_struct, n: mp_limb_t);
144    pub fn mag_rfac_ui(z: *mut mag_struct, n: mp_limb_t);
145    pub fn mag_bin_uiui(res: *mut mag_struct, n: mp_limb_t, k: mp_limb_t);
146    pub fn mag_bernoulli_div_fac_ui(z: *mut mag_struct, n: mp_limb_t);
147    pub fn mag_set_fmpz_2exp_fmpz_lower(z: *mut mag_struct, man: *const fmpz, exp: *const fmpz);
148    pub fn mag_sqrt(y: *mut mag_struct, x: *const mag_struct);
149    pub fn mag_sqrt_lower(y: *mut mag_struct, x: *const mag_struct);
150    pub fn mag_rsqrt(y: *mut mag_struct, x: *const mag_struct);
151    pub fn mag_rsqrt_lower(y: *mut mag_struct, x: *const mag_struct);
152    pub fn mag_root(y: *mut mag_struct, x: *const mag_struct, n: mp_limb_t);
153    pub fn mag_hypot(z: *mut mag_struct,
154                     x: *const mag_struct, y: *const mag_struct);
155    pub fn mag_binpow_uiui(b: *mut mag_struct, m: mp_limb_t, n: mp_limb_t);
156    pub fn mag_polylog_tail(
157        u: *mut mag_struct,
158        z: *const mag_struct,
159        sigma: mp_limb_signed_t,
160        d: mp_limb_t,
161        N: mp_limb_t,
162    );
163    pub fn mag_geom_series(res: *mut mag_struct,
164                           x: *const mag_struct, n: mp_limb_t);
165    pub fn mag_hurwitz_zeta_uiui(res: *mut mag_struct, s: mp_limb_t, a: mp_limb_t);
166    pub fn mag_set_ui(z: *mut mag_struct, x: mp_limb_t);
167    pub fn mag_set_ui_lower(z: *mut mag_struct, x: mp_limb_t);
168    pub fn mag_set_ui_2exp_si(z: *mut mag_struct, v: mp_limb_t, e: mp_limb_signed_t);
169    pub fn mag_set_fmpz(z: *mut mag_struct, x: *const fmpz);
170    pub fn mag_set_fmpz_lower(z: *mut mag_struct, x: *const fmpz);
171    pub fn mag_mul_ui(z: *mut mag_struct,
172                      x: *const mag_struct, y: mp_limb_t);
173    pub fn mag_mul_ui_lower(z: *mut mag_struct,
174                            x: *const mag_struct, y: mp_limb_t);
175    pub fn mag_mul_fmpz(z: *mut mag_struct,
176                        x: *const mag_struct, y: *const fmpz);
177    pub fn mag_mul_fmpz_lower(z: *mut mag_struct,
178                              x: *const mag_struct, y: *const fmpz);
179    pub fn mag_div_ui(z: *mut mag_struct,
180                      x: *const mag_struct, y: mp_limb_t);
181    pub fn mag_div_fmpz(z: *mut mag_struct,
182                        x: *const mag_struct, y: *const fmpz);
183    pub fn mag_allocated_bytes(x: *const mag_struct) -> mp_limb_signed_t;
184    pub fn mag_load_str(res: *mut mag_struct, data: *const c_char) -> c_int;
185    pub fn mag_dump_str(x: *const mag_struct) -> *mut c_char;
186    pub fn mag_load_file(res: *mut mag_struct, stream: *const FILE) -> c_int;
187    pub fn mag_dump_file(stream: *mut FILE, x: *const mag_struct) -> c_int;
188}