bundles / numpy 2.4.3 / numpy / _core / einsumfunc / _parse_possible_contraction
function
numpy._core.einsumfunc:_parse_possible_contraction
source: /numpy/_core/einsumfunc.py:224
Signature
def _parse_possible_contraction(positions, input_sets, output_set, idx_dict, memory_limit, path_cost, naive_cost)Summary
Compute the cost (removed size + flops) and resultant indices for performing the contraction specified by positions.
Parameters
positions: tuple of intThe locations of the proposed tensors to contract.
input_sets: list of setsThe indices found on each tensors.
output_set: setThe output indices of the expression.
idx_dict: dictMapping of each index to its size.
memory_limit: intThe total allowed size for an intermediary tensor.
path_cost: intThe contraction cost so far.
naive_cost: intThe cost of the unoptimized expression.
Returns
cost: (int, int)A tuple containing the size of any indices removed, and the flop cost.
positions: tuple of intThe locations of the proposed tensors to contract.
new_input_sets: list of setsThe resulting new list of indices if this proposed contraction is performed.
Aliases
numpy._core.einsumfunc._parse_possible_contraction