CoCalc Public FilesBoolean-Cayley-graphs / sage-code / save_psf_from_parts.py
Author: Paul Leopardi
Compute Environment: Ubuntu 18.04 (Deprecated)
1r"""
2"""
3#*****************************************************************************
4#       Copyright (C) 2016 Paul Leopardi [email protected]
5#
7#  as published by the Free Software Foundation; either version 2 of
10#*****************************************************************************
11
12import sys
13
14from sage.all_cmdline import *
15
16from boolean_cayley_graphs.bent_function_cayley_graph_classification import BentFunctionCayleyGraphClassification
17from boolean_cayley_graphs.bent_function import BentFunction
18
19r"""
20"""
21# Check that the correct number arguments exist.
22if 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.
27seq_nbr  = int(sys.argv[1]) # Number of the partial spread function sequence
28fnbr     = int(sys.argv[2]) # Function number within partial spread function sequence
30if len(sys.argv) > 3:
32d_save = None
33if len(sys.argv) > 4:
34    d_save = sys.argv[4]         # Directory to save to
35
36# Construct the classification from the existing parts.
37c_name = "psf"+str(seq_nbr)+"_"+str(fnbr)
39
40# Save the classification.
41c.save_mangled(c_name, dir=d_save)
42
43# Check the saved classification
45c_check.report()
46if (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.")
52else:
53    print("Check failed.")
54    sys.exit(1)
55
56quit
57
58