qib.tensor_network.tensor_network.TensorNetwork¶
- class qib.tensor_network.tensor_network.TensorNetwork(net: SymbolicTensorNetwork, data: dict)[source]¶
Bases:
objectTensor network, consisting of a symbolic network representation, and a dictionary storing the tensor entries addressed by the dataref member variable of the tensors.
Methods
Contract the overall network by a single call of np.einsum.
Contract the overall network based on the contraction tree specified by scaffold.
Perform an internal consistency check, e.g., whether the bond ID specified by any tensor actually exist.
Merge network with another tensor network, and join open axes specified as [(openax_self, openax_other), ...].
Logically transpose the network, i.e., the virtual output tensor of the network.
Wrap a single tensor, i.e., construct a tensor network representation of the tensor.
Attributes
Number of bonds.
Number of open (uncontracted) axes in the network.
Number of logical tensors.
Logical shape of tensor network (after contracting all bonds).
- contract_tree(scaffold)[source]¶
Contract the overall network based on the contraction tree specified by scaffold.
- is_consistent(verbose=False) bool[source]¶
Perform an internal consistency check, e.g., whether the bond ID specified by any tensor actually exist.
- merge(other, join_axes: Sequence[tuple] | None = None)[source]¶
Merge network with another tensor network, and join open axes specified as [(openax_self, openax_other), …].