3
���h� � @ s� d Z ddlZddlZddlmZ ddlmZmZ ddlm Z ddgZ
dZee�Z
d d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zddd�dd�Ze edd�d d!d�d"d��Zddd#�d$d%�Ze edd�dd!d#�d&d��ZdS )'z&
Implementation of optimized einsum.
� N)�c_einsum)�
asanyarray� tensordot)�array_function_dispatch�einsum�einsum_path�4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZc C s, t | |�}td|d �}|r$|d7 }|| S )a�
Computes the number of FLOPS in the contraction.
Parameters
----------
idx_contraction : iterable
The indices involved in the contraction
inner : bool
Does this contraction require an inner product?
num_terms : int
The number of terms in a contraction
size_dictionary : dict
The size of each of the indices in idx_contraction
Returns
-------
flop_count : int
The total number of FLOPS required for the contraction.
Examples
--------
>>> _flop_count('abc', False, 1, {'a': 2, 'b':3, 'c':5})
30
>>> _flop_count('abc', True, 2, {'a': 2, 'b':3, 'c':5})
60
� )�_compute_size_by_dict�max)Zidx_contraction�innerZ num_termsZsize_dictionaryZoverall_sizeZ op_factor� r
�6/tmp/pip-build-5_djhm0z/numpy/numpy/core/einsumfunc.py�_flop_count s
r c C s" |