| 116 | } |
| 117 | |
| 118 | void check_encoding(int nrows, const RowMatrix<uint8_t>& encoding_out) { |
| 119 | for (int i = 0; i < nrows; i++) { |
| 120 | for(int m = 0; m < 2 * M; m++) { |
| 121 | // indices are packed into upper and lower 4 bits |
| 122 | int byte = encoding_out(i, m / 2); |
| 123 | int idx = m % 2 ? byte >> 4 : byte & 0x0F; |
| 124 | REQUIRE(idx == m + (i % 5)); // i % 5 from how we designed mat |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | TEST_CASE("bolt_encode", "[mcq][bolt]") { |
| 130 | auto centroids = create_bolt_centroids(1); |