libsais_sys/libsais64.rs
1/* automatically generated by rust-bindgen 0.72.0 and slightly edited */
2
3pub const LIBSAIS64_VERSION_MAJOR: u32 = 2;
4pub const LIBSAIS64_VERSION_MINOR: u32 = 10;
5pub const LIBSAIS64_VERSION_PATCH: u32 = 3;
6pub const LIBSAIS64_VERSION_STRING: &str = "2.10.3";
7
8unsafe extern "C" {
9 /// Constructs the suffix array of a given string.
10 ///
11 /// # Arguments
12 ///
13 /// * `T` - [0..n-1] The input string.
14 /// * `SA` - [0..n-1+fs] The output array of suffixes.
15 /// * `n` - The length of the given string.
16 /// * `fs` - The extra space available at the end of SA array (0 should be enough for most cases).
17 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
18 ///
19 /// # Returns
20 ///
21 /// 0 if no error occurred, -1 or -2 otherwise.
22 pub fn libsais64(T: *const u8, SA: *mut i64, n: i64, fs: i64, freq: *mut i64) -> i64;
23
24 /// Constructs the generalized suffix array (GSA) of given string set.
25 ///
26 /// # Arguments
27 ///
28 /// * `T` - [0..n-1] The input string set using 0 as separators (T[n-1] must be 0).
29 /// * `SA` - [0..n-1+fs] The output array of suffixes.
30 /// * `n` - The length of the given string set.
31 /// * `fs` - The extra space available at the end of SA array (0 should be enough for most cases).
32 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
33 ///
34 /// # Returns
35 ///
36 /// 0 if no error occurred, -1 or -2 otherwise.
37 pub fn libsais64_gsa(T: *const u8, SA: *mut i64, n: i64, fs: i64, freq: *mut i64) -> i64;
38
39 /// Constructs the suffix array of a given integer array.Note, during construction input array will be modified, but restored at the end if no errors occurred.
40 ///
41 /// # Arguments
42 ///
43 /// * `T` - [0..n-1] The input integer array.
44 /// * `SA` - [0..n-1+fs] The output array of suffixes.
45 /// * `n` - The length of the integer array.
46 /// * `k` - The alphabet size of the input integer array.
47 /// * `fs` - Extra space available at the end of SA array (can be 0, but 4k or better 6k is recommended for optimal performance).
48 ///
49 /// # Returns
50 ///
51 /// 0 if no error occurred, -1 or -2 otherwise.
52 pub fn libsais64_long(T: *mut i64, SA: *mut i64, n: i64, k: i64, fs: i64) -> i64;
53
54 /// Constructs the suffix array of a given string in parallel using OpenMP.
55 ///
56 /// # Arguments
57 ///
58 /// * `T` - [0..n-1] The input string.
59 /// * `SA` - [0..n-1+fs] The output array of suffixes.
60 /// * `n` - The length of the given string.
61 /// * `fs` - The extra space available at the end of SA array (0 should be enough for most cases).
62 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
63 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
64 ///
65 /// # Returns
66 ///
67 /// 0 if no error occurred, -1 or -2 otherwise.
68 #[cfg(feature = "openmp")]
69 pub fn libsais64_omp(
70 T: *const u8,
71 SA: *mut i64,
72 n: i64,
73 fs: i64,
74 freq: *mut i64,
75 threads: i64,
76 ) -> i64;
77
78 /// Constructs the generalized suffix array (GSA) of given string set in parallel using OpenMP.
79 ///
80 /// # Arguments
81 ///
82 /// * `T` - [0..n-1] The input string set using 0 as separators (T[n-1] must be 0).
83 /// * `SA` - [0..n-1+fs] The output array of suffixes.
84 /// * `n` - The length of the given string set.
85 /// * `fs` - The extra space available at the end of SA array (0 should be enough for most cases).
86 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
87 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
88 ///
89 /// # Returns
90 ///
91 /// 0 if no error occurred, -1 or -2 otherwise.
92 #[cfg(feature = "openmp")]
93 pub fn libsais64_gsa_omp(
94 T: *const u8,
95 SA: *mut i64,
96 n: i64,
97 fs: i64,
98 freq: *mut i64,
99 threads: i64,
100 ) -> i64;
101
102 /// Constructs the suffix array of a given integer array in parallel using OpenMP.Note, during construction input array will be modified, but restored at the end if no errors occurred.
103 ///
104 /// # Arguments
105 ///
106 /// * `T` - [0..n-1] The input integer array.
107 /// * `SA` - [0..n-1+fs] The output array of suffixes.
108 /// * `n` - The length of the integer array.
109 /// * `k` - The alphabet size of the input integer array.
110 /// * `fs` - Extra space available at the end of SA array (can be 0, but 4k or better 6k is recommended for optimal performance).
111 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
112 ///
113 /// # Returns
114 ///
115 /// 0 if no error occurred, -1 or -2 otherwise.
116 #[cfg(feature = "openmp")]
117 pub fn libsais64_long_omp(
118 T: *mut i64,
119 SA: *mut i64,
120 n: i64,
121 k: i64,
122 fs: i64,
123 threads: i64,
124 ) -> i64;
125
126 /// Constructs the burrows-wheeler transformed string (BWT) of a given string.
127 ///
128 /// # Arguments
129 ///
130 /// * `T` - [0..n-1] The input string.
131 /// * `U` - [0..n-1] The output string (can be T).
132 /// * `A` - [0..n-1+fs] The temporary array.
133 /// * `n` - The length of the given string.
134 /// * `fs` - The extra space available at the end of A array (0 should be enough for most cases).
135 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
136 ///
137 /// # Returns
138 ///
139 /// The primary index if no error occurred, -1 or -2 otherwise.
140 pub fn libsais64_bwt(
141 T: *const u8,
142 U: *mut u8,
143 A: *mut i64,
144 n: i64,
145 fs: i64,
146 freq: *mut i64,
147 ) -> i64;
148
149 /// Constructs the burrows-wheeler transformed string (BWT) of a given string with auxiliary indexes.
150 ///
151 /// # Arguments
152 ///
153 /// * `T` - [0..n-1] The input string.
154 /// * `U` - [0..n-1] The output string (can be T).
155 /// * `A` - [0..n-1+fs] The temporary array.
156 /// * `n` - The length of the given string.
157 /// * `fs` - The extra space available at the end of A array (0 should be enough for most cases).
158 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
159 /// * `r` - The sampling rate for auxiliary indexes (must be power of 2).
160 /// * `I` - [0..(n-1)/r] The output auxiliary indexes.
161 ///
162 /// # Returns
163 ///
164 /// 0 if no error occurred, -1 or -2 otherwise.
165 pub fn libsais64_bwt_aux(
166 T: *const u8,
167 U: *mut u8,
168 A: *mut i64,
169 n: i64,
170 fs: i64,
171 freq: *mut i64,
172 r: i64,
173 I: *mut i64,
174 ) -> i64;
175
176 /// Constructs the burrows-wheeler transformed string (BWT) of a given string in parallel using OpenMP.
177 ///
178 /// # Arguments
179 ///
180 /// * `T` - [0..n-1] The input string.
181 /// * `U` - [0..n-1] The output string (can be T).
182 /// * `A` - [0..n-1+fs] The temporary array.
183 /// * `n` - The length of the given string.
184 /// * `fs` - The extra space available at the end of A array (0 should be enough for most cases).
185 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
186 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
187 ///
188 /// # Returns
189 ///
190 /// The primary index if no error occurred, -1 or -2 otherwise.
191 #[cfg(feature = "openmp")]
192 pub fn libsais64_bwt_omp(
193 T: *const u8,
194 U: *mut u8,
195 A: *mut i64,
196 n: i64,
197 fs: i64,
198 freq: *mut i64,
199 threads: i64,
200 ) -> i64;
201
202 /// Constructs the burrows-wheeler transformed string (BWT) of a given string with auxiliary indexes in parallel using OpenMP.
203 ///
204 /// # Arguments
205 ///
206 /// * `T` - [0..n-1] The input string.
207 /// * `U` - [0..n-1] The output string (can be T).
208 /// * `A` - [0..n-1+fs] The temporary array.
209 /// * `n` - The length of the given string.
210 /// * `fs` - The extra space available at the end of A array (0 should be enough for most cases).
211 /// * `freq` - [0..255] The output symbol frequency table (can be NULL).
212 /// * `r` - The sampling rate for auxiliary indexes (must be power of 2).
213 /// * `I` - [0..(n-1)/r] The output auxiliary indexes.
214 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
215 ///
216 /// # Returns
217 ///
218 /// 0 if no error occurred, -1 or -2 otherwise.
219 #[cfg(feature = "openmp")]
220 pub fn libsais64_bwt_aux_omp(
221 T: *const u8,
222 U: *mut u8,
223 A: *mut i64,
224 n: i64,
225 fs: i64,
226 freq: *mut i64,
227 r: i64,
228 I: *mut i64,
229 threads: i64,
230 ) -> i64;
231
232 /// Constructs the original string from a given burrows-wheeler transformed string (BWT) with primary index.
233 ///
234 /// # Arguments
235 ///
236 /// * `T` - [0..n-1] The input string.
237 /// * `U` - [0..n-1] The output string (can be T).
238 /// * `A` - [0..n] The temporary array (NOTE, temporary array must be n + 1 size).
239 /// * `n` - The length of the given string.
240 /// * `freq` - [0..255] The input symbol frequency table (can be NULL).
241 /// * `i` - The primary index.
242 ///
243 /// # Returns
244 ///
245 /// 0 if no error occurred, -1 or -2 otherwise.
246 pub fn libsais64_unbwt(
247 T: *const u8,
248 U: *mut u8,
249 A: *mut i64,
250 n: i64,
251 freq: *const i64,
252 i: i64,
253 ) -> i64;
254
255 /// Constructs the original string from a given burrows-wheeler transformed string (BWT) with auxiliary indexes.
256 ///
257 /// # Arguments
258 ///
259 /// * `T` - [0..n-1] The input string.
260 /// * `U` - [0..n-1] The output string (can be T).
261 /// * `A` - [0..n] The temporary array (NOTE, temporary array must be n + 1 size).
262 /// * `n` - The length of the given string.
263 /// * `freq` - [0..255] The input symbol frequency table (can be NULL).
264 /// * `r` - The sampling rate for auxiliary indexes (must be power of 2).
265 /// * `I` - [0..(n-1)/r] The input auxiliary indexes.
266 ///
267 /// # Returns
268 ///
269 /// 0 if no error occurred, -1 or -2 otherwise.
270 pub fn libsais64_unbwt_aux(
271 T: *const u8,
272 U: *mut u8,
273 A: *mut i64,
274 n: i64,
275 freq: *const i64,
276 r: i64,
277 I: *const i64,
278 ) -> i64;
279
280 /// Constructs the original string from a given burrows-wheeler transformed string (BWT) with primary index in parallel using OpenMP.
281 ///
282 /// # Arguments
283 ///
284 /// * `T` - [0..n-1] The input string.
285 /// * `U` - [0..n-1] The output string (can be T).
286 /// * `A` - [0..n] The temporary array (NOTE, temporary array must be n + 1 size).
287 /// * `n` - The length of the given string.
288 /// * `freq` - [0..255] The input symbol frequency table (can be NULL).
289 /// * `i` - The primary index.
290 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
291 ///
292 /// # Returns
293 ///
294 /// 0 if no error occurred, -1 or -2 otherwise.
295 #[cfg(feature = "openmp")]
296 pub fn libsais64_unbwt_omp(
297 T: *const u8,
298 U: *mut u8,
299 A: *mut i64,
300 n: i64,
301 freq: *const i64,
302 i: i64,
303 threads: i64,
304 ) -> i64;
305
306 /// Constructs the original string from a given burrows-wheeler transformed string (BWT) with auxiliary indexes in parallel using OpenMP.
307 ///
308 /// # Arguments
309 ///
310 /// * `T` - [0..n-1] The input string.
311 /// * `U` - [0..n-1] The output string (can be T).
312 /// * `A` - [0..n] The temporary array (NOTE, temporary array must be n + 1 size).
313 /// * `n` - The length of the given string.
314 /// * `freq` - [0..255] The input symbol frequency table (can be NULL).
315 /// * `r` - The sampling rate for auxiliary indexes (must be power of 2).
316 /// * `I` - [0..(n-1)/r] The input auxiliary indexes.
317 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
318 ///
319 /// # Returns
320 ///
321 /// 0 if no error occurred, -1 or -2 otherwise.
322 #[cfg(feature = "openmp")]
323 pub fn libsais64_unbwt_aux_omp(
324 T: *const u8,
325 U: *mut u8,
326 A: *mut i64,
327 n: i64,
328 freq: *const i64,
329 r: i64,
330 I: *const i64,
331 threads: i64,
332 ) -> i64;
333
334 /// Constructs the permuted longest common prefix array (PLCP) of a given string and a suffix array.
335 ///
336 /// # Arguments
337 ///
338 /// * `T` - [0..n-1] The input string.
339 /// * `SA` - [0..n-1] The input suffix array.
340 /// * `PLCP` - [0..n-1] The output permuted longest common prefix array.
341 /// * `n` - The length of the string and the suffix array.
342 ///
343 /// # Returns
344 ///
345 /// 0 if no error occurred, -1 otherwise.
346 pub fn libsais64_plcp(T: *const u8, SA: *const i64, PLCP: *mut i64, n: i64) -> i64;
347
348 /// Constructs the permuted longest common prefix array (PLCP) of a given string set and a generalized suffix array (GSA).
349 ///
350 /// # Arguments
351 ///
352 /// * `T` - [0..n-1] The input string set using 0 as separators (T[n-1] must be 0).
353 /// * `SA` - [0..n-1] The input generalized suffix array.
354 /// * `PLCP` - [0..n-1] The output permuted longest common prefix array.
355 /// * `n` - The length of the string set and the generalized suffix array.
356 ///
357 /// # Returns
358 ///
359 /// 0 if no error occurred, -1 otherwise.
360 pub fn libsais64_plcp_gsa(T: *const u8, SA: *const i64, PLCP: *mut i64, n: i64) -> i64;
361
362 /// Constructs the longest common prefix array (LCP) of a given permuted longest common prefix array (PLCP) and a suffix array.
363 ///
364 /// # Arguments
365 ///
366 /// * `PLCP` - [0..n-1] The input permuted longest common prefix array.
367 /// * `SA` - [0..n-1] The input suffix array or generalized suffix array (GSA).
368 /// * `LCP` - [0..n-1] The output longest common prefix array (can be SA).
369 /// * `n` - The length of the permuted longest common prefix array and the suffix array.
370 ///
371 /// # Returns
372 ///
373 /// 0 if no error occurred, -1 otherwise.
374 pub fn libsais64_lcp(PLCP: *const i64, SA: *const i64, LCP: *mut i64, n: i64) -> i64;
375
376 /// Constructs the permuted longest common prefix array (PLCP) of a given string and a suffix array in parallel using OpenMP.
377 ///
378 /// # Arguments
379 ///
380 /// * `T` - [0..n-1] The input string.
381 /// * `SA` - [0..n-1] The input suffix array.
382 /// * `PLCP` - [0..n-1] The output permuted longest common prefix array.
383 /// * `n` - The length of the string and the suffix array.
384 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
385 ///
386 /// # Returns
387 ///
388 /// 0 if no error occurred, -1 otherwise.
389 #[cfg(feature = "openmp")]
390 pub fn libsais64_plcp_omp(
391 T: *const u8,
392 SA: *const i64,
393 PLCP: *mut i64,
394 n: i64,
395 threads: i64,
396 ) -> i64;
397
398 /// Constructs the permuted longest common prefix array (PLCP) of a given string set and a generalized suffix array (GSA) in parallel using OpenMP.
399 ///
400 /// # Arguments
401 ///
402 /// * `T` - [0..n-1] The input string set using 0 as separators (T[n-1] must be 0).
403 /// * `SA` - [0..n-1] The input generalized suffix array.
404 /// * `PLCP` - [0..n-1] The output permuted longest common prefix array.
405 /// * `n` - The length of the string set and the generalized suffix array.
406 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
407 ///
408 /// # Returns
409 ///
410 /// 0 if no error occurred, -1 otherwise.
411 #[cfg(feature = "openmp")]
412 pub fn libsais64_plcp_gsa_omp(
413 T: *const u8,
414 SA: *const i64,
415 PLCP: *mut i64,
416 n: i64,
417 threads: i64,
418 ) -> i64;
419
420 /// Constructs the longest common prefix array (LCP) of a given permuted longest common prefix array (PLCP) and a suffix array in parallel using OpenMP.
421 ///
422 /// # Arguments
423 ///
424 /// * `PLCP` - [0..n-1] The input permuted longest common prefix array.
425 /// * `SA` - [0..n-1] The input suffix array or generalized suffix array (GSA).
426 /// * `LCP` - [0..n-1] The output longest common prefix array (can be SA).
427 /// * `n` - The length of the permuted longest common prefix array and the suffix array.
428 /// * `threads` - The number of OpenMP threads to use (can be 0 for OpenMP default).
429 ///
430 /// # Returns
431 ///
432 /// 0 if no error occurred, -1 otherwise.
433 #[cfg(feature = "openmp")]
434 pub fn libsais64_lcp_omp(
435 PLCP: *const i64,
436 SA: *const i64,
437 LCP: *mut i64,
438 n: i64,
439 threads: i64,
440 ) -> i64;
441}