Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
Cloud & Deployment
Core Language & Structure
Data Manipulation & Analysis
Engineering Data & Computation
External Interfaces & Connections
Financial Data & Computation
Geographic Data & Computation
Geometry
Graphs & Networks
Higher Mathematical Computation
Images
Knowledge Representation & Natural Language
Machine Learning
Notebook Documents & Presentation
Scientific and Medical Data & Computation
Social, Cultural & Linguistic Data
Strings & Text
Symbolic & Numeric Computation
System Operation & Setup
Time-Related Computation
User Interface Construction
Visualization & Graphics
Random Paclet
Alphabetical List
Using Paclets
Create a Paclet
Get Started
Download Definition Notebook
Learn More about
Wolfram Language
TensorNetworks
Guides
TensorNetworks
Tech Notes
Building Tensor Networks
Contraction Paths and Execution
Matrix Product States
A Working Tour of the Symmetry Functions
Tensor Networks Overview
Young Tableaux and Tensor Symmetries
Symbols
ActivateTensors
BinaryTensorNetwork
BinaryTensorNetworkQ
CanonicalPath
CanonicalPathQ
ContractIndices
ContractionTree
EinsteinSummation
GreedyContractionPath
HookFactor
HookLength
HookLengths
IndexedMultiply
InitializeTensorNetwork
MetricTensor
MetricTensorQ
MPSCanonicalForm
MPSCanonicalQ
MPSEntanglementEntropy
MPSNormalize
MPSNorm
MPSOverlap
MPSSchmidtValues
MPSTruncate
OptimalContractionPath
PartitionQ
PathIndexContractions
PathQ
PathToTreePath
RandomTensorNetwork
SchurDimension
SparseTensorNetwork
TableauColumns
TableauDimension
TableauRows
TableauShape
TableauSize
TableauWeylDimension
TensorNetworkAdd
TensorNetworkContraction
TensorNetworkContractions
TensorNetworkContract
TensorNetworkData
TensorNetworkDelete
TensorNetworkFreeIndices
TensorNetworkGraphData
TensorNetworkGraphQ
TensorNetworkIndexDimensions
TensorNetworkIndexGraph
TensorNetworkIndices
TensorNetwork
TensorNetworkQ
TensorNetworkRemoveCycles
TensorNetworkReplaceIndices
TensorNetworkSize
TensorNetworkTensors
TensorNetworkToNetGraph
ToTensorNetworkGraph
TransposePartition
TreePathQ
TreePathToPath
YoungProject
YoungSymmetrize
YoungTableau
YoungTableauQ
Wolfram`TensorNetworks`
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
t
n
,
t
e
n
s
o
r
,
i
n
d
i
c
e
s
]
a
p
p
e
n
d
s
t
e
n
s
o
r
t
o
t
h
e
t
e
n
s
o
r
n
e
t
w
o
r
k
t
n
w
i
t
h
t
h
e
g
i
v
e
n
h
y
p
e
r
e
d
g
e
i
n
d
i
c
e
s
.
•
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
g
r
a
p
h
,
t
e
n
s
o
r
,
i
n
d
e
x
]
a
p
p
e
n
d
s
t
e
n
s
o
r
t
o
a
T
o
T
e
n
s
o
r
N
e
t
w
o
r
k
G
r
a
p
h
a
n
n
o
t
a
t
e
d
g
r
a
p
h
,
c
o
n
n
e
c
t
i
n
g
i
t
a
t
i
n
d
e
x
.
•
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
g
r
a
p
h
,
L
a
b
e
l
e
d
[
t
e
n
s
o
r
,
l
a
b
e
l
]
,
i
n
d
e
x
]
a
t
t
a
c
h
e
s
a
v
e
r
t
e
x
l
a
b
e
l
i
n
t
h
e
G
r
a
p
h
f
o
r
m
.
•
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
g
r
a
p
h
,
t
e
n
s
o
r
]
s
e
l
e
c
t
s
i
n
d
i
c
e
s
a
u
t
o
m
a
t
i
c
a
l
l
y
f
r
o
m
t
h
e
c
u
r
r
e
n
t
f
r
e
e
i
n
d
i
c
e
s
o
f
g
r
a
p
h
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
▪
The length of
i
n
d
i
c
e
s
must equal the rank of
t
e
n
s
o
r
; otherwise the resulting expression is held and not a valid network.
▪
Any index in
i
n
d
i
c
e
s
that already occurs in the network becomes a contraction in the result; indices not yet present are added to the free-index set.
▪
If
t
n
was constructed with an explicit
"
O
u
t
p
u
t
"
list, the output of the new network drops any index that is no longer free and appends the new free indices contributed by
t
e
n
s
o
r
; otherwise it stays
A
u
t
o
m
a
t
i
c
.
▪
In the Graph form, each new edge is directed: the new vertex receives a
S
u
p
e
r
s
c
r
i
p
t
-indexed leg where it meets a
S
u
b
s
c
r
i
p
t
-indexed leg of the existing graph, and vice versa, so that every contracted edge connects one output index to one input index.
▪
When
i
n
d
e
x
is
A
u
t
o
m
a
t
i
c
in the Graph form, indices are taken in order from
T
e
n
s
o
r
N
e
t
w
o
r
k
F
r
e
e
I
n
d
i
c
e
s
[
g
r
a
p
h
], up to the rank of
t
e
n
s
o
r
. Any remaining slots become fresh free indices on the new vertex.
▪
Calling
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
with a list of disjoint indices is the incremental analogue of constructing the whole network at once with
T
e
n
s
o
r
N
e
t
w
o
r
k
[
{
t
e
n
s
o
r
s
,
…
}
,
{
i
n
d
i
c
e
s
,
…
}
].
Examples
(
1
0
)
Basic Examples
(
1
)
Build a triangle tensor network with three free indices contracted pairwise:
I
n
[
]
:
=
t
1
=
R
a
n
d
o
m
R
e
a
l
[
1
,
{
2
,
3
}
]
;
t
2
=
R
a
n
d
o
m
R
e
a
l
[
1
,
{
3
,
4
}
]
;
t
3
=
R
a
n
d
o
m
R
e
a
l
[
1
,
{
4
,
2
}
]
;
t
4
=
R
a
n
d
o
m
R
e
a
l
[
1
,
{
2
,
2
}
]
;
t
n
=
T
e
n
s
o
r
N
e
t
w
o
r
k
[
{
t
1
,
t
2
,
t
3
}
,
{
{
i
d
x
1
,
i
d
x
2
}
,
{
i
d
x
2
,
i
d
x
3
}
,
{
i
d
x
3
,
i
d
x
1
}
}
]
O
u
t
[
]
=
T
e
n
s
o
r
N
e
t
w
o
r
k
T
e
n
s
o
r
s
:
3
B
i
n
a
r
y
:
Y
e
s
F
r
e
e
i
n
d
i
c
e
s
:
0
S
p
a
r
s
e
:
N
o
O
u
t
p
u
t
d
i
m
e
n
s
i
o
n
:
1
Append a fourth tensor sharing index idx1; idx1 becomes contracted and idx5 enters the free-index set:
I
n
[
]
:
=
n
e
w
T
N
=
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
t
n
,
t
4
,
{
i
d
x
1
,
i
d
x
5
}
]
O
u
t
[
]
=
T
e
n
s
o
r
N
e
t
w
o
r
k
T
e
n
s
o
r
s
:
4
B
i
n
a
r
y
:
N
o
F
r
e
e
i
n
d
i
c
e
s
:
1
S
p
a
r
s
e
:
N
o
O
u
t
p
u
t
d
i
m
e
n
s
i
o
n
:
2
Append the same tensor on two fresh indices instead, leaving the existing network untouched and adding two new free indices:
I
n
[
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
t
n
,
t
4
,
{
n
e
w
A
,
n
e
w
B
}
]
O
u
t
[
]
=
T
e
n
s
o
r
N
e
t
w
o
r
k
T
e
n
s
o
r
s
:
4
B
i
n
a
r
y
:
Y
e
s
F
r
e
e
i
n
d
i
c
e
s
:
2
S
p
a
r
s
e
:
N
o
O
u
t
p
u
t
d
i
m
e
n
s
i
o
n
:
4
Move to the annotated Graph form via ToTensorNetworkGraph and inspect its free indices:
I
n
[
]
:
=
c
h
a
i
n
=
T
e
n
s
o
r
N
e
t
w
o
r
k
[
{
R
a
n
d
o
m
R
e
a
l
[
1
,
{
2
,
3
}
]
,
R
a
n
d
o
m
R
e
a
l
[
1
,
{
3
,
4
}
]
}
,
{
{
a
,
b
}
,
{
b
,
c
}
}
]
;
g
=
T
o
T
e
n
s
o
r
N
e
t
w
o
r
k
G
r
a
p
h
[
c
h
a
i
n
]
O
u
t
[
]
=
Append a rank-2 tensor to the Graph at one of its free legs; the result is a new annotated Graph:
I
n
[
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
A
d
d
[
g
,
e
x
t
r
a
T
e
n
s
o
r
5
,
{
S
u
p
e
r
s
c
r
i
p
t
[
1
,
1
]
}
]
O
u
t
[
]
=
S
c
o
p
e
(
4
)
A
p
p
l
i
c
a
t
i
o
n
s
(
2
)
P
r
o
p
e
r
t
i
e
s
&
R
e
l
a
t
i
o
n
s
(
3
)
S
e
e
A
l
s
o
T
e
n
s
o
r
N
e
t
w
o
r
k
D
e
l
e
t
e
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
R
e
p
l
a
c
e
I
n
d
i
c
e
s
▪
T
o
T
e
n
s
o
r
N
e
t
w
o
r
k
G
r
a
p
h
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
F
r
e
e
I
n
d
i
c
e
s
▪
A
p
p
e
n
d
▪
L
a
b
e
l
e
d
T
e
c
h
N
o
t
e
s
▪
B
u
i
l
d
i
n
g
T
e
n
s
o
r
N
e
t
w
o
r
k
s
R
e
l
a
t
e
d
G
u
i
d
e
s
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
s
"
"