cotengra.pathfinders.path_compressed_greedy

Greedy contraction tree finders.

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

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

_binary_combine(func, x, y)

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.pathfinders.path_compressed_greedy.ssa_greedy_optimize
cotengra.pathfinders.path_compressed_greedy.trial_greedy(inputs, output, size_dict, random_strength=0.0, temperature=0.0, costmod=1.0)[source]
cotengra.pathfinders.path_compressed_greedy._binary_combine(func, x, y)[source]
class cotengra.pathfinders.path_compressed_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='', early_terminate_size=None, seed=None)[source]

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)[source]
get_ssa_path(inputs, output, size_dict)[source]
search(inputs, output, size_dict)[source]
__call__(inputs, output, size_dict, memory_limit=None)[source]
cotengra.pathfinders.path_compressed_greedy.greedy_compressed(inputs, output, size_dict, memory_limit=None, **kwargs)[source]
cotengra.pathfinders.path_compressed_greedy.trial_greedy_compressed(inputs, output, size_dict, **kwargs)[source]
class cotengra.pathfinders.path_compressed_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', seed=None)[source]

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)[source]
search(inputs, output, size_dict)[source]
__call__(inputs, output, size_dict, memory_limit=None)[source]
cotengra.pathfinders.path_compressed_greedy.greedy_span(inputs, output, size_dict, memory_limit=None, **kwargs)[source]
cotengra.pathfinders.path_compressed_greedy.trial_greedy_span(inputs, output, size_dict, **kwargs)[source]
cotengra.pathfinders.path_compressed_greedy._allowed_perms