sign_vectors.functions

Functions for working with oriented matroids

Functions

closure(iterable[, separate])

Compute the closure of given sign vectors.

contraction(iterable, indices[, keep_components])

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

deletion(iterable, indices)

Remove given components from an iterable of sign vectors or vectors.

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

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

sign_vectors.functions.closure(iterable, separate: bool = False)

Compute the closure of given sign vectors.

INPUT:

  • iterable – an iterable of sign vectors

  • separate – boolean (default: False)

OUTPUT:

If separate is false, return the closure of iterable. (default)

If separate is true, separate the closure into sets, where each element has the same number of zero entries.

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)}

With the optional argument separate=True, we can separate the resulting list into three sets. Each sign vector in such a set has the same number of zero entries:

sage: closure(W, separate=True)
[{(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-), (+00), (+0-), (++0), (++-), (0--), (0+0), (0+-), (0-0)}
sage: closure(W, separate=True)
[{(000)},
 {(-00), (00-), (+00), (0+0), (0-0)},
 {(0--), (0+-), (+0-), (++0)},
 {(++-)}]

TESTS:

sage: closure([])
set()
sign_vectors.functions.contraction(iterable, indices: list[int], keep_components: bool = False)

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.

  • keep_components – a boolean

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])
{(-)}

We take the examples from before. With keep_components=True, we keep the zero components of the appropriate sign vectors:

sage: contraction(W, [0], keep_components=True)
{(00+)}
sage: contraction(W, [1], keep_components=True)
{(00+), (-00)}
sage: contraction(W, [2], keep_components=True)
{(++0), (-00)}
sage: contraction(W, [1, 2], keep_components=True)
{(-00)}

This function also works for matrices or lists of vectors:

sage: l = [vector([0, 0, 1]), vector([0, 2, 1]), vector([-1, 0, 1])]
sage: contraction(l, [0])
{(0, 1), (2, 1)}
sage: A = matrix([[1, 1, 0], [0, 1, 0]])
sage: contraction(A, [2])
{(0, 1), (1, 1)}
sign_vectors.functions.deletion(iterable, indices: list[int])

Remove given components from an iterable of sign vectors or vectors.

INPUT:

  • iterable – an iterable of sign vectors or 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), (+)}

This function also works for lists of vectors:

sage: l = [vector([0, 0, 1]), vector([0, 2, 1]), vector([-1, 0, 1])]
sage: deletion(l, [1])
{(-1, 1), (0, 1)}
sign_vectors.functions.plot_sign_vectors(iterable, vertex_size: int = 600, figsize: int = 10, aspect_ratio=0.5)

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