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

�Ul_��@s~dZddlZddlmmZddlmZddl	m
Z
ddlmZddl
mZddlmZddlmZdd	d
�Zddd
�ZdS)a	
Classification in parallel using MPI
====================================

The ``classify_in_mpi_parallel`` module defines functions that
use MPI to save Cayley graph classifications or partial classifications in parallel.

AUTHORS:

- Paul Leopardi (2017-10-13)

�N)�log)�BooleanFunction)�
Function_ceil)�BentFunction)�save_one_classification)�save_one_class_partcCsl|��}|��}|dkr t|�}t||||�D]6}|dt|�}	t||�jdd�}
t|	|
|d�q0dS)a�
    Using MPI, construct and save a number of Cayley graph classifications
    corresponding to a list of bent functions.

    INPUT:

    - ``comm`` -- MPI communicator.
    - ``name_prefix`` -- String. Name prefix to use with ``save_mangled`` to save each classification.
    - ``list_of_f`` -- List of forms or bent functions.
    - ``start`` -- Integer. Default=0. Index of start position in the list.
    - ``stop`` -- Integer. Default=None. Index after end position, or ``None`` if whole remaining list.
    - ``directory`` -- string, optional. The directory where the object
      is to be saved. Default is None, meaning the current directory.

    OUTPUT: None.

    EFFECT: Uses ``name`` to save the classifications corresponding to ``list_of_f``.
    N�_�hex)�format)�	directory)�Get_rank�Get_size�len�range�strr�truth_tabler)�comm�name_prefixZ	list_of_f�start�stopr�rank�size�n�name�form�r�R/home/user/Boolean-Cayley-graphs/boolean_cayley_graphs/classify_in_mpi_parallel.py� save_classifications_in_parallels�r�cCs�|��}|��}t|�}|��}d|}	t�}
|
|	d|�}||krX||}|d}
n|}|}
|
t|d��}t||
|�D]8}dj||d�}t|d||||||d|d�qzd	S)
a�
    Using MPI, construct a complete list of the partial Cayley graph classifications
    corresponding to a given bent function or algebraic normal form.

    INPUT:

    - ``comm`` -- MPI communicator.
    - ``name_prefix`` -- String. Name prefix to use with ``save_mangled`` to save each class part.
    - ``form`` -- A bent function or an algebraic normal form.
    - ``c_len`` -- Integer. Default=1. The number of values of `c` to use in each class part.
    - ``directory`` -- string, optional. The directory where the object
      is to be saved. Default is None, meaning the current directory.

    OUTPUT: None.

    EFFECT: Uses ``name_prefix`` to save all partial classifications corresponding to ``bentf``.
    �g�?r�
z
{0:0={width}})�widthr)r�bentf�c_start�c_stoprN)	rr
r�
nvariablesrrrr
r)rrr�c_lenrrrr"�dim�v�ceilZ	nbr_partsZbeg_nZend_nZ
nbr_digitsrZn_strrrr�save_class_parts_in_parallelFs,


�r*)rNN)rN)�__doc__�builtins�@py_builtins�_pytest.assertion.rewrite�	assertion�rewrite�
@pytest_ar�mathr�sage.crypto.boolean_functionr�sage.functions.otherr�#boolean_cayley_graphs.bent_functionrZ*boolean_cayley_graphs.classify_in_parallelrrrr*rrrr�<module>s&�
+�