Skip to main content

RestrictionMap

Trait RestrictionMap 

Source
pub trait RestrictionMap: Clone + Debug {
    type Scalar: Clone + Debug;
    type Vector: Clone + Debug;

    // Required methods
    fn in_dim(&self) -> usize;
    fn out_dim(&self) -> usize;
    fn apply(&self, x: &Self::Vector) -> Result<Self::Vector, SheafError>;
    fn apply_transpose(
        &self,
        x: &Self::Vector,
    ) -> Result<Self::Vector, SheafError>;
    fn as_matrix(&self) -> Vec<Vec<Self::Scalar>>;
    fn frobenius_norm(&self) -> Self::Scalar;
}
Expand description

A restriction map (linear transformation) on an edge.

For edge (u, v), this maps from the stalk at u to the edge space. The restriction map captures “how information flows” along the edge.

For coreference: if mentions u and v are coreferent, their stalks should map to the same point in the edge space.

Required Associated Types§

Source

type Scalar: Clone + Debug

Scalar type for the map.

Source

type Vector: Clone + Debug

Vector type for input/output.

Required Methods§

Source

fn in_dim(&self) -> usize

Input dimension (stalk dimension at source node).

Source

fn out_dim(&self) -> usize

Output dimension (edge space dimension).

Source

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>

Apply the transpose (adjoint) of the restriction map. Used in Laplacian computation.

Source

fn as_matrix(&self) -> Vec<Vec<Self::Scalar>>

Get the matrix representation (for debugging/serialization).

Source

fn frobenius_norm(&self) -> Self::Scalar

Frobenius norm of the map (for regularization).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§