ogposets.OgMap
- class rewalt.ogposets.OgMap(source, target, mapping=None, **params)
Bases:
objectClass for (partial) maps of oriented graded posets, compatible with boundaries.
To define a map on one element, it must have been defined on all elements below it. The assignment can be made all at once, or element by element. Once the map has been defined on an element, the assignment cannot be modified.
- Parameters
source (
OgPoset) – The source (domain) of the map.target (
OgPoset) – The target (codomain) of the map.mapping (
list[list[El]], optional) – Data specifying the partial map as follows:mapping[n][k] == El(m, j)if the map sendsEl(n, k)toEl(m, j), andNoneif the map is undefined onEl(n, k)(default is the nowhere defined map).
- Keyword Arguments
wfcheck (
bool) – Check whether the data defines a well-formed map compatible with all boundaries (default isTrue).
Notes
Objects of the class are callable on objects of type
El(returning the image of an element) and of typeGrSubsetandGrSet(returning the image of a subset of their source).Examples
Let us create two simple oriented graded posets, the “point” and the “arrow”.
>>> point = OgPoset.point() >>> arrow = point >> point
We define the map that collapses the arrow onto the point. First we create a nowhere defined map.
>>> collapse = OgMap(arrow, point) >>> assert not collapse.istotal
We declare the assignment first on the 0-dimensional elements, then on the single 1-dimensional element. Trying to do otherwise results in a
ValueError.>>> collapse[El(0, 0)] = El(0, 0) >>> collapse[El(0, 1)] = El(0, 0) >>> collapse[El(1, 0)] = El(0, 0)
We can check various properties of the map.
>>> assert collapse.istotal >>> assert collapse.issurjective >>> assert not collapse.isinjective
Alternatively, we could have defined the map all at once, as follows.
>>> mapping = [[El(0, 0), El(0, 0)], [El(0, 0)]] >>> assert collapse == OgMap(arrow, point, mapping)
Methods
bot()Functorial extension of
OgPoset.bot()to maps.boundary([sign, dim])Returns the map restricted to a specified boundary of its source.
co()Returns the dual in all even dimensions.
dual(ogmap, *dims)Functorial extension of
OgPoset.dual()to maps of oriented graded posets.gray(*maps)Functorial extension of
OgPoset.gray()to maps of oriented graded posets.hasse(**params)Bound version of
hasse.draw().image()Returns the image of the map.
inv()Returns the inverse of the map if it is an isomorphism.
isdefined(element)Returns whether the map is defined on a given element.
join(*maps)Functorial extension of
OgPoset.join()to maps of oriented graded posets.op()Returns the dual in all odd dimensions.
then(other, *others)Returns the composite with other maps or pairs of maps of oriented graded posets, when defined.
Attributes
Alias for
boundary('-').Returns whether the map is injective.
Returns whether the map is an isomorphism, that is, total, injective, and surjective.
Returns whether the map is surjective.
Returns whether the map is total.
Returns the data specifying the map's assignments.
Alias for
boundary('+').Returns the source (domain) of the map.
Returns the target (codomain) of the map.
- property source
Returns the source (domain) of the map.
- Returns
source – The source of the map.
- Return type
- property target
Returns the target (codomain) of the map.
- Returns
target – The target of the map.
- Return type
- property mapping
Returns the data specifying the map’s assignments.
- Returns
mapping – The mapping data.
- Return type
list[list[El]]
- property istotal
Returns whether the map is total.
- Returns
istotal –
Trueif and only if the map is total.- Return type
bool
- property isinjective
Returns whether the map is injective.
- Returns
isinjective –
Trueif and only if the map is injective.- Return type
bool
- property issurjective
Returns whether the map is surjective.
- Returns
issurjective –
Trueif and only if the map is surjective.- Return type
bool
- property isiso
Returns whether the map is an isomorphism, that is, total, injective, and surjective.
- Returns
isiso –
Trueif and only if the map is an isomorphism.- Return type
bool
- isdefined(element)
Returns whether the map is defined on a given element.
- Parameters
element (
El) – The element to check.- Returns
isdefined –
Trueif and only if the map is defined on the element.- Return type
bool
- then(other, *others)
Returns the composite with other maps or pairs of maps of oriented graded posets, when defined.
If given an
OgMapPairas argument, it returns the pair of composites of the map with each map in the pair.- Parameters
- Returns
composite – The composite with all the other arguments.
- Return type
Notes
If all the maps have type
shapes.ShapeMap, their composite has the same type.
- inv()
Returns the inverse of the map if it is an isomorphism.
- Returns
inv – The inverse of the map, if defined.
- Return type
- Raises
ValueError – If the map is not an isomorphism.
- image()
Returns the image of the map.
- Returns
image – The image of the source through the map.
- Return type
- boundary(sign=None, dim=None)
Returns the map restricted to a specified boundary of its source.
- Parameters
sign (
str, optional) – Orientation:'-'for input,'+'for output,None(default) for both.dim (
int, optional) – Dimension of the boundary (default isself.dim - 1).
- Returns
boundary – The map restricted to the requested boundary.
- Return type
- property input
Alias for
boundary('-').
- property output
Alias for
boundary('+').
- bot()
Functorial extension of
OgPoset.bot()to maps.- Returns
bot – The map extended to a map from
source.bottotarget.bot.- Return type
OgMap
- static gray(*maps)
Functorial extension of
OgPoset.gray()to maps of oriented graded posets.This method can be called with the math operator
*, that is,fst * sndis equivalent togray(fst, snd).This static method can also be used as a bound method, that is,
fst.gray(*maps)is equivalent togray(fst, *maps).- Parameters
*maps (
OgMap) – Any number of maps of oriented graded posets.- Returns
gray – The Gray product of the arguments.
- Return type
Notes
If all the arguments have type
shapes.ShapeMap, so does their Gray product.
- static join(*maps)
Functorial extension of
OgPoset.join()to maps of oriented graded posets.This method can be called with the shift operators
>>and<<, that is,fst >> sndis equivalent tojoin(fst, snd)andfst << sndis equivalent tojoin(snd, fst).This static method can also be used as a bound method, that is,
fst.join(*maps)is equivalent tojoin(fst, *maps).- Parameters
*maps (
OgMap) – Any number of maps of oriented graded posets.- Returns
join – The join of the arguments.
- Return type
Notes
If all the arguments have type
shapes.ShapeMap, so does their join.
- static dual(ogmap, *dims)
Functorial extension of
OgPoset.dual()to maps of oriented graded posets.The dual in all dimensions can also be called with the negation operator
~, that is,~ogmapis equivalent toogmap.dual().This static method can be also used as a bound method, that is,
self.dual(*dims)is equivalent todual(self, *dims).- Parameters
ogmap (
OgMap) – A map of oriented graded posets.*dims (
int) – Any number of dimensions; if none, defaults to all dimensions.
- Returns
dual – The map dualised in the given dimensions.
- Return type
Notes
If the map is a
ShapeMap, so is its dual.
- op()
Returns the dual in all odd dimensions.
- co()
Returns the dual in all even dimensions.
- hasse(**params)
Bound version of
hasse.draw().Calling
f.hasse(**params)is equivalent to callinghasse.draw(f, **params).