| 218 | } |
| 219 | |
| 220 | void check_encoding(int nrows, const ColMatrix<uint8_t>& encoding_out) { |
| 221 | |
| 222 | // number of rows in output must be a multiple of 32, and >32 would |
| 223 | // require us to rewrite this to look at indices within each block |
| 224 | // instead of letting column-major indexing handle everything for us |
| 225 | size_t nrows_out = encoding_out.rows(); |
| 226 | REQUIRE(nrows_out == 32); |
| 227 | |
| 228 | for (int i = 0; i < nrows; i++) { |
| 229 | for(int m = 0; m < 2 * M; m++) { |
| 230 | // indices are packed into upper and lower 4 bits |
| 231 | int byte = encoding_out(i, m / 2); |
| 232 | int idx = m % 2 ? byte >> 4 : byte & 0x0F; |
| 233 | REQUIRE(idx == m + (i % 5)); // i % 5 from how we designed mat |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | TEST_CASE("bolt_encode", "[mcq][bolt]") { |
| 239 | auto centroids = create_bolt_centroids(1); |