Function Reference

opt_einsum.contract(subscripts, *operands[, …])

Evaluates the Einstein summation convention on the operands.

opt_einsum.contract_path(*operands, **kwargs)

Find a contraction order ‘path’, without performing the contraction.

opt_einsum.contract_expression(subscripts, …)

Generate a reusable expression for a given contraction with specific shapes, which can, for example, be cached.

opt_einsum.contract.ContractExpression(…)

Helper class for storing an explicit contraction_list which can then be repeatedly called solely with the array arguments.

opt_einsum.contract.PathInfo(…)

A printable object to contain information about a contraction path.

opt_einsum.paths.optimal(inputs, output, …)

Computes all possible pair contractions in a depth-first recursive manner, sieving results based on memory_limit and the best path found so far.

opt_einsum.paths.greedy(inputs, output, …)

Finds the path by a three stage algorithm:

opt_einsum.paths.branch(inputs, output, …)

opt_einsum.parser.get_symbol(i)

Get the symbol corresponding to int i - runs through the usual 52 letters before resorting to unicode characters, starting at chr(192).

opt_einsum.sharing.shared_intermediates([cache])

Context in which contract intermediate results are shared.

opt_einsum.paths.PathOptimizer

Base class for different path optimizers to inherit from.

opt_einsum.paths.BranchBound([nbranch, …])

Explores possible pair contractions in a depth-first recursive manner like the optimal approach, but with extra heuristic early pruning of branches as well sieving by memory_limit and the best path found so far.

opt_einsum.path_random.RandomOptimizer([…])

Base class for running any random path finder that benefits from repeated calling, possibly in a parallel fashion.

opt_einsum.path_random.RandomGreedy([…])

Parameters
  • cost_fn (callable, optional) – A function that returns a heuristic ‘cost’ of a potential contraction

opt_einsum.paths.DynamicProgramming([…])

Finds the optimal path of pairwise contractions without intermediate outer products based a dynamic programming approach presented in Phys.