MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / asymmetric_ip

Method asymmetric_ip

nodedb-vector/src/quantize/sq8.rs:169–178  ·  view source on GitHub ↗
(&self, query: &[f32], candidate: &[u8])

Source from the content-addressed store, hash-verified

167 /// Asymmetric negative inner product: query (FP32) vs candidate (INT8).
168 #[inline]
169 pub fn asymmetric_ip(&self, query: &[f32], candidate: &[u8]) -> f32 {
170 debug_assert_eq!(query.len(), self.dim);
171 debug_assert_eq!(candidate.len(), self.dim);
172 let mut dot = 0.0f32;
173 for d in 0..self.dim {
174 let dequant = self.mins[d] + candidate[d] as f32 * self.scales[d];
175 dot += query[d] * dequant;
176 }
177 -dot
178 }
179
180 /// Dimension count.
181 pub fn dim(&self) -> usize {

Callers 1

sq8_scoreFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected