pub struct DenseRestriction {
pub data: Vec<f32>,
pub rows: usize,
pub cols: usize,
}Expand description
Simple restriction map using a dense matrix.
Fields§
§data: Vec<f32>Matrix data in row-major order.
rows: usizeNumber of rows (output dimension).
cols: usizeNumber of columns (input dimension).
Implementations§
Source§impl DenseRestriction
impl DenseRestriction
Sourcepub fn new(data: Vec<f32>, rows: usize, cols: usize) -> Result<Self, SheafError>
pub fn new(data: Vec<f32>, rows: usize, cols: usize) -> Result<Self, SheafError>
Create a new restriction map.
Sourcepub fn identity(dim: usize) -> Self
pub fn identity(dim: usize) -> Self
Create an identity restriction (for same-dimension stalks).
Sourcepub fn random_orthogonal(dim: usize) -> Self
Available on crate feature rand only.
pub fn random_orthogonal(dim: usize) -> Self
rand only.Create a random orthogonal restriction map.
Uses QR decomposition of random matrix. Useful for connection Laplacians.
Trait Implementations§
Source§impl Clone for DenseRestriction
impl Clone for DenseRestriction
Source§fn clone(&self) -> DenseRestriction
fn clone(&self) -> DenseRestriction
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 moreSource§impl Debug for DenseRestriction
impl Debug for DenseRestriction
Source§impl RestrictionMap for DenseRestriction
impl RestrictionMap for DenseRestriction
Source§fn apply(&self, x: &Self::Vector) -> Result<Self::Vector, SheafError>
fn apply(&self, x: &Self::Vector) -> Result<Self::Vector, SheafError>
Apply the restriction map to a stalk vector.
Source§fn apply_transpose(&self, x: &Self::Vector) -> Result<Self::Vector, SheafError>
fn apply_transpose(&self, x: &Self::Vector) -> Result<Self::Vector, SheafError>
Apply the transpose (adjoint) of the restriction map.
Used in Laplacian computation.
Source§fn as_matrix(&self) -> Vec<Vec<Self::Scalar>>
fn as_matrix(&self) -> Vec<Vec<Self::Scalar>>
Get the matrix representation (for debugging/serialization).
Source§fn frobenius_norm(&self) -> Self::Scalar
fn frobenius_norm(&self) -> Self::Scalar
Frobenius norm of the map (for regularization).
Auto Trait Implementations§
impl Freeze for DenseRestriction
impl RefUnwindSafe for DenseRestriction
impl Send for DenseRestriction
impl Sync for DenseRestriction
impl Unpin for DenseRestriction
impl UnsafeUnpin for DenseRestriction
impl UnwindSafe for DenseRestriction
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