Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
22144 views
o

I��cR�@s<dZddlmZddlmZddlmZdd�Zdd�Zd	S)
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

�)�%strongly_regular_from_two_weight_code)�boolean_linear_code)�linear_code_from_code_genscCst||�}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)

    )rr)�dim�f�L�r�S/home/user/Boolean-Cayley-graphs/boolean_cayley_graphs/boolean_linear_code_graph.py�boolean_linear_code_graph"s
:r
cCst|�}t|�S)a�
    Return the strongly regular graph corresponding to a list of generators.

    INPUT:

    - ``gens`` -- list. A list of strings of 0,1 characters.
      This is assumed to represent the generators of a
      projective two-weight linear code which yields a strongly regular graph.

    OUTPUT:

    An object of class ``Graph``, representing the graph corresponding to
    the generators represented by ``gens``.

    .. WARNING::

        This function raises a ``ValueError`` if ``gens`` is not a list of
        generators of a projective two-weight linear code which yields a
        strongly regular graph.

    EXAMPLES:

    ::

        Where ``gens`` is a list of generators for a code yielding a
        strongly regular graph.

        sage: from boolean_cayley_graphs.boolean_linear_code_graph import strongly_regular_from_code_gens
        sage: gens = [
        ....: "100001",
        ....: "010100",
        ....: "001100",
        ....: "000011"]
        sage: g = strongly_regular_from_code_gens(gens)
        sage: g.is_strongly_regular()
        True

    ::

        Where ``nongens`` is a list of generators for a code that does *not*
        yield a strongly regular graph.

        sage: nongens = [
        ....: "10001",
        ....: "01000",
        ....: "00100",
        ....: "00011"]
        sage: nong = strongly_regular_from_code_gens(nongens)
        Traceback (most recent call last):
            ...
        ValueError: too many values to unpack (expected 2)

    )rr)�gensrrrr	�strongly_regular_from_code_gens`s6rN)�__doc__�sage.graphs.strongly_regular_dbr�)boolean_cayley_graphs.boolean_linear_coderrr
rrrrr	�<module>s>