Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 8800
1
r"""
2
"""
3
#*****************************************************************************
4
# Copyright (C) 2016 Paul Leopardi [email protected]
5
#
6
# Distributed under the terms of the GNU General Public License (GPL)
7
# as published by the Free Software Foundation; either version 2 of
8
# the License, or (at your option) any later version.
9
# http://www.gnu.org/licenses/
10
#*****************************************************************************
11
12
import sys
13
14
from sage.all_cmdline import *
15
16
from boolean_cayley_graphs.bent_function_cayley_graph_classification import BentFunctionCayleyGraphClassification
17
from boolean_cayley_graphs.bent_function import BentFunction
18
19
r"""
20
"""
21
# Check that the correct number arguments exist.
22
if len(sys.argv) < 3:
23
print("Usage: save_psf_from_parts seq_nbr fnbr [dir]")
24
sys.exit(1)
25
26
# Convert the arguments to int.
27
seq_nbr = int(sys.argv[1]) # Number of the partial spread function sequence
28
fnbr = int(sys.argv[2]) # Function number within partial spread function sequence
29
d_load = None
30
if len(sys.argv) > 3:
31
d_load = sys.argv[3] # Directory to load parts from
32
d_save = None
33
if len(sys.argv) > 4:
34
d_save = sys.argv[4] # Directory to save to
35
36
# Construct the classification from the existing parts.
37
c_name = "psf"+str(seq_nbr)+"_"+str(fnbr)
38
c = BentFunctionCayleyGraphClassification.from_parts(c_name, dir=d_load)
39
40
# Save the classification.
41
c.save_mangled(c_name, dir=d_save)
42
43
# Check the saved classification
44
c_check = BentFunctionCayleyGraphClassification.load_mangled(c_name, dir=d_save)
45
c_check.report()
46
if (c.algebraic_normal_form == c_check.algebraic_normal_form and
47
c.cayley_graph_class_list == c_check.cayley_graph_class_list and
48
c.bent_cayley_graph_index_matrix == c_check.bent_cayley_graph_index_matrix and
49
c.dual_cayley_graph_index_matrix == c_check.dual_cayley_graph_index_matrix and
50
c.weight_class_matrix == c_check.weight_class_matrix):
51
print("Check succeeded.")
52
else:
53
print("Check failed.")
54
sys.exit(1)
55
56
quit
57
58
59