Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
videlec committed Jul 28, 2023
1 parent 7793d2b commit 37fbde5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 90 deletions.
1 change: 1 addition & 0 deletions veerer/linear_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ def triangle_3_4_13_unfolding_orbit_closure():
sage: from veerer.linear_family import VeeringTriangulationLinearFamilies
sage: f = VeeringTriangulationLinearFamilies.triangle_3_4_13_unfolding_orbit_closure()
sage: f
VeeringTriangulationLinearFamily("(0,9,~8)(1,8,2)(3,11,~10)(4,~14,15)(5,~15,12)(6,~16,13)(7,~0,22)(10,14,~9)(16,~12,~4)(17,20,~18)(18,~5,~23)(19,~22,~21)(21,~13,23)(~20,~6,~17)(~19,~7,~1)(~11,~2,~3)", "BBRBRBRRRRRRRRBRBBRRRBRR", [(1, phi, 0, 0, 0, 1, 0, 0, -phi, -phi - 1, 0, 0, -phi, -phi, phi + 1, -phi - 1, phi, 0, 0, -phi, 0, phi - 1, -1, -1), (0, 0, 1, 0, 0, 0, phi - 1, 0, 1, 1, 1, 1, 0, phi - 1, 0, 0, 0, 0, phi - 1, 0, phi - 1, 0, 0, phi - 1), (0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, phi - 1, 0, 0, -phi + 1, 0, 0, 0), (0, 0, 0, 0, 1, 0, 0, phi - 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, phi - 1, 0, 0, phi - 1, 0)])
"""
from surface_dynamics import QuadraticStratum
from sage.rings.rational_field import QQ
Expand Down
90 changes: 0 additions & 90 deletions veerer/veering_triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

from random import choice, shuffle

def serialize_matrix(mat):
# if we have a number field!?
if mat.base_ring() not in [ZZ, QQ]:
raise NotImplementedError
return '_'.join(map(str, mat.list()))



# TODO: better to make something topological (ie no equations)
class VeeringTriangulation(Triangulation):
Expand Down Expand Up @@ -640,24 +633,6 @@ def _richcmp_(self, other, op):
c = (self._ep > other._ep) - (self._ep < other._ep)
return rich_to_bool(op, c)

def gl2r_plane(self, s, t):
r"""
Return the GL(2,R)-plane generated by the triangulations with vectors s and t
"""
switch = self.switch_matrix()
switch2 = matrix(switch.base_ring(), switch.nrows() + 2, switch.ncols())
switch2[:switch.nrows()] = switch
i = switch.nrows()
r = switch.rank()
for v in matrix([s, t]).right_kernel_matrix().rows():
switch2[i] = v
if switch2.rank() == r + 1:
i += 1
r += 1
if i == switch2.nrows():
break
LinearFamily

def to_core(self, slope=VERTICAL):
r"""
Change the colour of each forward (reps. backward) flippable edge in
Expand Down Expand Up @@ -2468,46 +2443,6 @@ def flip_back(self, e, col, Lx=None, Gx=None, check=True):
Gx.add_multiple_of_column(e, a, +1)
Gx.add_multiple_of_column(e, b, +1)

def switch_matrix(self, slope=VERTICAL):
r"""
Return the matrix of switch conditions.
Each row represents a linear constraints on the edge weights.
EXAMPLES::
sage: from veerer import VeeringTriangulation, HORIZONTAL
sage: vt = VeeringTriangulation("(0,1,2)(3,4,5)(6,7,8)(~8,~0,~7)(~6,~1,~5)(~4,~2,~3)", "RRBRRBRRB")
sage: vt.switch_matrix()
[ 1 -1 1 0 0 0 0 0 0]
[ 0 0 0 1 -1 1 0 0 0]
[ 0 0 0 0 0 0 1 -1 1]
[ 1 0 0 0 0 0 0 -1 1]
[ 0 1 0 0 0 -1 -1 0 0]
[ 0 0 1 1 -1 0 0 0 0]
sage: vt.switch_matrix(HORIZONTAL)
[ 1 -1 -1 0 0 0 0 0 0]
[ 0 0 0 1 -1 -1 0 0 0]
[ 0 0 0 0 0 0 1 -1 -1]
[ 1 0 0 0 0 0 0 -1 -1]
[ 0 1 0 0 0 1 -1 0 0]
[ 0 0 1 -1 1 0 0 0 0]
"""
require_package('sage', 'switch_matrix')

from sage.matrix.constructor import matrix
from sage.modules.free_module_element import vector
from sage.rings.integer_ring import ZZ

m = self.num_edges()
cs = ppl.Constraint_System()
x = [ppl.Variable(e) for e in range(m)]
self._set_switch_conditions(cs.insert, x, slope)
switch_mat = matrix(ZZ, len(cs), m)
for i, g in enumerate(cs):
switch_mat[i] = vector(ZZ, g.coefficients())
return switch_mat

def _set_switch_conditions(self, insert, x, slope=VERTICAL):
r"""
These are the linear parts of the train-track equations
Expand Down Expand Up @@ -2869,31 +2804,6 @@ def train_track_min_solution(self, slope=VERTICAL, allow_degenerations=False):
self._set_train_track_constraints(M.add_constraint, x, slope, 1, allow_degenerations)
return M.optimizing_point()

def _set_linear_subspace_constraints(self, insert, x, y, Lx):
Ly = self._complexify_equations(Lx)
for l in Lx:
l *= l.denominator()
l = sum(coeff * x[e] for e,coeff in enumerate(l))
insert(l == 0)
for l in Ly:
l *= l.denominator()
l = sum(coeff * y[e] for e,coeff in enumerate(l))
insert(l == 0)

def _linear_subspace_generator_system(self, x, y, Gx):
# construct linear equations from given generators
# (insert must be from a generator)
Gy = self._complexify_generators(Gx)
gs = ppl.Generator_System()
gs.insert(ppl.point())
for g in Gx:
g = sum(coeff * x[e] for e,coeff in enumerate(g))
gs.insert(ppl.line(g))
for g in Gy:
g = sum(coeff * y[e] for e,coeff in enumerate(g))
gs.insert(ppl.line(g))
return gs

def geometric_polytope(self, x_low_bound=0, y_low_bound=0, hw_bound=0, backend='ppl'):
r"""
Return the geometric polytope of this veering triangulation.
Expand Down

0 comments on commit 37fbde5

Please sign in to comment.