cotengra.path_greedy#

Module Contents#

Classes#

GreedyCompressed

A greedy contraction path finder that takes into account the effect of

GreedySpan

A contraction path optimizer that greedily generates spanning trees out

Functions#

cost_memory_removed_mod(size12, size1, size2, k12, k1, k2)

The default heuristic cost, corresponding to the total reduction in

trial_greedy(inputs, output, size_dict[, ...])

greconf_rf(inputs, output, size_dict[, memory_limit])

Greedy-reconf path -- find a single greedy path then perform a round of

greconf_rw(inputs, output, size_dict[, memory_limit])

Greedy-reconf path -- find a single greedy path then perform a round of

greconf_rc(inputs, output, size_dict[, memory_limit])

Greedy-reconf path -- find a single greedy path then perform a round of

_binary_combine(func, x, y)

gumbel()

greedy_compressed(inputs, output, size_dict[, ...])

trial_greedy_compressed(inputs, output, size_dict, ...)

greedy_span(inputs, output, size_dict[, memory_limit])

trial_greedy_span(inputs, output, size_dict, **kwargs)

Attributes#

cotengra.path_greedy.cost_memory_removed_mod(size12, size1, size2, k12, k1, k2, costmod=1, usesizes=True)#

The default heuristic cost, corresponding to the total reduction in memory of performing a contraction.

cotengra.path_greedy.trial_greedy(inputs, output, size_dict, random_strength=0.1, temperature=1.0, rel_temperature=True, costmod=1, usesizes=True)#
cotengra.path_greedy.greconf_rf(inputs, output, size_dict, memory_limit=None)#

Greedy-reconf path – find a single greedy path then perform a round of cheap subtree reconfigurations to optimize it.

cotengra.path_greedy.greconf_rw(inputs, output, size_dict, memory_limit=None)#

Greedy-reconf path – find a single greedy path then perform a round of cheap subtree reconfigurations to optimize it.

cotengra.path_greedy.greconf_rc(inputs, output, size_dict, memory_limit=None)#

Greedy-reconf path – find a single greedy path then perform a round of cheap subtree reconfigurations to optimize it.

cotengra.path_greedy._binary_combine(func, x, y)#
cotengra.path_greedy.gumbel()#
class cotengra.path_greedy.GreedyCompressed(chi, coeff_size_compressed=1.0, coeff_size=0.0, coeff_size_inputs=0.0, score_size_inputs='max', coeff_subgraph=0.0, score_subgraph='sum', coeff_centrality=0.0, centrality_combine='max', score_centrality='diff', temperature=0.0, score_perm='')#

A greedy contraction path finder that takes into account the effect of compression, and can also make use of subgraph size and centrality.

Parameters:
  • chi (int) – The maximum bond size between nodes to compress to.

  • coeff_size_compressed (float, optional) – When assessing contractions, how to weight the size of the output tensor, post compression.

  • coeff_size (float, optional) – When assessing contractions, how to weight the size of the output tenor, pre compression.

  • coeff_size_inputs (float, optional) – When assessing contractions, how to weight the maximum size of the inputs tensors.

  • score_size_inputs ({'sum', 'mean', 'max', 'min', 'diff'}, optional) – When assessing contractions, how to score the combination of the two input tensor sizes.

  • coeff_subgraph_size (float, optional) – When assessing contractions, how to weight the total subgraph size corresponding to the inputs tensors.

  • score_subgraph_size ({'sum', 'mean', 'max', 'min', 'diff'}, optional) – When assessing contractions, how to score the combination of the two input subgraph sizes.

  • coeff_centrality (float, optional) – When assessing contractions, how to weight the combined centrality of the inputs tensors.

  • centrality_combine ({'sum', 'mean', 'max', 'min'}, optional) – When performing the contraction, how to combine the two input tensor centralities to produce a new one.

  • score_centrality ({'sum', 'mean', 'max', 'min', 'diff'}, optional) – When assessing contractions, how to score the combination of the two input tensor centralities.

  • temperature (float, optional) – A noise level to apply to the scores when choosing nodes to expand to.

_score(i1, i2)#
get_ssa_path(inputs, output, size_dict)#
__call__(inputs, output, size_dict, memory_limit=None)#
cotengra.path_greedy.greedy_compressed(inputs, output, size_dict, memory_limit=None, **kwargs)#
cotengra.path_greedy.trial_greedy_compressed(inputs, output, size_dict, **kwargs)#
class cotengra.path_greedy.GreedySpan(start='max', coeff_connectivity=1.0, coeff_ndim=1.0, coeff_distance=-1.0, coeff_next_centrality=0.0, weight_bonds=True, temperature=0.0, score_perm='CNDLTI', distance_p=1, distance_steal='abs')#

A contraction path optimizer that greedily generates spanning trees out of particular nodes, suitable for e.g. compressed contraction paths.

Parameters:
  • start ({'max', 'min'}, optional) – Whether to start the span from the maximum or minimum centrality point.

  • coeff_connectivity (float, optional) – When considering adding nodes to the span, how to weight the nodes connectivity to the current span.

  • coeff_ndim (float, optional) – When considering adding nodes to the span, how to weight the nodes total rank.

  • coeff_distance (float, optional) – When considering adding nodes to the span, how to weight the nodes distance to the starting point.

  • coeff_next_centrality (float, optional) – When considering adding nodes to the span, how to weight the nodes centrality.

  • weight_bonds

  • temperature (float, optional) – A noise level to apply to the scores when choosing nodes to expand to.

  • score_perm

  • distance_p

  • distance_steal

get_ssa_path(inputs, output, size_dict)#
search(inputs, output, size_dict)#
__call__(inputs, output, size_dict, memory_limit=None)#
cotengra.path_greedy.greedy_span(inputs, output, size_dict, memory_limit=None, **kwargs)#
cotengra.path_greedy.trial_greedy_span(inputs, output, size_dict, **kwargs)#
cotengra.path_greedy._allowed_perms#