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
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
t
n
]
r
e
t
u
r
n
s
t
h
e
l
i
s
t
o
f
i
n
d
e
x
d
i
m
e
n
s
i
o
n
r
u
l
e
s
f
o
r
e
v
e
r
y
i
n
d
e
x
o
c
c
u
r
r
e
n
c
e
i
n
t
h
e
t
e
n
s
o
r
n
e
t
w
o
r
k
t
n
.
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
i
n
d
i
c
e
s
,
t
e
n
s
o
r
s
]
c
o
m
p
u
t
e
s
t
h
e
r
u
l
e
s
f
r
o
m
a
n
e
x
p
l
i
c
i
t
l
i
s
t
o
f
p
e
r
-
t
e
n
s
o
r
i
n
d
e
x
l
i
s
t
s
a
n
d
a
n
e
x
p
l
i
c
i
t
l
i
s
t
o
f
t
e
n
s
o
r
s
.
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
n
e
t
]
r
e
t
u
r
n
s
t
h
e
i
n
d
e
x
-
d
i
m
e
n
s
i
o
n
r
u
l
e
s
o
f
t
h
e
g
r
a
p
h
f
o
r
m
n
e
t
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
Examples
(
5
)
Scope
(
3
)
Duplicates for shared indices
(
1
)
Each index appears once per occurrence;
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
does not deduplicate, so a shared label appears as many times as the number of tensors containing it.
I
n
[
1
]
:
=
S
e
e
d
R
a
n
d
o
m
[
1
]
;
t
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
,
1
}
,
{
2
,
3
}
]
,
R
a
n
d
o
m
R
e
a
l
[
{
-
1
,
1
}
,
{
3
,
4
}
]
}
,
{
{
i
,
j
}
,
{
j
,
k
}
}
]
;
I
n
[
2
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
t
n
]
O
u
t
[
2
]
=
{
i
2
,
j
3
,
j
3
,
k
4
}
Wrap with
…
to collapse duplicates into a unique-key lookup table; later rules overwrite earlier ones with the same key, which is safe here because the dimensions agree:
I
n
[
3
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
t
n
]
O
u
t
[
3
]
=
i
2
,
j
3
,
k
4
Or use
G
r
o
u
p
B
y
[
F
i
r
s
t
]
to keep every occurrence under its index key, exposing the per-tensor multiplicity:
I
n
[
4
]
:
=
G
r
o
u
p
B
y
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
t
n
]
,
F
i
r
s
t
O
u
t
[
4
]
=
i
{
i
2
}
,
j
{
j
3
,
j
3
}
,
k
{
k
4
}
G
r
a
p
h
f
o
r
m
(
1
)
P
r
o
p
e
r
t
y
f
o
r
m
(
1
)
A
p
p
l
i
c
a
t
i
o
n
s
(
1
)
P
r
o
p
e
r
t
i
e
s
&
R
e
l
a
t
i
o
n
s
(
1
)
S
e
e
A
l
s
o
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
D
a
t
a
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
i
c
e
s
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
F
r
e
e
I
n
d
i
c
e
s
▪
C
o
u
n
t
s
▪
T
h
r
e
a
d
▪
A
s
s
o
c
i
a
t
i
o
n
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
Get the dimension of each index occurrence in a tensor network:
I
n
[
1
]
:
=
t
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
,
1
}
,
{
2
,
3
}
]
,
R
a
n
d
o
m
R
e
a
l
[
{
-
1
,
1
}
,
{
3
,
4
}
]
}
,
{
{
1
,
2
}
,
{
2
,
3
}
}
]
;
I
n
[
2
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
t
n
]
O
u
t
[
2
]
=
{
1
2
,
2
3
,
2
3
,
3
4
}
The shared index
2
appears in both tensors, so it contributes two rules with the same right-hand side. The free indices
1
and
3
contribute one rule each.
The same dimensions show up for a structured network such as a 4-site matrix product state:
I
n
[
3
]
:
=
S
e
e
d
R
a
n
d
o
m
[
4
2
]
;
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
R
a
n
d
o
m
T
e
n
s
o
r
N
e
t
w
o
r
k
[
"
M
P
S
"
[
4
,
2
,
2
]
]
O
u
t
[
3
]
=
{
1
2
,
5
2
,
1
2
,
2
2
,
6
2
,
2
2
,
3
2
,
7
2
,
3
2
,
8
2
}
Every bond index (
1
,
2
,
3
) appears twice; every physical index (
5
,
6
,
7
,
8
) appears once. The right-hand sides agree across occurrences of the same index.
The low-level form takes explicit per-tensor indices and dimensions directly, with no TensorNetwork object involved:
I
n
[
4
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
"
I
n
d
i
c
e
s
"
{
{
1
,
2
}
}
,
"
D
i
m
e
n
s
i
o
n
s
"
{
{
3
,
4
}
}
]
O
u
t
[
4
]
=
{
1
3
,
2
4
}
The two-argument form is equivalent and takes the dimensions from the tensor list directly:
I
n
[
5
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
I
n
d
e
x
D
i
m
e
n
s
i
o
n
s
[
{
{
1
,
2
}
,
{
2
,
3
}
}
,
{
R
a
n
d
o
m
R
e
a
l
[
{
-
1
,
1
}
,
{
2
,
3
}
]
,
R
a
n
d
o
m
R
e
a
l
[
{
-
1
,
1
}
,
{
3
,
4
}
]
}
]
O
u
t
[
5
]
=
{
1
2
,
2
3
,
2
3
,
3
4
}
"
"