Skip to main content

read_fvecs

Function read_fvecs 

Source
pub fn read_fvecs(path: impl AsRef<Path>) -> Result<Vec<Vec<f32>>>
Expand description

Read a .fvecs file (TEXMEX corpus format) into one Vec<f32> per record.

Each on-disk record is a little-endian u32 dim followed by dim little-endian f32 payload values. A truncated trailing record returns EvalError::Parse; a record whose header claims a dimension above the internal cap of 2^20 (treated as corruption) also returns EvalError::Parse; an open or read failure returns EvalError::Io.

ยงExamples

use iqdb_eval::read_fvecs;

let rows = read_fvecs(".bench-data/siftsmall/siftsmall_base.fvecs")?;
assert!(!rows.is_empty());