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
TreePath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
o
r
k
f
r
o
m
a
t
e
n
s
o
r
-
n
e
t
w
o
r
k
G
r
a
p
h
p
r
o
d
u
c
e
d
b
y
T
o
T
e
n
s
o
r
N
e
t
w
o
r
k
G
r
a
p
h
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
▪
Repeated indices in the hyperedge lists denote contractions; indices appearing exactly once are free (output) indices.
▪
Hyperedge entries can be integers or symbols, but every entry of a single hyperedge list
h
must have length equal to the rank of the corresponding tensor.
▪
When the third argument is
A
u
t
o
m
a
t
i
c
(the default), the free indices of the network are derived from the hyperedge structure in their order of first appearance.
▪
T
e
n
s
o
r
N
e
t
w
o
r
k
objects support property access via the syntax
t
n
[
"
P
r
o
p
e
r
t
y
"
]
; use
t
n
[
"
P
r
o
p
e
r
t
i
e
s
"
]
to list every supported key.
▪
Use
T
e
n
s
o
r
N
e
t
w
o
r
k
C
o
n
t
r
a
c
t
to evaluate the network to a single tensor; the contraction path can be supplied explicitly or chosen by
G
r
e
e
d
y
C
o
n
t
r
a
c
t
i
o
n
P
a
t
h
or
O
p
t
i
m
a
l
C
o
n
t
r
a
c
t
i
o
n
P
a
t
h
.
▪
A network is binary when every index appears in at most two tensors; use
B
i
n
a
r
y
T
e
n
s
o
r
N
e
t
w
o
r
k
to convert a hyper-edge network (an index shared by three or more tensors) to its binary equivalent by inserting copy tensors.
B
i
n
a
r
y
T
e
n
s
o
r
N
e
t
w
o
r
k
Q
tests for that condition.
▪
Output cells display a summary box (icon, tensor count, free-index count, binary/sparse flags, output dimension) generated by an upvalue on
M
a
k
e
B
o
x
e
s
; the icon is the network's hypergraph for binary networks with at most ten tensors and a placeholder graph otherwise.
Examples
(
3
5
)
Basic Examples
(
2
)
Create a tensor network representing matrix multiplication:
I
n
[
1
]
:
=
t
n
=
B
l
o
c
k
R
a
n
d
o
m
R
a
n
d
o
m
S
e
e
d
[
1
]
;
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
}
,
{
3
,
2
,
3
}
,
{
3
,
4
}
}
,
{
{
i
,
j
}
,
{
j
,
k
,
l
}
,
{
l
,
m
}
}
]
O
u
t
[
1
]
=
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
:
3
S
p
a
r
s
e
:
N
o
O
u
t
p
u
t
d
i
m
e
n
s
i
o
n
:
1
6
Visualize the tensor network structure:
I
n
[
2
]
:
=
t
n
[
"
H
y
p
e
r
g
r
a
p
h
"
]
O
u
t
[
2
]
=
Contract the network to get the result:
I
n
[
3
]
:
=
T
e
n
s
o
r
N
e
t
w
o
r
k
C
o
n
t
r
a
c
t
[
t
n
]
O
u
t
[
3
]
=
{
{
{
0
.
4
5
0
2
1
6
,
0
.
2
4
4
8
5
4
,
1
.
0
7
4
8
9
,
1
.
3
8
9
6
9
}
,
{
0
.
5
4
9
7
4
3
,
0
.
3
2
9
5
6
3
,
1
.
0
8
8
6
5
,
1
.
2
3
5
9
1
}
}
,
{
{
0
.
5
6
8
6
4
2
,
0
.
3
1
6
7
6
9
,
1
.
3
3
9
3
2
,
1
.
7
6
7
4
2
}
,
{
0
.
6
1
1
2
3
3
,
0
.
3
7
1
5
6
8
,
1
.
1
7
5
2
4
,
1
.
3
0
5
0
6
}
}
}
Define a collection of randomly-generated complex tensors with some given dimensions:
I
n
[
1
]
:
=
t
e
n
s
o
r
s
=
S
p
a
r
s
e
A
r
r
a
y
[
R
a
n
d
o
m
C
o
m
p
l
e
x
[
{
-
1
-
I
,
1
+
I
}
,
#
]
]
&
/
@
{
{
3
,
4
}
,
{
3
,
3
,
4
}
,
{
3
,
3
,
4
}
,
{
3
,
4
}
}
;
Given tensors, define the tensor network by feeding indices:
I
n
[
2
]
:
=
t
n
=
T
e
n
s
o
r
N
e
t
w
o
r
k
[
t
e
n
s
o
r
s
,
{
{
1
,
5
}
,
{
1
,
2
,
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