An introduction to network theory and algorithms can be found at www.tensors.net
TensorTrace facilitates the creation of tensor networks using the diagrammatic notation common for this field. Some examples are given below.
Ex.1: (left) Index notation of a contraction between two tensors 'A' and 'B', and (right) diagrammatic notation used by TensorTrace to represent the same contraction. The index notation makes use of a dummy label 'k' to indicate that the 3rd index of tensor 'A' connects with the 1st index of tensor 'B'. TensorTrace uses numbered plaques within each tensor to convey the same information without the need for dummy labels. The index notation provides the order of indices on the final product tensor 'C' explicitly, while TensorTrace conveys this information in the green plaques, which represent the open index labels. For instance, we can see that the 2nd index of 'B' becomes the 4th index of the output tensor.
Ex.2: (left) Index notation of a contraction between three tensors 'A', 'B', 'C', and (right) diagrammatic notation used by TensorTrace to represent the same contraction.
Creating Networks in TensorTrace:
Draw some tensors
The properties of the tensor that will be created can be set in the "Tensors" tab of the top menu. Create a tensor by holding left-mouse and dragging in the main window.
Tensors can be selected by left-clicking on them. Multiple tensors can be selected by shift-left-clicking, or by dragging while holding right-mouse (or control-left-mouse) to create a selection box.
The properties of selected tensors can be changed in the "Tensors" tab of the top menu, and they can also be transformed in numerous ways (e.g. rotations and reflections).
The numbered plaques on each tensor are referred to as 'anchors': these are the points that indices can attach to the tensor.
Connect the tensors into a network
Create an index by left-clicking on a tensor anchor; complete the index by clicking on another anchor (to created a closed index) or in the playable area (to create an open index).
Index properties (including the index dimensions used in the calculation of computational costs) can be set in the "Indices" tab of the top menu.
Curved indices can be created by left-clicking and dragging the control point of an index
Compile the networks into code
Assign a network number [1-4] to the tensors in each network that you wish to compile using the top menu (or corresponding numeric key). Each project may contain up to 4 different networks. Tensors that are not assigned to a network will be ignored by the compiler.
Check that each network you wish to compile is valid. Valid networks (i) do not contain tensors with free anchors, (ii) contain only tensors with the same network number, (iii) have open index labels that start at '1' and proceed in sequential order. If you try to compile an invalid network the compiler will tell you the reason it is invalid.
Click "Export Code" in the top menu. TensorTrace will search for the optimal order to contract each valid network (warning: this search could take significant time to complete for larger networks). Once completed you can export the contraction code to MATLAB, Python or Julia languages.
Using the exported code as part of a tensor network algorithm is easy; see the example page for more details.
Sample output from the tensor network solver
Create tensors: left-mouse + drag (on free space)
Shift tensors/anchors/tensor vertices: left-mouse + drag (on tensor/anchor/tensor vertex)
Select tensors: left-mouse on tensor (or shift-left to select multiple tensors, or right-mouse + drag for a selection box)
Duplicate selection: right-mouse + drag (on selected tensor or network)
Create indices: left-mouse on a free anchor to create an index, complete the index via left-mouse on another free anchor (for a closed index) or on a free space (for an open index)
Set open index #: num keys 1-9 (while cursor is hovering over open index plaque)
Curve an index: left-mouse + drag on index control point
Assign network #: num keys 1-4 (on selected network)
Scroll viewable area: hold middle-mouse button or arrow keys
Zoom viewable area: mouse-wheel or +/- keys