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

Function identity

nodedb-codec/src/vector_quant/opq.rs:182–188  ·  view source on GitHub ↗

Return a dim×dim row-major identity matrix.

(dim: usize)

Source from the content-addressed store, hash-verified

180
181/// Return a dim×dim row-major identity matrix.
182fn identity(dim: usize) -> Vec<f32> {
183 let mut mat = vec![0.0f32; dim * dim];
184 for i in 0..dim {
185 mat[i * dim + i] = 1.0;
186 }
187 mat
188}
189
190/// Dequantize PQ codes into a reconstructed vector in rotated space.
191fn dequantize_codes(codes: &[u8], codebooks: &[Vec<Vec<f32>>]) -> Vec<f32> {

Callers 1

trainMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected