pub struct GramMatrix { /* private fields */ }Expand description
A Gram matrix (symmetric kernel matrix) wrapper.
Wraps an Array2<f64> that is expected to be square and symmetric,
providing convenient accessors for common operations.
Implementations§
Source§impl GramMatrix
impl GramMatrix
Sourcepub fn new(data: Array2<f64>) -> Result<Self>
pub fn new(data: Array2<f64>) -> Result<Self>
Create a new Gram matrix, verifying that it is square.
Sourcepub fn is_symmetric(&self, tol: f64) -> bool
pub fn is_symmetric(&self, tol: f64) -> bool
Check if the matrix is approximately symmetric within a given tolerance.
Sourcepub fn has_nonneg_diagonal(&self) -> bool
pub fn has_nonneg_diagonal(&self) -> bool
Check if all diagonal entries are non-negative (necessary condition for PSD).
Sourcepub fn frobenius_norm(&self) -> f64
pub fn frobenius_norm(&self) -> f64
Frobenius norm: sqrt(sum of squares of all entries).
Trait Implementations§
Source§impl Clone for GramMatrix
impl Clone for GramMatrix
Source§fn clone(&self) -> GramMatrix
fn clone(&self) -> GramMatrix
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GramMatrix
impl RefUnwindSafe for GramMatrix
impl Send for GramMatrix
impl Sync for GramMatrix
impl Unpin for GramMatrix
impl UnsafeUnpin for GramMatrix
impl UnwindSafe for GramMatrix
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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