Skip to content

Instantly share code, notes, and snippets.

@amitjamadagni
amitjamadagni / seifert matrix
Created March 7, 2014 21:33
A very initial implementation of Seifert Matrix.
from sage.matrix.constructor import identity_matrix, matrix
def components(x):
new = []
for i in range(len(x)):
a = abs(x[i])
new.append(a)
print new
sorted = list(set(new))
print sorted
'''sorting the absolute values of the braid word'''
from sage.groups.free_group import FreeGroupElement
from sage.groups.braid import Braid
#from sage.matrix.matrix_integer_dense import Matrix_integer_dense, delete_rows
class Link:
def __init__(self, input = None, gauss_code = None, dt_code = None):
if type(input) == sage.groups.braid.Braid:
self._braid = input
self._gauss_code = None
self._dt_code = None
from sage.groups.free_group import FreeGroupElement
from sage.groups.braid import Braid
class Link:
def __init__(self, input = None, gauss_code = None, dt_code = None):
if type(input) == sage.groups.braid.Braid:
self._braid = input
self._gauss_code = None
self._dt_code = None
r"""
Link class
"""
#*****************************************************************************
# Copyright (C) 2014
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*****************************************************************************
r"""
Link class
"""
#*****************************************************************************
# Copyright (C) 2014
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*****************************************************************************
dt = self._dt_code
gauss = []
y = [None for i in range(2*len(dt))]
x = [0 for i in range(2*len(dt))]
for i in range(len(dt)):
x[2*i] = 2*i + 1
x[2*i + 1] = dt[i]
for i in range(len(dt)):
if x[2*i+1] > 0:
y[2*i+1] = 'under'
def gauss_code(self):
r"""
Returns the gauss_code
INPUT:
- Either a braidword, gauss_code, dt_code
OUTPUT:
- Gauss code representation of the INPUT
def dt_code(self):
r"""
Returns the dt_code
INPUT:
- Either a braidword, gauss_code, dt_code
OUTPUT:
- DT Code representation of the INPUT
def PD_code(self):
'''dt = self.dt_code()
y = [None for i in range(2*len(dt))]
x = [0 for i in range(2*len(dt))]
for i in range(len(dt)):
x[2*i] = 2*i + 1
x[2*i + 1] = dt[i]
#print x
p = [[None,None] for i in range(len(x))]
t = [abs(r) for r in x]
l1 = list(left_component)
print l1
for i in l1:
if i[0] < 0:
i[0] = abs(i[0])
elif i[1] < 0:
i[1] = abs(i[1])
print l1
print id(l1)
print left_component