| 83 | |
| 84 | template <typename T> |
| 85 | static inline void quantize_qg_batch( |
| 86 | const T* data, |
| 87 | const T* centroid, |
| 88 | size_t num, |
| 89 | size_t padded_dim, |
| 90 | char* batch_data, |
| 91 | MetricType metric_type = METRIC_L2 |
| 92 | ) { |
| 93 | std::vector<T> f_error(fastscan::kBatchSize); // we dont need this factor for qg |
| 94 | QGBatchDataMap<T> cur_batch(batch_data, padded_dim); |
| 95 | |
| 96 | rabitq_impl::one_bit::one_bit_batch_code<T>( |
| 97 | data, |
| 98 | centroid, |
| 99 | num, |
| 100 | padded_dim, |
| 101 | cur_batch.bin_code(), |
| 102 | cur_batch.f_add(), |
| 103 | cur_batch.f_rescale(), |
| 104 | f_error.data(), |
| 105 | metric_type |
| 106 | ); |
| 107 | } |
| 108 | |
| 109 | template <typename T> |
| 110 | static inline void quantize_qg_batch( |