m4ri_sys/brilliantrussian.rs
1use crate::misc::Rci;
2use crate::mzd::Mzd;
3/// See `brilliantrussian.h`
4use libc;
5
6extern "C" {
7
8 /// Constructs all possible 2^k row combinations using the
9 /// gray code table
10 ///
11 /// M: matrix to generate tables from
12 /// r: starting row
13 /// c: starting column
14 /// k
15 /// T: preallocated matrix of dimension 2^k x m->ncols
16 /// L: preallocated table of length 2^k
17 pub fn mzd_make_table(m: *const Mzd, r: Rci, c: Rci, k: libc::c_int, t: *mut Mzd, l: *mut Rci);
18
19 /// The function looks up k bits from position i, startcol in each
20 /// row and adds the appropriate row from T to the row i
21 ///
22 /// This process is iterated for i from startrow to stoprow (exclusive)
23 ///
24 /// M: Matrix to operate on
25 /// startrow: top row which is operated on
26 /// endrow: bottom row which is operated on
27 /// k: M4RI parameter
28 /// T: contains the correct row to be added
29 /// L: contains row number to be added
30 pub fn mzd_process_rows(
31 m: *mut Mzd,
32 startrow: Rci,
33 endrow: Rci,
34 startcol: Rci,
35 k: libc::c_int,
36 t: *const Mzd,
37 l: *const Rci,
38 );
39
40 /// Same as `mzd_process_rows` but works with two Gray code
41 /// tables in parallel
42 ///
43 /// m: Matrix to operate on
44 /// startrow: top row hich is operated on
45 /// startcol: starting column for addition
46 /// k: M4ri param
47 /// T0: contains the correct row to be added
48 /// L0: contains row number to be added
49 /// T1: contains the correct row to be added
50 /// L1: contains the row number to be added
51 pub fn mzd_process_rows2(
52 m: *mut Mzd,
53 startrow: Rci,
54 endrow: Rci,
55 startcol: Rci,
56 k: libc::c_int,
57 t0: *const Mzd,
58 l0: *const Rci,
59 t1: *const Mzd,
60 l1: *const Rci,
61 );
62
63 /// Same as `mzd_process_rows` but works with three Gray code
64 /// tables in parallel
65 ///
66 /// m: Matrix to operate on
67 /// startrow: top row hich is operated on
68 /// startcol: starting column for addition
69 /// k: M4ri param
70 /// T0: contains the correct row to be added
71 /// L0: contains row number to be added
72 /// T1: contains the correct row to be added
73 /// L1: contains the row number to be added
74 /// T2: contains the correct row to be added
75 /// L2: contains the row number to be added
76 pub fn mzd_process_rows3(
77 m: *mut Mzd,
78 startrow: Rci,
79 endrow: Rci,
80 startcol: Rci,
81 k: libc::c_int,
82 t0: *const Mzd,
83 l0: *const Rci,
84 t1: *const Mzd,
85 l1: *const Rci,
86 t2: *const Mzd,
87 l2: *const Rci,
88 );
89
90 /// Same as `mzd_process_rows` but works with four Gray code
91 /// tables in parallel
92 ///
93 /// m: Matrix to operate on
94 /// startrow: top row hich is operated on
95 /// startcol: starting column for addition
96 /// k: M4ri param
97 /// T0: contains the correct row to be added
98 /// L0: contains row number to be added
99 /// T1: contains the correct row to be added
100 /// L1: contains the row number to be added
101 /// T2: contains the correct row to be added
102 /// L2: contains the row number to be added
103 /// T3: contains the correct row to be added
104 /// L3: contains the row number to be added
105 pub fn mzd_process_rows4(
106 m: *mut Mzd,
107 startrow: Rci,
108 endrow: Rci,
109 startcol: Rci,
110 k: libc::c_int,
111 t0: *const Mzd,
112 l0: *const Rci,
113 t1: *const Mzd,
114 l1: *const Rci,
115 t2: *const Mzd,
116 l2: *const Rci,
117 t3: *const Mzd,
118 l3: *const Rci,
119 );
120
121 /// Same as `mzd_process_rows` but works with five Gray code
122 /// tables in parallel
123 ///
124 /// m: Matrix to operate on
125 /// startrow: top row hich is operated on
126 /// startcol: starting column for addition
127 /// k: M4ri param
128 /// T0: contains the correct row to be added
129 /// L0: contains row number to be added
130 /// T1: contains the correct row to be added
131 /// L1: contains the row number to be added
132 /// T2: contains the correct row to be added
133 /// L2: contains the row number to be added
134 /// T3: contains the correct row to be added
135 /// L3: contains the row number to be added
136 /// T4: contains the correct row to be added
137 /// L4: contains the row number to be added
138 pub fn mzd_process_rows5(
139 m: *mut Mzd,
140 startrow: Rci,
141 endrow: Rci,
142 startcol: Rci,
143 k: libc::c_int,
144 t0: *const Mzd,
145 l0: *const Rci,
146 t1: *const Mzd,
147 l1: *const Rci,
148 t2: *const Mzd,
149 l2: *const Rci,
150 t3: *const Mzd,
151 l3: *const Rci,
152 t4: *const Mzd,
153 l4: *const Rci,
154 );
155
156 /// Same as `mzd_process_rows` but works with six Gray code
157 /// tables in parallel
158 ///
159 /// m: Matrix to operate on
160 /// startrow: top row hich is operated on
161 /// startcol: starting column for addition
162 /// k: M4ri param
163 /// T0: contains the correct row to be added
164 /// L0: contains row number to be added
165 /// T1: contains the correct row to be added
166 /// L1: contains the row number to be added
167 /// T2: contains the correct row to be added
168 /// L2: contains the row number to be added
169 /// T3: contains the correct row to be added
170 /// L3: contains the row number to be added
171 /// T4: contains the correct row to be added
172 /// L4: contains the row number to be added
173 /// T5: contains the correct row to be added
174 /// L5: contains the row number to be added
175 pub fn mzd_process_rows6(
176 m: *mut Mzd,
177 startrow: Rci,
178 endrow: Rci,
179 startcol: Rci,
180 k: libc::c_int,
181 t0: *const Mzd,
182 l0: *const Rci,
183 t1: *const Mzd,
184 l1: *const Rci,
185 t2: *const Mzd,
186 l2: *const Rci,
187 t3: *const Mzd,
188 l3: *const Rci,
189 t4: *const Mzd,
190 l4: *const Rci,
191 t5: *const Mzd,
192 l5: *const Rci,
193 );
194
195 /// Matrix elimination using the Method of the four russians (m4ri)
196 ///
197 /// M: Matrix to be reduced
198 /// k: M4ri parameter, may be 0 for auto-choose
199 pub fn mzd_top_echelonize_m4ri(m: *mut Mzd, k: libc::c_int);
200
201 /// Invert the matrix using Konrod's method
202 ///
203 /// dst: Matrix to hold the inverse (may be Null)
204 /// src: Matrix to be inverted
205 /// k: table size parameter, set 0 for automatic choice
206 ///
207 /// Return inverse of src if src has full rank
208 pub fn mzd_inv_m4ri(dst: *mut Mzd, src: *const Mzd, k: libc::c_int) -> *mut Mzd;
209
210 /// Matrix multiplication using Konrods Method
211 ///
212 /// c: preallocated product matrix, may be NULL for automatic creation
213 /// a: input matrix
214 /// b: input matrix
215 /// k: M4RI parameter, may be 0 for automatic choice
216 pub fn mzd_mul_m4rm(c: *mut Mzd, a: *const Mzd, b: *const Mzd, k: libc::c_int) -> *mut Mzd;
217
218 /// Set C to C + AB using Konrods Method
219 ///
220 /// c: input and result matrix
221 /// a: input matrix
222 /// b: input matrix
223 /// k: M4RI parameter, may be 0 for automatic choice
224 pub fn mzd_addmul_m4rm(c: *mut Mzd, a: *const Mzd, b: *const Mzd, k: libc::c_int) -> *mut Mzd;
225}