Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 8800
1
r"""
2
"""
3
4
#*****************************************************************************
5
# Copyright (C) 2017 Paul Leopardi [email protected]
6
#
7
# Distributed under the terms of the GNU General Public License (GPL)
8
# as published by the Free Software Foundation; either version 2 of
9
# the License, or (at your option) any later version.
10
# http://www.gnu.org/licenses/
11
#*****************************************************************************
12
13
14
import random
15
16
from boolean_cayley_graphs.bent_function import BentFunction
17
from boolean_cayley_graphs.bent_function_cayley_graphs_of_c_translates import cayley_graphs_of_c_translates
18
19
import boolean_cayley_graphs.cayley_graph_controls as controls
20
21
load("langevin_hou_partial_spreads.sage")
22
23
24
def nbr_cayley_graphs_of_c_translates(anf_list, n):
25
r"""
26
"""
27
28
if controls.verbose and controls.timing:
29
print(n)
30
31
anf = anf_list[n]
32
bentf = BentFunction(anf)
33
cg_list = cayley_graphs_of_c_translates(bentf)
34
len_cg_list = len(cg_list)
35
36
if controls.verbose:
37
print(n, ":", len_cg_list)
38
39
return len_cg_list
40
41
42
def sample_nbr_cayley_graphs_of_c_translates(anf_file, sample_size, seed=None):
43
r"""
44
"""
45
46
random.seed(seed)
47
anf_list = read_langevin_hou_anf_list(anf_file)
48
49
nbr_bent_functions = len(anf_list)
50
nbr_list = [0] * sample_size
51
for n in range(sample_size):
52
r = random.randint(0, nbr_bent_functions - 1)
53
len_cg_list = nbr_cayley_graphs_of_c_translates(anf_list, r)
54
nbr_list[n] = len_cg_list
55
56
return nbr_list
57
58
59
def list_nbr_cayley_graphs_of_c_translates(anf_file, start=0):
60
r"""
61
"""
62
63
anf_list = read_langevin_hou_anf_list(anf_file)
64
65
nbr_bent_functions = len(anf_list) - start
66
nbr_list = [0] * nbr_bent_functions
67
for n in range(start, start + nbr_bent_functions):
68
len_cg_list = nbr_cayley_graphs_of_c_translates(anf_list, n)
69
nbr_list[n - start] = len_cg_list
70
71
return nbr_list
72
73