pub struct CachedKernel { /* private fields */ }Expand description
Cached kernel wrapper that stores computed values
§Example
use tensorlogic_sklears_kernels::{LinearKernel, CachedKernel, Kernel};
let base_kernel = LinearKernel::new();
let mut cached = CachedKernel::new(Box::new(base_kernel));
let x = vec![1.0, 2.0, 3.0];
let y = vec![4.0, 5.0, 6.0];
// First call computes and caches
let result1 = cached.compute(&x, &y).unwrap();
// Second call retrieves from cache
let result2 = cached.compute(&x, &y).unwrap();
assert_eq!(result1, result2);
// Check cache statistics
let stats = cached.stats();
assert!(stats.hits > 0);Implementations§
Source§impl CachedKernel
impl CachedKernel
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CachedKernel
impl !RefUnwindSafe for CachedKernel
impl Send for CachedKernel
impl Sync for CachedKernel
impl Unpin for CachedKernel
impl !UnwindSafe for CachedKernel
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