tensornetwork.contractors.optimal¶
-
tensornetwork.contractors.optimal(nodes: Iterable[tensornetwork.network_components.AbstractNode], output_edge_order: Optional[Sequence[tensornetwork.network_components.Edge]] = None, memory_limit: Optional[int] = None, ignore_edge_order: bool = False) → tensornetwork.network_components.AbstractNode¶ Optimal contraction order via
opt_einsum.This method will find the truly optimal contraction order via
opt_einsum’s depth first search algorithm. Since this search is exhaustive, if your network is large (n>10), then the search may take longer than just contracting in a suboptimal way.Parameters: - nodes – an iterable of Nodes
- output_edge_order – An optional list of edges.
Edges of the final node in
nodes_setare reordered intooutput_edge_order; if final node has more than one edge,output_edge_ordermust be provided. - memory_limit – Maximum number of elements in an array during contractions.
- ignore_edge_order – An option to ignore the output edge order.
Returns: The final node after full contraction.