before deleting fragments for evaluation of vectors with one and minus one combinationa

This commit is contained in:
Maria Marchwicka 2020-09-01 20:37:56 +02:00
parent d9986b63c1
commit 1ec26c1b55
2 changed files with 50 additions and 55 deletions

View File

@ -2,7 +2,7 @@
import collections
import numpy as np
import itertools as it
import re
class TorusCable(object):
def __init__(self, knot_formula, k_vector=None, q_vector=None):
@ -347,25 +347,18 @@ class TorusCable(object):
if (a_1^2 - a_2^2 + a_3^2 - a_4^2) % q_4:
continue
if all(a in [1, q_4 - 1] for a in vector):
is_all_one = True
else:
is_all_one = False
continue
if self.__is_sigma_for_vector_class_big(vector):
good_vectors.append(vector)
# if is_all_one:
# print("\nHURA" * 100)
# print(self.knot_description)
# self.__tmp_print_all_sigma_for_vector_class(vector)
# pass
else:
if is_all_one:
self.__tmp_get_max_sigma_for_vector_class(vector)
bad_vectors.append(vector)
#####################################################
if len(bad_vectors) > 8:
break
####################################################
large_sigma_for_all_combinations = False
# large_sigma_for_all_combinations = False
# if len(bad_vectors) > 8:
# break
print(len(bad_vectors))
if a_1 and a_2 and a_3 and a_4:
assert len(bad_vectors) % 8 == 0
return good_vectors, bad_vectors
# searching for sigma > 5 + #(v_i != 0)
@ -399,9 +392,9 @@ class TorusCable(object):
if print_results:
print("good : bad:\t " + str(number_of_all_good_v) +\
" : " + str(len(all_bad_vectors)))
if len(all_bad_vectors) < 8:
print()
print(all_bad_vectors)
# if len(all_bad_vectors) < 8:
# print()
# print(all_bad_vectors)
return all_combinations_pass
@ -429,7 +422,6 @@ class SignatureFunction(object):
def __init__(self, values=None, counter=None):
# set values of signature jumps
if counter is None:
counter = collections.Counter()
if values is None:
values = []
assert all(x < 1 for x, y in values),\
@ -482,7 +474,6 @@ class SignatureFunction(object):
counter.subtract(self.cnt_signature_jumps)
return SignatureFunction(counter=counter)
# TBD short
def __add__(self, other):
counter = copy(self.cnt_signature_jumps)
counter.update(other.cnt_signature_jumps)

View File

@ -6,17 +6,14 @@
import os
import sys
import collections
# import inspect
import itertools as it
import numpy as np
import re
# try:
# from cable_signature import SignatureFunction, TorusCable
# except ModuleNotFoundError:
os.system('sage --preparse cable_signature.sage')
os.system('mv cable_signature.sage.py cable_signature.py')
from cable_signature import SignatureFunction, TorusCable
#
# if not os.path.isfile('cable_signature.py'):
# os.system('sage --preparse cable_signature.sage')
# os.system('mv cable_signature.sage.py cable_signature.py')
# from cable_signature import SignatureFunction, TorusCable
#
class Config(object):
def __init__(self):
@ -45,7 +42,7 @@ class Config(object):
self.verbose = False
self.print_results = True
# self.print_results = False
self.print_results = False
self.print_calculations_for_large_sigma = True
self.print_calculations_for_large_sigma = False
@ -84,29 +81,36 @@ class Config(object):
# a_3 == 0, a_4 == 0, a_1, a_2 != 0
it.product(range(1, q), range(1, 2), range(1), range(1)),
]
# list_of_ranges = [
# # all characters a_1, a_2, a_3, a_4 != 0
# # 1, 1, 1, 1
# it.product(range(1, 2), range(1, 2), range(1, 2), range(1, 2)),
#
# # -1, -1, -1, 1
# it.product(range(q - 1, q), range(q - 1, q), range(q - 1, q), range(1, 2)),
#
# # 1, -1, -1, 1
# it.product(range(1, 2), range(q - 1, q), range(q - 1, q), range(1, 2)),
# # -1 , -1, 1, 1
# it.product(range(q - 1, q), range(q - 1, q), range(1, 2), range(1, 2)),
# # -1, 1, -1, 1
# it.product(range(q - 1, q), range(1, 2), range(q - 1, q), range(1, 2)),
#
# # 1, 1, -1, 1
# it.product(range(1, 2), range(1, 2), range(q - 1, q), range(1, 2)),
# # 1, -1, 1, 1
# it.product(range(1, 2), range(q - 1, q), range(1, 2), range(1, 2)),
# # -1, 1, 1, 1
# it.product(range(q - 1, q), range(1, 2), range(1, 2), range(1, 2)),
#
# ]
list_of_ranges =
[
# all characters a_1, a_2, a_3, a_4 != 0
# 1, 1, 1, 1
it.product(range(1, 2), range(1, 2), range(1, 2), range(1, 2)),
# -1, -1, -1, 1
it.product(range(q - 1, q), range(q - 1, q), range(q - 1, q), \
range(1, 2)),
# 1, -1, -1, 1
it.product(range(1, 2), range(q - 1, q), range(q - 1, q), \
range(1, 2)),
# -1 , -1, 1, 1
it.product(range(q - 1, q), range(q - 1, q), range(1, 2), \
range(1, 2)),
# -1, 1, -1, 1
it.product(range(q - 1, q), range(1, 2), range(q - 1, q), \
range(1, 2)),
# 1, 1, -1, 1
it.product(range(1, 2), range(1, 2), range(q - 1, q), \
range(1, 2)),
# 1, -1, 1, 1
it.product(range(1, 2), range(q - 1, q), range(1, 2), \
range(1, 2)),
# -1, 1, 1, 1
it.product(range(q - 1, q), range(1, 2), range(1, 2), \
range(1, 2)),
]
return list_of_ranges
@ -121,8 +125,6 @@ def main(arg):
knots_with_large_sigma = search_for_large_signature_value(limit=limit)
# search_for_null_signature_value(limit=limit)
# searching for sigma > 5 + #(v_i != 0) over given knot schema
def __search_for_large_signature_value(knot_formula, limit,
verbose, print_results):
@ -140,6 +142,7 @@ def __search_for_large_signature_value(knot_formula, limit,
q[3] = P.next(q[2] * 4 + q[3])
cable = TorusCable(knot_formula=knot_formula, q_vector=q)
list_of_ranges = config.get_list_of_ranges(cable.q_vector[-1])
print(cable.knot_description)
if cable.eval_cable_for_large_sigma(list_of_ranges, verbose=verbose,
print_results=print_results):
good_knots.append(cable)
@ -173,6 +176,7 @@ def search_for_large_signature_value(knot_formula=None, limit=None,
k = [(P.unrank(i + config.start_shift) - 1)/2 for i in c]
cable = TorusCable(knot_formula=knot_formula, k_vector=k)
list_of_ranges = config.get_list_of_ranges(cable.q_vector[-1])
print(cable.knot_description)
if cable.eval_cable_for_large_sigma(list_of_ranges, verbose=verbose,
print_results=print_results):
good_knots.append(cable)