Boolean-Cayley-graphs / boolean_cayley_graphs / __pycache__ / boolean_linear_code_graph.cpython-39-pytest-6.2.5.pyc
24930 viewsa
B1�bR � @ sV d Z ddlZddlm mZ ddlmZ ddl m
Z
ddl mZ dd� Zdd � Z
dS )
a�
Boolean linear code graphs
==========================
The ``boolean_linear_code_graph`` module defines the functions:
* ``boolean_linear_code_graph``,
which returns the graph corresponding to the linear code of a bent Boolean function; and
* ``strongly_regular_from_code_gens``,
which returns the strongly regular graph corresponding to a list of generators
of projective two-weight codes.
AUTHORS:
- Paul Leopardi (2016-08-21): initial version
� N)�%strongly_regular_from_two_weight_code)�boolean_linear_code)�linear_code_from_code_gensc C s t | |�}t|�S )a�
Return the graph corresponding to the linear code of a bent Boolean function.
INPUT:
- ``dim`` -- positive integer. The assumed dimension of function ``f``.
- ``f`` -- a Python function that takes a positive integer and returns 0 or 1.
This is assumed to represent a bent Boolean function on :math:`\mathbb{F}_2^{dim}`
via lexicographical ordering.
OUTPUT:
An object of class ``Graph``, representing the graph corresponding to
the linear code of the bent Boolean function represented by ``f``.
.. WARNING::
This function raises a ``ValueError`` if ``f`` is not bent.
REFERENCES:
.. [Car2010]_
.. [DD2015]_ Corollary 10.
EXAMPLES:
Where bf is a bent function.
::
sage: from sage.crypto.boolean_function import BooleanFunction
sage: bf = BooleanFunction([0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,1])
sage: bf.is_bent()
True
sage: dim = bf.nvariables()
sage: from boolean_cayley_graphs.boolean_linear_code_graph import boolean_linear_code_graph
sage: bg = boolean_linear_code_graph(dim, bf)
sage: bg.is_strongly_regular()
True
Where f is not a bent function.
::
sage: from sage.crypto.boolean_function import BooleanFunction
sage: f = BooleanFunction([0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,1])
sage: f.is_bent()
False
sage: from boolean_cayley_graphs.boolean_linear_code_graph import boolean_linear_code_graph
sage: dim = f.nvariables()
sage: g = boolean_linear_code_graph(dim, f)
Traceback (most recent call last):
...
ValueError: too many values to unpack (expected 2)
)r r )�dim�f�L� r �S/home/user/Boolean-Cayley-graphs/boolean_cayley_graphs/boolean_linear_code_graph.py�boolean_linear_code_graph"