1use crate::deps::*;
4use crate::dlog::*;
5use crate::flint::*;
6
7
8pub const MAX_FACTORS: u32 = 15;
9#[repr(C)]
10pub struct dirichlet_prime_group_struct {
11 pub p: ulong,
12 pub e: libc::c_int,
13 pub pe: nmod_t,
14 pub phi: nmod_t,
15 pub g: ulong,
16 pub dlog: *mut dlog_precomp_struct,
17}
18#[allow(clippy::unnecessary_operation, clippy::identity_op)]
19const _: () = {
20 ["Size of dirichlet_prime_group_struct"]
21 [::std::mem::size_of::<dirichlet_prime_group_struct>() - 80usize];
22 ["Alignment of dirichlet_prime_group_struct"]
23 [::std::mem::align_of::<dirichlet_prime_group_struct>() - 8usize];
24 ["Offset of field: dirichlet_prime_group_struct::p"]
25 [::std::mem::offset_of!(dirichlet_prime_group_struct, p) - 0usize];
26 ["Offset of field: dirichlet_prime_group_struct::e"]
27 [::std::mem::offset_of!(dirichlet_prime_group_struct, e) - 8usize];
28 ["Offset of field: dirichlet_prime_group_struct::pe"]
29 [::std::mem::offset_of!(dirichlet_prime_group_struct, pe) - 16usize];
30 ["Offset of field: dirichlet_prime_group_struct::phi"]
31 [::std::mem::offset_of!(dirichlet_prime_group_struct, phi) - 40usize];
32 ["Offset of field: dirichlet_prime_group_struct::g"]
33 [::std::mem::offset_of!(dirichlet_prime_group_struct, g) - 64usize];
34 ["Offset of field: dirichlet_prime_group_struct::dlog"]
35 [::std::mem::offset_of!(dirichlet_prime_group_struct, dlog) - 72usize];
36};
37impl Default for dirichlet_prime_group_struct {
38 fn default() -> Self {
39 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
40 unsafe {
41 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
42 s.assume_init()
43 }
44 }
45}
46#[repr(C)]
47pub struct dirichlet_group_struct {
48 pub q: ulong,
49 pub q_even: ulong,
50 pub mod_: nmod_t,
51 pub rad_q: ulong,
52 pub phi_q: ulong,
53 pub neven: slong,
54 pub num: slong,
55 pub expo: ulong,
56 pub P: *mut dirichlet_prime_group_struct,
57 pub generators: *mut ulong,
58 pub PHI: *mut ulong,
59}
60#[allow(clippy::unnecessary_operation, clippy::identity_op)]
61const _: () = {
62 ["Size of dirichlet_group_struct"][::std::mem::size_of::<dirichlet_group_struct>() - 104usize];
63 ["Alignment of dirichlet_group_struct"]
64 [::std::mem::align_of::<dirichlet_group_struct>() - 8usize];
65 ["Offset of field: dirichlet_group_struct::q"]
66 [::std::mem::offset_of!(dirichlet_group_struct, q) - 0usize];
67 ["Offset of field: dirichlet_group_struct::q_even"]
68 [::std::mem::offset_of!(dirichlet_group_struct, q_even) - 8usize];
69 ["Offset of field: dirichlet_group_struct::mod_"]
70 [::std::mem::offset_of!(dirichlet_group_struct, mod_) - 16usize];
71 ["Offset of field: dirichlet_group_struct::rad_q"]
72 [::std::mem::offset_of!(dirichlet_group_struct, rad_q) - 40usize];
73 ["Offset of field: dirichlet_group_struct::phi_q"]
74 [::std::mem::offset_of!(dirichlet_group_struct, phi_q) - 48usize];
75 ["Offset of field: dirichlet_group_struct::neven"]
76 [::std::mem::offset_of!(dirichlet_group_struct, neven) - 56usize];
77 ["Offset of field: dirichlet_group_struct::num"]
78 [::std::mem::offset_of!(dirichlet_group_struct, num) - 64usize];
79 ["Offset of field: dirichlet_group_struct::expo"]
80 [::std::mem::offset_of!(dirichlet_group_struct, expo) - 72usize];
81 ["Offset of field: dirichlet_group_struct::P"]
82 [::std::mem::offset_of!(dirichlet_group_struct, P) - 80usize];
83 ["Offset of field: dirichlet_group_struct::generators"]
84 [::std::mem::offset_of!(dirichlet_group_struct, generators) - 88usize];
85 ["Offset of field: dirichlet_group_struct::PHI"]
86 [::std::mem::offset_of!(dirichlet_group_struct, PHI) - 96usize];
87};
88impl Default for dirichlet_group_struct {
89 fn default() -> Self {
90 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
91 unsafe {
92 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
93 s.assume_init()
94 }
95 }
96}
97pub type dirichlet_group_t = [dirichlet_group_struct; 1usize];
98#[repr(C)]
99pub struct dirichlet_char_struct {
100 pub n: ulong,
101 pub log: *mut ulong,
102}
103#[allow(clippy::unnecessary_operation, clippy::identity_op)]
104const _: () = {
105 ["Size of dirichlet_char_struct"][::std::mem::size_of::<dirichlet_char_struct>() - 16usize];
106 ["Alignment of dirichlet_char_struct"]
107 [::std::mem::align_of::<dirichlet_char_struct>() - 8usize];
108 ["Offset of field: dirichlet_char_struct::n"]
109 [::std::mem::offset_of!(dirichlet_char_struct, n) - 0usize];
110 ["Offset of field: dirichlet_char_struct::log"]
111 [::std::mem::offset_of!(dirichlet_char_struct, log) - 8usize];
112};
113impl Default for dirichlet_char_struct {
114 fn default() -> Self {
115 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
116 unsafe {
117 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
118 s.assume_init()
119 }
120 }
121}
122pub type dirichlet_char_t = [dirichlet_char_struct; 1usize];
123extern "C" {
124 #[link_name = "dirichlet_group_size__extern"]
125 pub fn dirichlet_group_size(G: *const dirichlet_group_struct) -> ulong;
126 pub fn dirichlet_group_num_primitive(G: *const dirichlet_group_struct) -> ulong;
127 pub fn dirichlet_group_init(G: *mut dirichlet_group_struct, q: ulong) -> libc::c_int;
128 pub fn dirichlet_subgroup_init(
129 H: *mut dirichlet_group_struct,
130 G: *const dirichlet_group_struct,
131 h: ulong,
132 );
133 pub fn dirichlet_group_clear(G: *mut dirichlet_group_struct);
134 pub fn dirichlet_group_dlog_precompute(G: *mut dirichlet_group_struct, num: ulong);
135 pub fn dirichlet_group_dlog_clear(G: *mut dirichlet_group_struct);
136 pub fn dirichlet_conductor_ui(G: *const dirichlet_group_struct, a: ulong) -> ulong;
137 pub fn dirichlet_parity_ui(G: *const dirichlet_group_struct, a: ulong) -> libc::c_int;
138 pub fn dirichlet_order_ui(G: *const dirichlet_group_struct, a: ulong) -> ulong;
139 pub fn dirichlet_char_init(x: *mut dirichlet_char_struct, G: *const dirichlet_group_struct);
140 pub fn dirichlet_char_clear(x: *mut dirichlet_char_struct);
141 pub fn dirichlet_char_print(G: *const dirichlet_group_struct, x: *const dirichlet_char_struct);
142 #[link_name = "dirichlet_char_set__extern"]
143 pub fn dirichlet_char_set(
144 x: *mut dirichlet_char_struct,
145 G: *const dirichlet_group_struct,
146 y: *const dirichlet_char_struct,
147 );
148 #[link_name = "dirichlet_char_eq__extern"]
149 pub fn dirichlet_char_eq(
150 x: *const dirichlet_char_struct,
151 y: *const dirichlet_char_struct,
152 ) -> libc::c_int;
153 pub fn dirichlet_char_eq_deep(
154 G: *const dirichlet_group_struct,
155 x: *const dirichlet_char_struct,
156 y: *const dirichlet_char_struct,
157 ) -> libc::c_int;
158 pub fn dirichlet_parity_char(
159 G: *const dirichlet_group_struct,
160 x: *const dirichlet_char_struct,
161 ) -> libc::c_int;
162 pub fn dirichlet_conductor_char(
163 G: *const dirichlet_group_struct,
164 x: *const dirichlet_char_struct,
165 ) -> ulong;
166 pub fn dirichlet_order_char(
167 G: *const dirichlet_group_struct,
168 x: *const dirichlet_char_struct,
169 ) -> ulong;
170 pub fn dirichlet_char_log(
171 x: *mut dirichlet_char_struct,
172 G: *const dirichlet_group_struct,
173 m: ulong,
174 );
175 #[link_name = "dirichlet_char_exp__extern"]
176 pub fn dirichlet_char_exp(
177 G: *const dirichlet_group_struct,
178 x: *const dirichlet_char_struct,
179 ) -> ulong;
180 pub fn _dirichlet_char_exp(
181 x: *mut dirichlet_char_struct,
182 G: *const dirichlet_group_struct,
183 ) -> ulong;
184 pub fn dirichlet_char_index(
185 x: *mut dirichlet_char_struct,
186 G: *const dirichlet_group_struct,
187 j: ulong,
188 );
189 pub fn dirichlet_index_char(
190 G: *const dirichlet_group_struct,
191 x: *const dirichlet_char_struct,
192 ) -> ulong;
193 pub fn dirichlet_char_one(x: *mut dirichlet_char_struct, G: *const dirichlet_group_struct);
194 pub fn dirichlet_char_first_primitive(
195 x: *mut dirichlet_char_struct,
196 G: *const dirichlet_group_struct,
197 );
198 pub fn dirichlet_char_next(
199 x: *mut dirichlet_char_struct,
200 G: *const dirichlet_group_struct,
201 ) -> libc::c_int;
202 pub fn dirichlet_char_next_primitive(
203 x: *mut dirichlet_char_struct,
204 G: *const dirichlet_group_struct,
205 ) -> libc::c_int;
206 pub fn dirichlet_char_mul(
207 c: *mut dirichlet_char_struct,
208 G: *const dirichlet_group_struct,
209 a: *const dirichlet_char_struct,
210 b: *const dirichlet_char_struct,
211 );
212 pub fn dirichlet_char_pow(
213 c: *mut dirichlet_char_struct,
214 G: *const dirichlet_group_struct,
215 a: *const dirichlet_char_struct,
216 n: ulong,
217 );
218 pub fn dirichlet_char_lower(
219 y: *mut dirichlet_char_struct,
220 H: *const dirichlet_group_struct,
221 x: *const dirichlet_char_struct,
222 G: *const dirichlet_group_struct,
223 );
224 pub fn dirichlet_char_lift(
225 y: *mut dirichlet_char_struct,
226 G: *const dirichlet_group_struct,
227 x: *const dirichlet_char_struct,
228 H: *const dirichlet_group_struct,
229 );
230 pub fn dirichlet_pairing(G: *const dirichlet_group_struct, m: ulong, n: ulong) -> ulong;
231 pub fn dirichlet_pairing_char(
232 G: *const dirichlet_group_struct,
233 a: *const dirichlet_char_struct,
234 b: *const dirichlet_char_struct,
235 ) -> ulong;
236 #[link_name = "dirichlet_char_is_principal__extern"]
237 pub fn dirichlet_char_is_principal(
238 G: *const dirichlet_group_struct,
239 chi: *const dirichlet_char_struct,
240 ) -> libc::c_int;
241 #[link_name = "dirichlet_char_is_real__extern"]
242 pub fn dirichlet_char_is_real(
243 G: *const dirichlet_group_struct,
244 chi: *const dirichlet_char_struct,
245 ) -> libc::c_int;
246 #[link_name = "dirichlet_char_is_primitive__extern"]
247 pub fn dirichlet_char_is_primitive(
248 G: *const dirichlet_group_struct,
249 chi: *const dirichlet_char_struct,
250 ) -> libc::c_int;
251 pub fn dirichlet_chi(
252 G: *const dirichlet_group_struct,
253 chi: *const dirichlet_char_struct,
254 n: ulong,
255 ) -> ulong;
256 pub fn dirichlet_vec_set_null(v: *mut ulong, G: *const dirichlet_group_struct, nv: slong);
257 pub fn dirichlet_chi_vec_loop(
258 v: *mut ulong,
259 G: *const dirichlet_group_struct,
260 chi: *const dirichlet_char_struct,
261 nv: slong,
262 );
263 pub fn dirichlet_chi_vec_primeloop(
264 v: *mut ulong,
265 G: *const dirichlet_group_struct,
266 chi: *const dirichlet_char_struct,
267 nv: slong,
268 );
269 pub fn dirichlet_chi_vec(
270 v: *mut ulong,
271 G: *const dirichlet_group_struct,
272 chi: *const dirichlet_char_struct,
273 nv: slong,
274 );
275 pub fn dirichlet_chi_vec_loop_order(
276 v: *mut ulong,
277 G: *const dirichlet_group_struct,
278 chi: *const dirichlet_char_struct,
279 order: ulong,
280 nv: slong,
281 );
282 pub fn dirichlet_chi_vec_primeloop_order(
283 v: *mut ulong,
284 G: *const dirichlet_group_struct,
285 chi: *const dirichlet_char_struct,
286 order: ulong,
287 nv: slong,
288 );
289 pub fn dirichlet_chi_vec_order(
290 v: *mut ulong,
291 G: *const dirichlet_group_struct,
292 chi: *const dirichlet_char_struct,
293 order: ulong,
294 nv: slong,
295 );
296}