m4ri_sys/graycode.rs
1//! Links to `graycode.h`
2use libc;
3
4#[repr(C)]
5pub struct Code {
6 /// Array of Gray code entries
7 ord: *mut libc::c_int,
8 /// Increment
9 inc: *mut libc::c_int,
10}
11
12extern "C" {
13
14 /// Returns the ith Gray code entry for a gray code of length 2^l
15 ///
16 /// i: index in the Gray code table
17 /// l: Length of the Gray code
18 ///
19 /// Return: ith gray code entry
20 pub fn m4ri_gray_code(i: libc::c_int, l: libc::c_int) -> libc::c_int;
21
22 /// Fils var ord and var inc with Gray code dat afor a Gray
23 /// code of length 2^l
24 ///
25 /// ord: Will hold gray code data, must be preallocated with correct size
26 /// inc: Will hold some increment data, must be preallocated with correct size
27 /// l: logarithm of the length of Gray code
28 pub fn m4ri_build_code(ord: *mut libc::c_int, inc: *mut libc::c_int, l: libc::c_int);
29
30 /// Generates global code book
31 ///
32 /// This function is called automatically when the shared library is loaded
33 ///
34 /// Not thread safe!
35 pub fn m4ri_build_all_codes();
36
37 /// Destroy global code book
38 ///
39 /// This function is called automatically when the shared library is unloaded
40 ///
41 /// Not thread safe
42 pub fn m4ri_destroy_all_codes();
43
44 /// Return the optimal var `k` for the given parameters
45 ///
46 /// If var c != 0, then var k for multiplication is returned,
47 /// else var k for inversion. The optimal var k here means $0.75 log_2(n)$
48 /// where `n` is `min(a,b)` for inversion and
49 /// `b` for multiplication.
50 ///
51 /// a: Number of rows of (first) matrix
52 /// b: Number of columns of (first) matrix
53 /// c: Number of columns of second matrix (may be 0)
54 ///
55 /// Returns k
56 pub fn m4ri_opt_k(a: libc::c_int, b: libc::c_int, c: libc::c_int) -> libc::c_int;
57}