qib.tensor_network.contraction_tree.ContractionTreeNode

class qib.tensor_network.contraction_tree.ContractionTreeNode(tid: int, nL, idxL, nR, idxR, idxout, openaxes, trackaxes)[source]

Bases: object

Node in a binary contraction tree, following numpy.einsum’s index specification convention for describing the contraction.

Member variables:
  • tid: index of new tensor after contraction

  • idxL: contraction indices for left child node tensor

  • idxR: contraction indices for right child node tensor

  • idxout: contraction indices for new (output) tensor

  • openaxes: list of open axes of the leaf tensors, of the form [(tid, ax), …]

  • trackaxes: i-th open axis corresponds to trackaxes[i]-th leg of node tensor;

    in general not bijective due to partial contractions from multi-edges

  • parent: parent node

  • children: [nL, nR], left and right child nodes

Methods

permute_axes

Permute the axes of the tensor represented by the node.

Attributes

is_leaf

Whether this node is a leaf.

ndim

Logical number of dimensions (degree) of the tensor represented by the node.

property is_leaf

Whether this node is a leaf.

property ndim

Logical number of dimensions (degree) of the tensor represented by the node.

permute_axes(sort_indices)[source]

Permute the axes of the tensor represented by the node.