pub struct FactorCache { /* private fields */ }Expand description
A cache for factor operations.
This cache stores the results of expensive factor operations to avoid recomputation. It uses a simple LRU-like eviction policy based on size limits.
Implementations§
Source§impl FactorCache
impl FactorCache
Sourcepub fn get_product(&self, f1_name: &str, f2_name: &str) -> Option<Factor>
pub fn get_product(&self, f1_name: &str, f2_name: &str) -> Option<Factor>
Get a cached product result.
Sourcepub fn put_product(&self, f1_name: &str, f2_name: &str, result: Factor)
pub fn put_product(&self, f1_name: &str, f2_name: &str, result: Factor)
Cache a product result.
Sourcepub fn get_marginalize(&self, factor_name: &str, var: &str) -> Option<Factor>
pub fn get_marginalize(&self, factor_name: &str, var: &str) -> Option<Factor>
Get a cached marginalization result.
Sourcepub fn put_marginalize(&self, factor_name: &str, var: &str, result: Factor)
pub fn put_marginalize(&self, factor_name: &str, var: &str, result: Factor)
Cache a marginalization result.
Sourcepub fn get_divide(&self, f1_name: &str, f2_name: &str) -> Option<Factor>
pub fn get_divide(&self, f1_name: &str, f2_name: &str) -> Option<Factor>
Get a cached division result.
Sourcepub fn put_divide(&self, f1_name: &str, f2_name: &str, result: Factor)
pub fn put_divide(&self, f1_name: &str, f2_name: &str, result: Factor)
Cache a division result.
Sourcepub fn get_reduce(
&self,
factor_name: &str,
var: &str,
value: usize,
) -> Option<Factor>
pub fn get_reduce( &self, factor_name: &str, var: &str, value: usize, ) -> Option<Factor>
Get a cached reduction result.
Sourcepub fn put_reduce(
&self,
factor_name: &str,
var: &str,
value: usize,
result: Factor,
)
pub fn put_reduce( &self, factor_name: &str, var: &str, value: usize, result: Factor, )
Cache a reduction result.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FactorCache
impl RefUnwindSafe for FactorCache
impl Send for FactorCache
impl Sync for FactorCache
impl Unpin for FactorCache
impl UnwindSafe for FactorCache
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.