pub struct Engram {
pub root: SparseVec,
pub codebook: HashMap<usize, SparseVec>,
pub corrections: CorrectionStore,
}Expand description
Engram: holographic encoding of a filesystem with correction guarantee
Fields§
§root: SparseVec§codebook: HashMap<usize, SparseVec>§corrections: CorrectionStoreCorrection store for 100% reconstruction guarantee
Implementations§
Source§impl Engram
impl Engram
Sourcepub fn build_codebook_index(&self) -> TernaryInvertedIndex
pub fn build_codebook_index(&self) -> TernaryInvertedIndex
Build a reusable inverted index over the codebook.
This is useful when issuing multiple queries (e.g., shift-sweeps) and you want to avoid rebuilding the index each time.
Sourcepub fn query_codebook_with_index(
&self,
index: &TernaryInvertedIndex,
query: &SparseVec,
candidate_k: usize,
k: usize,
) -> Vec<RerankedResult>
pub fn query_codebook_with_index( &self, index: &TernaryInvertedIndex, query: &SparseVec, candidate_k: usize, k: usize, ) -> Vec<RerankedResult>
Query the codebook using a pre-built inverted index.
Sourcepub fn query_codebook(&self, query: &SparseVec, k: usize) -> Vec<RerankedResult>
pub fn query_codebook(&self, query: &SparseVec, k: usize) -> Vec<RerankedResult>
Query the engram’s codebook for chunks most similar to query.
This builds an inverted index over the codebook for sub-linear candidate generation, then reranks those candidates using exact cosine similarity.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Engram
impl<'de> Deserialize<'de> for Engram
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Engram
impl RefUnwindSafe for Engram
impl Send for Engram
impl Sync for Engram
impl Unpin for Engram
impl UnwindSafe for Engram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more