cotengra.presets

Preset configured optimizers.

Module Contents

Classes

AutoOptimizer

An optimizer that automatically chooses between optimal and

AutoHQOptimizer

An optimizer that automatically chooses between optimal and

Functions

estimate_optimal_hardness(inputs)

Provides a very rough estimate of how long it would take to find the

Attributes

cotengra.presets.estimate_optimal_hardness(inputs)[source]

Provides a very rough estimate of how long it would take to find the optimal contraction order for a given set of inputs. The runtime is very approximately exponential in this number:

\[T \propto \exp {n^2 * k^0.5}\]

Where \(n\) is the number of tensors and \(k\) is the average degree of the hypergraph.

class cotengra.presets.AutoOptimizer(optimal_cutoff=250, minimize='combo', cache=True, **hyperoptimizer_kwargs)[source]

Bases: cotengra.oe.PathOptimizer

An optimizer that automatically chooses between optimal and hyper-optimization, designed for everyday use.

_get_optimizer_hyper_threadsafe()[source]
search(inputs, output, size_dict, **kwargs)[source]
__call__(inputs, output, size_dict, **kwargs)[source]
class cotengra.presets.AutoHQOptimizer(**kwargs)[source]

Bases: AutoOptimizer

An optimizer that automatically chooses between optimal and hyper-optimization, designed for everyday use on harder contractions or those that will be repeated many times, and thus warrant a more extensive search.

cotengra.presets.auto_optimize
cotengra.presets.auto_hq_optimize
cotengra.presets.greedy_optimize
cotengra.presets.optimal_optimize
cotengra.presets.optimal_outer_optimize