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§
Required Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn as_matrix(&self) -> Vec<Vec<Self::Scalar>>
fn as_matrix(&self) -> Vec<Vec<Self::Scalar>>
Get the matrix representation (for debugging/serialization).
Sourcefn frobenius_norm(&self) -> Self::Scalar
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.