pub struct Relation<K> { /* private fields */ }Expand description
A finite-support function from document ids to semiring values.
Entries are sorted by doc_id, unique by doc_id, and never store the
semiring zero value.
Implementations§
Source§impl<K> Relation<K>
impl<K> Relation<K>
Sourcepub fn entries(&self) -> &[RelationEntry<K>]
pub fn entries(&self) -> &[RelationEntry<K>]
Borrow the sorted non-zero entries.
Sourcepub fn iter(&self) -> Iter<'_, RelationEntry<K>> ⓘ
pub fn iter(&self) -> Iter<'_, RelationEntry<K>> ⓘ
Iterate over non-zero entries in document-id order.
Source§impl<K: Semiring> Relation<K>
impl<K: Semiring> Relation<K>
Sourcepub fn from_support(support: &DocSet) -> Self
pub fn from_support(support: &DocSet) -> Self
Lift a document set to its characteristic relation, assigning the semiring multiplicative identity to every supported document.
Sourcepub fn from_terms<I>(terms: I) -> Selfwhere
I: IntoIterator<Item = RelationEntry<K>>,
pub fn from_terms<I>(terms: I) -> Selfwhere
I: IntoIterator<Item = RelationEntry<K>>,
Construct from possibly unsorted terms, combining duplicate document ids with semiring addition and discarding zero results.
Trait Implementations§
Source§impl<K> IntoIterator for Relation<K>
impl<K> IntoIterator for Relation<K>
Source§impl<'a, K> IntoIterator for &'a Relation<K>
impl<'a, K> IntoIterator for &'a Relation<K>
impl<K: PartialEq> StructuralPartialEq for Relation<K>
Auto Trait Implementations§
impl<K> Freeze for Relation<K>
impl<K> RefUnwindSafe for Relation<K>where
K: RefUnwindSafe,
impl<K> Send for Relation<K>where
K: Send,
impl<K> Sync for Relation<K>where
K: Sync,
impl<K> Unpin for Relation<K>where
K: Unpin,
impl<K> UnsafeUnpin for Relation<K>
impl<K> UnwindSafe for Relation<K>where
K: UnwindSafe,
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