Skip to content

How to manually contract a tensor network in quimb? #156

Answered by jcmgray
cotejer asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @cotejer, here are a couple of very explicit methods, which might indeed be useful to include in quimb at some point...

Some setup:

tn = qtn.HTN2D_classical_ising_partition_function(10, 10, beta=0.44)
output_inds = ()  # if hyper tensor network we need to specify these
path = tn.contraction_path(optimize="auto-hq", output_inds=output_inds)
tree = tn.contraction_tree(optimize="auto-hq", output_inds=output_inds)

The tree object has a lot more information (plot_tent, print_contractions etc.) and stores the tree/path in a, I think, more intuitive format:

def contract_explicit_tree(self, tree, output_inds=None, inplace=False):
    tn = self if inplace else self.copy()

    # map between nod…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cotejer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants