pub struct Sheaf<T: Topology, C: Category> {
pub space: T,
pub restrictions: HashMap<(T::Item, T::Item), C::Morphism>,
}Expand description
Represents a sheaf over a topological space T with values in a category C.
A sheaf assigns an object from a category C to each item (e.g., open set, cell)
in a topological space T. It also defines restriction morphisms that relate
the data assigned to different items, ensuring consistency.
§Type Parameters
T: The underlying topological space, which must also implementPoset. Its items (T::Item) must beHash + Eq + Clonefor use inHashMapkeys.C: The targetCategorywhere the data (stalks/sections) of the sheaf reside. Objects of this category (C) must beClone + Eq + Debug(ifis_global_sectionis used). Morphisms (C::Morphism) must beClone + Debug.
Fields§
§space: TThe underlying topological space (e.g., a cell complex, an ordered set of open sets).
This space also implements Poset to define relationships (e.g., sub-item/super-item)
between its items.
restrictions: HashMap<(T::Item, T::Item), C::Morphism>A map defining the restriction morphisms of the sheaf.
For a key (parent_item, child_item) where parent_item <= child_item according to the
poset structure of T, the associated value C::Morphism is the restriction map
from the data on child_item to the data on parent_item.
That is, $\rho_{\text{parent_item}, \text{child_item}}: F(\text{child_item}) \to
F(\text{parent_item})$.
Implementations§
Source§impl<T, C> Sheaf<T, C>
impl<T, C> Sheaf<T, C>
Sourcepub fn new(
space: T,
restrictions: HashMap<(T::Item, T::Item), C::Morphism>,
) -> Self
pub fn new( space: T, restrictions: HashMap<(T::Item, T::Item), C::Morphism>, ) -> Self
Creates a new sheaf from a given topological space and a set of restriction maps.
The provided restrictions map should contain morphisms for all relevant pairs
of items $(U, V)$ in the space T where $U \le V$. The constructor asserts that
for every key (k.0, k.1) in restrictions, the relation space.leq(&k.0, &k.1) holds.
Here, k.0 is treated as the parent (smaller item) and k.1 as the child (larger item).
The restriction map is from $F(k.1)$ to $F(k.0)$.
§Arguments
space: The topological spaceTwhich also implementsPoset.restrictions: AHashMapwhere keys are(parent_item, child_item)tuples fromT::Item(such thatparent_item <= child_item), and values are the corresponding restriction morphisms $F(\text{child_item}) \to F(\text{parent_item})$ of typeC::Morphism.
§Panics
- Panics if any key
(parent, child)inrestrictionsdoes not satisfyspace.leq(&parent, &child) == Some(true). This includes cases wherespace.leqreturnsSome(false)(relation does not hold) orNone(incomparable).
§TODO
- Implement a builder API for more robust construction, ensuring all necessary restrictions are defined (e.g., for all successor relationships in the poset, and identity maps for $U \le U$).
- Add validation for compatibility of restriction maps (e.g., identity $\text{res}{U,U} = \text{id}{F(U)}$ and composition $\text{res}{W,V} \circ \text{res}{V,U} = \text{res}_{W,U}$ axioms).
- For specific categories (e.g., matrices as morphisms), check dimensional compatibility of morphisms.
Sourcepub fn restrict(
&self,
parent_target_item: &T::Item,
child_source_item: &T::Item,
section_data_on_child: C,
) -> C
pub fn restrict( &self, parent_target_item: &T::Item, child_source_item: &T::Item, section_data_on_child: C, ) -> C
Restricts data from a larger item to a smaller item using the sheaf’s restriction map.
Given a parent_target_item $U$ and a child_source_item $V$ such that $U \le V$,
this function retrieves the restriction morphism $\rho_{UV}: F(V) \to F(U)$ from the sheaf’s
definition (stored under the key (parent_target_item, child_source_item)).
It then retrieves the data $s_V \in F(V)$ corresponding to child_source_item from the
provided section data. Finally, it applies the morphism to compute $s_U = \rho_{UV}(s_V)$,
which is the data on $U$ restricted from $V$.
§Arguments
parent_target_item: The smaller item $U$ to which data is being restricted.child_source_item: The larger item $V$ from which data is being restricted. Must satisfyparent_target_item <= child_source_item.section_data_on_child: The data object $s_V \in F(V)$ associated withchild_source_item.
§Returns
The restricted data $s_U \in F(U)$, result of applying the restriction map.
§Panics
- Panics if
parent_target_item <= child_source_itemis false or if they are incomparable, as asserted byself.space.leq. - Panics if the restriction map for
(parent_target_item, child_source_item)is not found inself.restrictions.
Sourcepub fn is_global_section(&self, section: &HashMap<T::Item, C>) -> bool
pub fn is_global_section(&self, section: &HashMap<T::Item, C>) -> bool
Checks if a given section is a global section of the sheaf.
A section $s = {s_X}_{X \in T}$ is a global section if for every pair of items
(parent_item, child_item) in self.restrictions (which implies parent_item <= child_item), the restriction of the data on child_item to parent_item is equal to the
data already on parent_item.
That is, for each stored morphism $\rho_{\text{parent}, \text{child}}: F(\text{child_item})
\to F(\text{parent_item})$, it must hold that $\rho_{\text{parent},
\text{child}}(s_{\text{child_item}}) = s_{\text{parent_item}}$, where $s_{
text{child_item}}$ is section.get(child_item) and $s_{\text{parent_item}}$ is
section.get(parent_item).
§Arguments
section: AHashMapwhere keys are itemsT::Itemfrom the space and values are data objects of typeC(from the target category), representing $s_X$ for each $X$.
§Returns
trueif thesectionsatisfies the global section condition for all defined restrictions.falseif any restriction condition is violated, or if data for a required item (involved in a restriction) is missing from thesection.
Source§impl<T, F: Field + Copy> Sheaf<Complex<T>, DynamicVector<F>>
impl<T, F: Field + Copy> Sheaf<Complex<T>, DynamicVector<F>>
Sourcepub fn coboundary(&self, dimension: usize) -> BlockMatrix<F, RowMajor>
pub fn coboundary(&self, dimension: usize) -> BlockMatrix<F, RowMajor>
Constructs the coboundary matrix δ^k: C^k → C^(k+1) for the sheaf.
The coboundary map is dual to the boundary map of the underlying complex. For dimension k, this maps k-cochains (sections over k-dimensional elements) to (k+1)-cochains (sections over (k+1)-dimensional elements).
The matrix has:
- Rows indexed by (k+1)-dimensional elements
- Columns indexed by k-dimensional elements
- Entry (σ, τ) equals the orientation coefficient of τ in ∂σ where σ is (k+1)-dimensional and τ is k-dimensional
§Arguments
dimension: The dimension k of the domain (k-cochains)
§Returns
A block matrix representing δ^k: C^k → C^(k+1)
Auto Trait Implementations§
impl<T, C> Freeze for Sheaf<T, C>where
T: Freeze,
impl<T, C> RefUnwindSafe for Sheaf<T, C>where
T: RefUnwindSafe,
<C as Category>::Morphism: RefUnwindSafe,
<T as Collection>::Item: RefUnwindSafe,
impl<T, C> Send for Sheaf<T, C>
impl<T, C> Sync for Sheaf<T, C>
impl<T, C> Unpin for Sheaf<T, C>
impl<T, C> UnwindSafe for Sheaf<T, C>
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
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>
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>
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