elementary_vectors.functions_dd¶
Double description
EXAMPLES:
We consider the following matrix:
sage: M = matrix([[1,2,0,0,3],[0,1,-1,2,1]])
sage: M
[ 1 2 0 0 3]
[ 0 1 -1 2 1]
Next, we compute the elementary vectors of this matrix:
sage: from elementary_vectors import *
sage: evs = elementary_vectors(M)
sage: evs
[(-2, 1, 1, 0, 0),
(4, -2, 0, 1, 0),
(-1, -1, 0, 0, 1),
(0, 0, -2, -1, 0),
(3, 0, -1, 0, -1),
(-6, 0, 0, -1, 2),
(0, 3, 1, 0, -2),
(0, -6, 0, 1, 4)]
We compute the corresponding sign vectors:
sage: from sign_vectors import *
sage: svs = [sign_vector(v) for v in evs]
sage: svs
[(-++00), (+-0+0), (--00+), (00--0), (+0-0-), (-00-+), (0++0-), (0-0++)]
Now, we define a vector a
.
We will use this vector as a third row in our matrix:
sage: a = vector([1, 1, 1, 0, 0])
sage: Ma = M.insert_row(2, a)
sage: Ma
[ 1 2 0 0 3]
[ 0 1 -1 2 1]
[ 1 1 1 0 0]
That way, we describe a different vector space. The corresponding elementary vectors can be computed as before:
sage: evs_a = elementary_vectors(Ma)
sage: evs_a
[(-4, 2, 2, 0, 0), (-6, 6, 0, -2, -2), (-6, 0, 6, 2, 2), (0, -6, 6, 4, 4)]
Similarly, we obtain the following sign vectors:
sage: [sign_vector(v) for v in evs_a]
[(-++00), (-+0--), (-0+++), (0-+++)]
A different approach is to use the double description method. First, we compute two lists of sign vectors:
sage: from elementary_vectors.functions_dd import *
sage: E0, Ep = dd_input(M, svs, a)
sage: E0
[(-++00)]
sage: Ep
[(+-0+0), (++00-), (00++0), (+0-0-), (+00+-), (0++0-), (0+0--)]
Then, we use the computed lists, to compute the new list of sign vectors by applying double description:
sage: dd(E0, Ep)
[(-++00), (+-0++), (-0+++), (0-+++)]
There, is also a convenient command that computed this list of sign vectors:
sage: double_description(M, a)
[(-++00), (+-0++), (-0+++), (0-+++)]
Functions
Compute the sign vectors corresponding to given vectors. |
|
|
Compute the sign vectors corresponding to given lists of sign vectors. |
|
INPUT: |
|
Determine the sign of the corresponding scalar product. |
|
INPUT: |
- elementary_vectors.functions_dd.cocircuits_iterative(ai)¶
Compute the sign vectors corresponding to given vectors.
INPUT:
ai
– a list of vectors
OUTPUT: Compute iteratively the sign vectors corresponding to the elementary vectors determined by the given vectors
ai
.EXAMPLES:
sage: from elementary_vectors.functions_dd import cocircuits_iterative sage: ai = [vector([1,-2,0,2,2]), vector([0,1,4,4,1]), vector([1,0,-1,0,0])] sage: cocircuits_iterative(ai) [(0+0-+), (+-+-0), (+0+-+), (+-+0-)]
- elementary_vectors.functions_dd.dd(E0, Ep, **kwargs)¶
Compute the sign vectors corresponding to given lists of sign vectors.
INPUT:
E0
– a list of sign vectorsEp
– a list of sign vectors
OUTPUT: TODO
See also
dd_input()
double_description()
elementary_vectors()
- elementary_vectors.functions_dd.dd_input(M, svs, a)¶
INPUT:
M
– a matrixsvs
– a list of sign vectorsa
– a vector
OUTPUT: a tuple
(E0, Ep)
whereE0
are sign vectors such that the corresponding elementary vectorsv
satisfya v = 0
andEp
are sign vectors such that the corresponding elementary vectorsv
satisfya v > 0
.
- elementary_vectors.functions_dd.determine_sign(X, a, M=None)¶
Determine the sign of the corresponding scalar product.
INPUT:
X
– a sign vectora
– a vectorM
– a matrix (default: None)
OUTPUT: First, the vector
v
corresponding to the sign vectorsv
is computed. Then, the sign of the scalar producta v
is returned. If the sign can not be determined, the matrixM
is used to find an appropriate sign vector forX
. In this case, ifM
is not specified, an exception is raised.Note
This might not work if
X
is not a cocircuit of the oriented matroid corresponding to the kernel ofM
.EXAMPLES:
sage: from sign_vectors import * sage: from elementary_vectors.functions_dd import * sage: M = matrix([[1, 1, 2, 3], [2, -1, 0, 0]]) sage: X = sign_vector("++-0") sage: a = vector([1, 0, 0, 0]) sage: determine_sign(X, a, M) 1 sage: a = vector([0, 0, 0, 1]) sage: determine_sign(X, a) 0 sage: a = vector([1, 1, 0, 0]) sage: determine_sign(X, a) 1 sage: a = vector([1, -1, 0, 0]) sage: determine_sign(X, a, M) -1 sage: determine_sign(-X, a, M) 1
- elementary_vectors.functions_dd.double_description(M, a)¶
INPUT:
M
– a matrixa
– a vector
OUTPUT: a list of elementary vectors
v
ofdata
satisfyinga v = 0
.EXAMPLES:
We consider the following matrix:
sage: M = matrix([[1,2,0,0,3],[0,1,-1,2,1]]) sage: M [ 1 2 0 0 3] [ 0 1 -1 2 1]
Next, we compute the elementary vectors of this matrix:
sage: from elementary_vectors import * sage: evs = elementary_vectors(M) sage: evs [(-2, 1, 1, 0, 0), (4, -2, 0, 1, 0), (-1, -1, 0, 0, 1), (0, 0, -2, -1, 0), (3, 0, -1, 0, -1), (-6, 0, 0, -1, 2), (0, 3, 1, 0, -2), (0, -6, 0, 1, 4)]
We compute the corresponding sign vectors:
sage: from sign_vectors import * sage: svs = [sign_vector(v) for v in evs] sage: svs [(-++00), (+-0+0), (--00+), (00--0), (+0-0-), (-00-+), (0++0-), (0-0++)]
Now, we define a vector
a
. We will use this vector as a third row in our matrix:sage: a = vector([1, 1, 1, 0, 0]) sage: Ma = M.insert_row(2, a) sage: Ma [ 1 2 0 0 3] [ 0 1 -1 2 1] [ 1 1 1 0 0]
That way, we describe a different vector space. The corresponding elementary vectors can be computed as before:
sage: evs_a = elementary_vectors(Ma) sage: evs_a [(-4, 2, 2, 0, 0), (-6, 6, 0, -2, -2), (-6, 0, 6, 2, 2), (0, -6, 6, 4, 4)]
Similarly, we obtain the following sign vectors:
sage: [sign_vector(v) for v in evs_a] [(-++00), (-+0--), (-0+++), (0-+++)]
A different approach is to use the double description method:
sage: double_description(M, a) [(-++00), (+-0++), (-0+++), (0-+++)]
The output is identical up to multiplies.