sign_vectors.functions

Functions for working with oriented matroids

Functions

closure(iterable)

Compute the closure of given sign vectors.

contraction(iterable, indices)

Return all sign vectors or vectors that are zero on given components.

deletion(iterable, indices)

Remove given components from an iterable of sign vectors

plot_sign_vectors(iterable[, vertex_size, ...])

Plot the Hasse Diagram of sign vectors using the conformal relation.

sign_vectors.functions.closure(iterable) set[sign_vectors.sign_vectors.SignVector]

Compute the closure of given sign vectors.

INPUT:

  • iterable – an iterable of sign vectors

OUTPUT: Return the (lower) closure of iterable as a set of sign vectors.

Note

The sign vector \(X\) is in the 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: 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: closure(W)
{(000), (-00), (00-), (0+0), (0+-), (+00), (+0-), (++0), (++-), (0-0), (0--)}

TESTS:

sage: closure([])
set()
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 vectors

  • indices – a list of indices.

OUTPUT:

  • If keep_components is false, remove entries in indices. (default)

  • If keep_components is true, keep entries in indices.

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 1 and 2:

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 vectors

  • indices – 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.plot_sign_vectors(iterable, 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 vectors

  • vertex_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)