ogposets.OgPoset
- class rewalt.ogposets.OgPoset(face_data, coface_data, **params)
Bases:
objectClass for oriented graded posets, that is, finite graded posets with an orientation, defined as a
{'-', '+'}-labelling of the edges of their Hasse diagram.In this implementation, the elements of a given dimension (grade) are linearly ordered, so that each element is identified by its dimension and the position in the linear order, encoded as an object of class
El.If
El(n, k)coversEl(n-1, j)with orientationo, we say thatEl(n-1, j)is an input face ofEl(n, k)ifo == '-'and an output face ofEl(n, k)ifo == '+'.Defining an
OgPosetdirectly is not recommended; use constructors ofshapes.Shapeinstead.- Parameters
face_data (
list[list[dict[set[int]]]]) – Data encoding the oriented graded poset as follows:j in face_data[n][k][o]if and only ifEl(n, k)coversEl(n-1, j)with orientationo, whereo == '-'oro == '+'.coface_data (
list[list[dict[set[int]]]]) – Data encoding the oriented graded poset as follows:j in coface_data[n][k][o]if and only ifEl(n+1, j)coversEl(n, k)with orientationo, whereo == '-'oro == '+'.
- Keyword Arguments
wfcheck (
bool) – Check that the data is well-formed (default isTrue)matchcheck (
bool) – Check that face_data and coface_data match (default isTrue)
Notes
Each of face_data, coface_data determines the other uniquely. There is an alternative constructor
from_face_data()that computes coface_data from face_data.Examples
Let us construct explicitly the “oriented face poset” of an arrow, or directed edge.
>>> face_data = [ ... [ ... {'-': set(), '+': set()}, ... {'-': set(), '+': set()}, ... ], [ ... {'-': {0}, '+': {1}} ... ]] >>> coface_data = [ ... [ ... {'-': {0}, '+': set()}, ... {'-': set(), '+': {0}}, ... ], [ ... {'-': set(), '+': set()} ... ]] >>> arrow = OgPoset(face_data, coface_data)
This has two 0-dimensional elements and one 1-dimensional element.
>>> arrow.size [2, 1]
We can visualise its Hasse diagram, with orientation conveyed by colour (magenta for input, blue for output) and direction of arrows.
>>> arrow.hasse(path='docs/_static/img/OgPoset_arrow.png')
We can ask for the faces and cofaces of a specific element.
>>> arrow.faces(El(1, 0), '-') GrSet(El(0, 0)) >>> arrow.cofaces(El(0, 1)) GrSet(El(1, 0))
We can construct other oriented graded posets using various operations, such as suspensions, Gray products, joins, or duals.
>>> print(arrow.suspend()) OgPoset with [2, 2, 1] elements >>> print(arrow * arrow) OgPoset with [4, 4, 1] elements >>> print(arrow >> arrow) OgPoset with [4, 6, 4, 1] elements >>> print(arrow.dual()) OgPoset with [2, 1] elements
Methods
all()Returns the closed subset of all elements.
bot()Returns the object augmented with a bottom element, covered with orientation
'+'.boundary([sign, dim])Returns the inclusion of the boundary of a given orientation and dimension into the object.
co()Returns the
dual()in all even dimensions.cofaces(element[, sign])Returns the cofaces of an element as a graded set.
coproduct(fst, snd)Returns the coproduct cospan of two oriented graded posets.
disjoint_union(fst, snd)Returns the disjoint union of two oriented graded posets, that is, the target of their coproduct cospan.
dual(ogp, *dims)Returns an oriented graded poset with orientations reversed in given dimensions.
empty()Returns the initial oriented graded poset, with no elements.
faces(element[, sign])Returns the faces of an element as a graded set.
from_face_data(face_data, **params)Alternative constructor computing coface_data from face_data.
gray(*ogps)Returns the Gray product of any number of oriented graded posets.
hasse(**params)Bound version of
hasse.draw().id()Returns the identity map on the object.
image(ogmap)Returns the image of the object through a map.
join(*ogps)Returns the join of any number of oriented graded posets.
maximal()Returns the subset of maximal elements, that is, those that are not covered by any elements.
none()Returns the empty closed subset.
op()Returns the
dual()in all odd dimensions.point()Returns the terminal oriented graded poset, with a single element.
suspend(ogp[, n])Returns the n-fold suspension of an oriented graded poset.
underset(*elements)Returns the closure of a set of elements in the object.
Attributes
Returns a "chain complex" representation of the face data.
Returns the coface data as given to the object constructor.
Returns the dimension of the object, that is, the maximum of the dimensions of its elements.
Returns the face data as given to the object constructor.
Alias for
boundary('-').Alias for
boundary('+').Returns the number of elements in each dimension as a list.
- property face_data
Returns the face data as given to the object constructor.
An
OgPosetis meant to be immutable; create a new object if you need to modify the face data.- Returns
face_data – The face data as given to the object constructor.
- Return type
list[list[dict[set[int]]]]
- property coface_data
Returns the coface data as given to the object constructor.
An
OgPosetis meant to be immutable; create a new object if you need to modify the coface data.- Returns
coface_data – The coface data as given to the object constructor.
- Return type
list[list[dict[set[int]]]]
- property size
Returns the number of elements in each dimension as a list.
- Returns
size – The
kth entry is the number ofk-dimensional elements.- Return type
list[int]
- property dim
Returns the dimension of the object, that is, the maximum of the dimensions of its elements.
- Returns
dim – The dimension of the object.
- Return type
int
- property as_chain
Returns a “chain complex” representation of the face data.
- Returns
chain – Encodes the face data as follows:
chain[n][i][j] == 1ifEl(n, i)is an output face ofEl(n+1, j),-1if it is an input face,0otherwise.- Return type
list[numpy.array]
- all()
Returns the closed subset of all elements.
- Returns
all – The closed subset of all elements of the object.
- Return type
- none()
Returns the empty closed subset.
- Returns
none – The closed subset with no elements.
- Return type
- underset(*elements)
Returns the closure of a set of elements in the object.
- maximal()
Returns the subset of maximal elements, that is, those that are not covered by any elements.
- Returns
maximal – The subset of maximal elements.
- Return type
- faces(element, sign=None)
Returns the faces of an element as a graded set.
- cofaces(element, sign=None)
Returns the cofaces of an element as a graded set.
- id()
Returns the identity map on the object.
- Returns
id – The identity map on the object.
- Return type
- image(ogmap)
Returns the image of the object through a map.
- boundary(sign=None, dim=None)
Returns the inclusion of the boundary of a given orientation and dimension into the object.
- 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 inclusion of the requested boundary into the object.
- Return type
- property input
Alias for
boundary('-').
- property output
Alias for
boundary('+').
- classmethod from_face_data(face_data, **params)
Alternative constructor computing coface_data from face_data.
- Parameters
face_data (
list[list[dict[set[int]]]]) – As in the main constructor.- Keyword Arguments
wfcheck (
bool) – Check that the data is well-formed (default isTrue).
- static empty()
Returns the initial oriented graded poset, with no elements.
- Returns
empty – The empty oriented graded poset.
- Return type
- static point()
Returns the terminal oriented graded poset, with a single element.
- Returns
point – The oriented graded poset with a single element.
- Return type
- static coproduct(fst, snd)
Returns the coproduct cospan of two oriented graded posets.
- static disjoint_union(fst, snd)
Returns the disjoint union of two oriented graded posets, that is, the target of their coproduct cospan.
This method can be called with the math operator
+, that is,fst + sndis equivalent todisjoint_union(fst, snd).
- static suspend(ogp, n=1)
Returns the n-fold suspension of an oriented graded poset.
This static method can be also used as a bound method after an object is initialised, that is,
ogp.suspend(n)is equivalent tosuspend(ogp, n).
- static gray(*ogps)
Returns the Gray product of any number 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 after an object is initialised, that is,
fst.gray(*ogps)is equivalent togray(fst, *ogps).
- bot()
Returns the object augmented with a bottom element, covered with orientation
'+'.- Returns
bot – The object augmented with a bottom element.
- Return type
- static join(*ogps)
Returns the join of any number 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 after an object is initialised, that is,
fst.join(*ogps)is equivalent tojoin(fst, *ogps).
- static dual(ogp, *dims)
Returns an oriented graded poset with orientations reversed in given dimensions.
The dual in all dimensions can also be called with the bit negation operator
~, that is,~ogpis equivalent toogp.dual().This static method can be also used as a bound method after an object is initialised, that is,
ogp.dual(*dims)is equivalent todual(ogp, *dims).
- hasse(**params)
Bound version of
hasse.draw().Calling
x.hasse(**params)is equivalent to callinghasse.draw(x, **params).