top of page
An introduction to network theory and algorithms can be found at www.tensors.net

Quickstart Guide:

Diagrammatic Notation:

TensorTrace facilitates the creation of tensor networks using the diagrammatic notation common for this field. Some examples are given below. 
Eq1b.png
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.
g1.png
Eq4.png
g2.png
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.
f2.png
  • 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
g3.png
  • 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

Export Networks to Code:

Advanced export: select export code in order to save a function file containing code for up to four distinct networks. 
  • ideal for more complicated networks and projects. 
  • presents the user with a choice of many different solver routines for determining the contraction order.
  • exported code includes auto-differentiation; all single tensor environments from a closed network can be obtained (see Example section). 
  • exported code includes information about the cost scaling and FLOPS required for each network contraction. 
There are two ways that TensorTrace can be used to generate code:
Simple export: export a selected network to code with ctrl-C then paste into a text editor.
  • ideal for smaller networks.
  • uses a quick solver routine for determining the contraction order (not guaranteed to produce the optimal order for large networks).
  • exported code can be configured in the config menu (code language, initialization data, diagram meta-data).
  • network diagrams can be reconstructed by ctrl-V pasting code back into TensorTrace, just include the meta-data, `tensors` and `connects` code lines in the copy.
  • Using the exported code as part of a tensor network algorithm is easy; see the example page for more details.
  • 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.
  • 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.
  • Assign a network number [1-4] to the tensors in each network that you wish to compile using the top menu after selecting each network (or pressing the 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.
Advanced Export: How to compile networks into a function file
screensmall.png
Sample output from the tensor network solver

Controls Reference:

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

Tutorial:

bottom of page