| 30 | |
| 31 | |
| 32 | BoltEncoder::BoltEncoder(int nbytes, float scaleby): |
| 33 | _nbytes(nbytes), |
| 34 | _scaleby(scaleby), |
| 35 | _offsets(2 * nbytes), |
| 36 | _lut(16, 2 * nbytes) |
| 37 | { |
| 38 | bool valid = (nbytes == 2 || nbytes == 8 || nbytes == 16 || |
| 39 | nbytes == 24 || nbytes == 32); |
| 40 | if (!valid) { |
| 41 | printf("ERROR: Received invalid nbytes %d; " |
| 42 | "must be one of {2, 8, 16, 24, 32}.", nbytes); |
| 43 | exit(1); |
| 44 | } |
| 45 | _offsets.setZero(); |
| 46 | _lut.setZero(); |
| 47 | } |
| 48 | |
| 49 | void BoltEncoder::set_offsets(const float* v, int len) { |
| 50 | _offsets.resize(len); |