full name: tenpy.algorithms.network_contractor.ncon
- tenpy.algorithms.network_contractor.ncon(tensor_list, leg_links, sequence=None)[source]¶
ncon.mfor TeNPy Arrays.
This function is a python implementation of
ncon.m(arXiv:1304.6112) for tenpy
contract()is a wrapper that translates from a more python/tenpy input style
tensor_list (iterable of :class:'Array') – Tensors to be contracted.
leg_links (iterable of iterable of int) – Each entry of leg_links describes the connectivity of the corresponding tensor in tensor_list. Each entry is a sequence (e.g. a list) that has an integer value for each leg of the corresponding tensor. Positive values
1,2,...are labels of contracted legs and should appear exactly twice in leg_links. Negative values
-1,-2,-3,...are labels of uncontracted legs and indicate the final ordering (
-1is the first axis).
sequence (list of int, optional) – The order in which the contractions (indicated by positive values in leg_links are to be performed. Ascending order is used by default An entry of network_contractor.outer_product indicates performing an outer product. This corresponds to the zero-in-sequence convention of arXiv:1304.6112
result – The number or tensor resulting from the contraction.
- Return type