elementary_vectors.utility

Utility functions

Functions

conformal_elimination(vector1, vector2[, ...])

Apply conformal elimination to two real vectors to find a new vector.

is_symbolic(value)

Return whether this element is a symbolic expression.

kernel_vector_support_given(M, indices)

Return a right kernel vector such that the support is a subset of given indices.

elementary_vectors.utility.conformal_elimination(vector1, vector2, indices: Optional[list[int]] = None)

Apply conformal elimination to two real vectors to find a new vector.

INPUT:

  • vector1 – a real vector

  • vector2 – a real vector

  • indices – a list of indices (default: None)

OUTPUT: Return a new vector z = x + a y where a > 0, such that z[e] == 0 for some e in indices and Z_k <= X_k for k in indices and Z_f = (X o Y)_f for f not in D(X, Y). Here, X, Y and Z are the sign vectors corresponding to x, y and z.

Note

If indices is not given, the whole list of separating elements will be considered instead. (default)

EXAMPLES:

sage: from elementary_vectors.utility import conformal_elimination
sage: x = vector([1, 0, 2])
sage: y = vector([-1, 1, 1])
sage: conformal_elimination(x, y)
(0, 1, 3)
elementary_vectors.utility.is_symbolic(value)

Return whether this element is a symbolic expression.

If it belongs to the symbolic ring but doesn’t contain any variables it does not count as “symbolic”.

EXAMPLES:

sage: from elementary_vectors.utility import is_symbolic
sage: is_symbolic(5)
False
sage: var('a, b')
(a, b)
sage: is_symbolic(a)
True
sage: is_symbolic(-a)
True
sage: is_symbolic(b^2 - a)
True
sage: is_symbolic(SR(5))
False
elementary_vectors.utility.kernel_vector_support_given(M, indices)

Return a right kernel vector such that the support is a subset of given indices.

INPUT:

  • M – a matrix

  • indices – a list of indices

OUTPUT: a vector in the right kernel of M such that the support is a subset of indices.

EXAMPLES:

sage: from elementary_vectors.utility import kernel_vector_support_given
sage: M = matrix([[1, 2, 0, 0], [0, 1, -1, 0]])
sage: v = kernel_vector_support_given(M, [0, 1, 2])
sage: max(v, -v)
(2, -1, -1, 0)
sage: kernel_vector_support_given(M, [3])
(0, 0, 0, 1)
sage: kernel_vector_support_given(M, [0, 3])
(0, 0, 0, 1)