Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 8796
Kernel: SageMath 9.5
import datetime import os import psycopg2 from boolean_cayley_graphs.bent_function import BentFunction from boolean_cayley_graphs.classification_database_psycopg2 import * from boolean_cayley_graphs.bent_function_cayley_graph_classification import BentFunctionCayleyGraphClassification
sobj_dirname=os.path.join("..","sobj")
def drop_database(db_name): conn = psycopg2.connect(dbname="postgres") conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) curs = conn.cursor() curs.execute( "DROP DATABASE " + db_name) conn.commit()
try: drop_database('test_p6') except: pass conn = create_database('test_p6') conn = create_classification_tables('test_p6')
for i in range(1,5): print(i) name = "p6_"+str(i) cgc = BentFunctionCayleyGraphClassification.load_mangled(name + ".sobj", dir=sobj_dirname) insert_classification(conn, cgc, name)
1 2 3 4
cgc.report()
Algebraic normal form of Boolean function: x0*x1*x2 + x0*x3 + x1*x3*x4 + x1*x5 + x2*x3*x5 + x2*x3 + x2*x4 + x2*x5 + x3*x4 + x3*x5 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 3 extended Cayley classes in the extended translation class.
bentf = BentFunction(cgc.algebraic_normal_form) c = select_classification_where_bent_function(conn, bentf) c.report()
Algebraic normal form of Boolean function: x0*x1*x2 + x0*x3 + x1*x3*x4 + x1*x5 + x2*x3*x5 + x2*x3 + x2*x4 + x2*x5 + x3*x4 + x3*x5 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 3 extended Cayley classes in the extended translation class.
c = select_classification_where_name(conn, "p6_1") c.report()
Algebraic normal form of Boolean function: x0*x1 + x2*x3 + x4*x5 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 2 extended Cayley classes in the extended translation class.
curs = conn.cursor() print(datetime.datetime.now(), "before") curs.execute("SELECT COUNT(graph_id) FROM cayley_graph") print(datetime.datetime.now(), "after") for row in curs: for x in row: print(x)
2020-09-19 19:23:35.687522 before 2020-09-19 19:23:35.688587 after 12
print(datetime.datetime.now(), "before") curs.execute("SELECT COUNT(graph_id) FROM graph") print(datetime.datetime.now(), "after") for row in curs: for x in row: print(x)
2020-09-19 19:23:35.777019 before 2020-09-19 19:23:35.777740 after 11
conn.close()
try: drop_database('test_p8') except: pass conn = create_database('test_p8') conn = create_classification_tables('test_p8')
for i in range(1,11): name = "p8_"+str(i) cgc = BentFunctionCayleyGraphClassification.load_mangled(name + ".sobj", dir=sobj_dirname) print(datetime.datetime.now(), i) insert_classification(conn, cgc, name) print(datetime.datetime.now())
2020-09-19 19:23:40.962346 1 2020-09-19 19:23:57.198127 2 2020-09-19 19:24:14.249456 3 2020-09-19 19:24:32.799106 4 2020-09-19 19:24:51.402998 5 2020-09-19 19:25:09.035606 6 2020-09-19 19:25:27.242895 7 2020-09-19 19:25:46.095698 8 2020-09-19 19:26:04.052607 9 2020-09-19 19:26:21.101727 10 2020-09-19 19:26:38.921789
c8_5 = select_classification_where_name(conn, "p8_5") c8_5.report()
Algebraic normal form of Boolean function: x0*x1*x2 + x0*x6 + x1*x3*x4 + x1*x4 + x1*x5 + x2*x3*x5 + x2*x4 + x3*x7 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 256, 120, 56)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 9 extended Cayley classes in the extended translation class.
bentf = BentFunction(c8_5.algebraic_normal_form) c = select_classification_where_bent_function(conn, bentf) c.report()
Algebraic normal form of Boolean function: x0*x1*x2 + x0*x6 + x1*x3*x4 + x1*x4 + x1*x5 + x2*x3*x5 + x2*x4 + x3*x7 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 256, 120, 56)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 9 extended Cayley classes in the extended translation class.
c8_6 = select_classification_where_name(conn, "p8_6") c8_6.report()
Algebraic normal form of Boolean function: x0*x1*x2 + x0*x2 + x0*x3 + x1*x3*x4 + x1*x6 + x2*x3*x5 + x2*x4 + x5*x7 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 256, 120, 56)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 9 extended Cayley classes in the extended translation class.
curs = conn.cursor() print(datetime.datetime.now(), "before") curs.execute("SELECT COUNT(*) FROM cayley_graph") print(datetime.datetime.now(), "after") for row in curs: for x in row: print(x)
2020-09-19 19:26:43.102174 before 2020-09-19 19:26:43.102959 after 66
conn.close() conn = connect_to_database('test_p8')
curs = conn.cursor() print(datetime.datetime.now(), "before") curs.execute("SELECT COUNT(*) FROM cayley_graph") print(datetime.datetime.now(), "after") for row in curs: for x in row: print(x)
2020-09-19 19:26:43.428264 before 2020-09-19 19:26:43.429710 after 66
print(datetime.datetime.now(), "before") curs.execute("SELECT COUNT(*) FROM graph") print(datetime.datetime.now(), "after") for row in curs: for x in row: print(x)
2020-09-19 19:26:43.535688 before 2020-09-19 19:26:43.537105 after 55
conn.close()
conn = connect_to_database('test_p8')
curs = conn.cursor() print(datetime.datetime.now(), "before") curs.execute(""" select name, cayley_graph_index, graph_id, count(*) from matrices, ( select name, bent_function, cayley_graph_index, graph_id from ( select graph_id from cayley_graph group by graph_id having count (graph_id) > 1L ) as repeats natural join cayley_graph natural join bent_function ) as repeats_with_counts where matrices.bent_function = repeats_with_counts.bent_function and matrices.bent_cayley_graph_index = repeats_with_counts.cayley_graph_index group by name, cayley_graph_index, graph_id order by graph_id """) print(datetime.datetime.now(), "after") for row in curs: for x in row: print(x, end=" ") print("")
2020-09-19 19:26:43.791740 before 2020-09-19 19:26:44.362517 after p8_1 0 1 34816 p8_2 0 1 6144 p8_1 1 2 30720 p8_2 3 2 2048 p8_5 0 19 4096 p8_6 0 19 4096 p8_5 1 20 6144 p8_6 1 20 6144 p8_5 2 21 6144 p8_6 2 21 6144 p8_5 3 22 2048 p8_6 5 22 2048 p8_5 4 23 2048 p8_6 8 23 2048 p8_5 5 24 6144 p8_6 6 24 6144 p8_5 6 25 6144 p8_6 7 25 6144 p8_5 7 26 16384 p8_6 3 26 16384 p8_5 8 27 16384 p8_6 4 27 16384
conn.close()