Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 8800
1
r"""
2
Populate the bent function Cayley graphs databases.
3
"""
4
5
#*****************************************************************************
6
# Copyright (C) 2018 Paul Leopardi [email protected]
7
#
8
# Distributed under the terms of the GNU General Public License (GPL)
9
# as published by the Free Software Foundation; either version 2 of
10
# the License, or (at your option) any later version.
11
# http://www.gnu.org/licenses/
12
#*****************************************************************************
13
14
import datetime
15
import json
16
import psycopg2
17
18
from boolean_cayley_graphs.bent_function import BentFunction
19
from boolean_cayley_graphs.bent_function_cayley_graph_classification import BentFunctionCayleyGraphClassification
20
from boolean_cayley_graphs.classification_database_psycopg2 import *
21
22
def populate_bfcg_database(dbname, nbr_f):
23
24
print(dbname, ":")
25
conn = create_classification_tables(
26
dbname,
27
user=auth["user"],
28
password=auth["password"],
29
host=auth["host"])
30
31
for i in range(1, nbr_f + 1):
32
stri = ("%01d" if nbr_f < 10 else "%02d") % i
33
sobj_name = dbname + "_" + str(i) + ".sobj"
34
name = dbname + "_" + stri
35
cgc = BentFunctionCayleyGraphClassification.load_mangled(
36
sobj_name,
37
directory="../sobj")
38
print(datetime.datetime.now(), stri)
39
insert_classification(
40
conn,
41
cgc,
42
name)
43
cgc_check = select_classification_where_name(
44
conn,
45
name)
46
cgc_check.report()
47
48
conn.close()
49
print(datetime.datetime.now())
50
51
52
with open("postgresql-auth.json") as auth_file:
53
auth = json.load(auth_file)
54
55
populate_bfcg_database("p2", 1)
56
populate_bfcg_database("p4", 1)
57
populate_bfcg_database("p6", 4)
58
populate_bfcg_database("p8", 10)
59
populate_bfcg_database("sigma", 4)
60
populate_bfcg_database("tau", 4)
61
62
63