sign_vectors.functions¶
Functions for working with oriented matroids
Functions
|
Return all sign vectors or vectors that are zero on given components. |
|
Remove given components from an iterable of sign vectors |
|
Compute the lower closure of given sign vectors. |
|
Plot the Hasse Diagram of sign vectors using the conformal relation. |
|
Compute the upper closure of given sign vectors. |
- sign_vectors.functions.contraction(iterable: set[sign_vectors.sign_vectors.SignVector], indices: list[int]) set[sign_vectors.sign_vectors.SignVector]¶
Return all sign vectors or vectors that are zero on given components.
INPUT:
iterable– an iterable of sign vectors or vectorsindices– a list of indices.
OUTPUT:
If
keep_componentsis false, remove entries inindices. (default)If
keep_componentsis true, keep entries inindices.
EXAMPLES:
sage: from sign_vectors import * sage: W = [sign_vector("++0"), sign_vector("-00"), sign_vector("00+")] sage: W [(++0), (-00), (00+)]
Only the third sign vector has a zero at the component with index
0. Removing this component leads to the following result:sage: contraction(W, [0]) {(0+)} sage: contraction(W, [1]) {(-0), (0+)} sage: contraction(W, [2]) {(-0), (++)}
The second sign vector has zeros at positions
1and2:sage: contraction(W, [1, 2]) {(-)}
- sign_vectors.functions.deletion(iterable: set[sign_vectors.sign_vectors.SignVector], indices: list[int]) set[sign_vectors.sign_vectors.SignVector]¶
Remove given components from an iterable of sign vectors
INPUT:
iterable– an iterable of sign vectorsindices– a list of indices
EXAMPLES:
sage: from sign_vectors import * sage: W = [sign_vector("++0"), sign_vector("00-"), sign_vector("+00")] sage: W [(++0), (00-), (+00)] sage: deletion(W, [0]) {(00), (+0), (0-)}
Duplicate sign vectors are removed if they would occur:
sage: deletion(W, [1]) {(+0), (0-)} sage: deletion(W, [1, 2]) {(0), (+)}
- sign_vectors.functions.lower_closure(iterable: set[sign_vectors.sign_vectors.SignVector]) set[sign_vectors.sign_vectors.SignVector]¶
Compute the lower closure of given sign vectors.
INPUT:
iterable– an iterable of sign vectors
OUTPUT: Return the lower closure of
iterableas a set of sign vectors.Note
The sign vector \(X\) is in the lower closure of a set of sign vectors \(W\) if there exists \(Y \in W\) with \(X \leq Y\).
EXAMPLES:
We consider a list consisting of only one sign vector:
sage: from sign_vectors import * sage: W = [sign_vector("+-0")] sage: W [(+-0)] sage: lower_closure(W) {(000), (+00), (0-0), (+-0)}
Now, we consider a list of three sign vectors:
sage: W = [sign_vector("++-"), sign_vector("-00"), sign_vector("0--")] sage: W [(++-), (-00), (0--)] sage: lower_closure(W) {(000), (-00), (00-), (0+0), (0+-), (+00), (+0-), (++0), (++-), (0-0), (0--)}
TESTS:
sage: lower_closure([]) set()
- sign_vectors.functions.plot_sign_vectors(iterable: set[sign_vectors.sign_vectors.SignVector], vertex_size: int = 600, figsize: Optional[int] = None, aspect_ratio=None)¶
Plot the Hasse Diagram of sign vectors using the conformal relation.
INPUT:
iterable– an iterable of sign vectorsvertex_size– the size of the vertices in the plot (default: 600)figsize– the size of the figure (default: None)aspect_ratio– the aspect ratio of the plot (default: None)
- sign_vectors.functions.upper_closure(iterable: set[sign_vectors.sign_vectors.SignVector]) set[sign_vectors.sign_vectors.SignVector]¶
Compute the upper closure of given sign vectors.
INPUT:
iterable– an iterable of sign vectors
OUTPUT: Return the upper closure of
iterableas a set of sign vectors.Note
The sign vector \(X\) is in the upper closure of a set of sign vectors \(W\) if there exists \(Y \in W\) with \(X \leq Y\).
EXAMPLES:
We consider a list consisting of only one sign vector:
sage: from sign_vectors import * sage: W = [sign_vector("+-0")] sage: W [(+-0)] sage: upper_closure(W) {(+-0), (+--), (+-+)}
Now, we consider a list of three sign vectors:
sage: W = [sign_vector("++-"), sign_vector("-00"), sign_vector("0--")] sage: W [(++-), (-00), (0--)] sage: upper_closure(W) {(-00), (---), (++-), (-+0), (--+), (-++), (--0), (0--), (-0-), (+--), (-+-), (-0+)}
TESTS:
sage: upper_closure([]) set()