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