bundles / numpy latest / numpy / _core / einsumfunc / _find_contraction
function
numpy._core.einsumfunc:_find_contraction
source: build-install/usr/lib/python3.14/site-packages/numpy/_core/einsumfunc.py :90
Signature
def _find_contraction ( positions , input_sets , output_set ) Summary
Finds the contraction for a given set of input and output sets.
Parameters
positions: iterableInteger positions of terms used in the contraction.
input_sets: listList of sets that represent the lhs side of the einsum subscript
output_set: setSet that represents the rhs side of the overall einsum subscript
Returns
new_result: setThe indices of the resulting contraction
remaining: listList of sets that have not been contracted, the new set is appended to the end of this list
idx_removed: setIndices removed from the entire contraction
idx_contraction: setThe indices used in the current contraction
Examples
# A simple dot product test casepos = (0, 1) isets = [set('ab'), set('bc')] oset = set('ac') _find_contraction(pos, isets, oset)# A more complex case with additional terms in the contraction
pos = (0, 2) isets = [set('abd'), set('ac'), set('bdc')] oset = set('ac') _find_contraction(pos, isets, oset)
Aliases
-
numpy._core.einsumfunc._find_contraction