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
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
SparseTensorNetwork
TableauColumns
TableauDimension
TableauRows
TableauShape
TableauSize
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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
A
c
t
i
v
a
t
e
@
E
i
n
s
t
e
i
n
S
u
m
m
a
t
i
o
n
[
{
{
1
,
2
,
3
}
,
{
2
,
4
}
}
,
{
A
,
B
}
]
O
u
t
[
3
]
=
S
p
a
r
s
e
A
r
r
a
y
S
p
e
c
i
f
i
e
d
e
l
e
m
e
n
t
s
:
8
D
i
m
e
n
s
i
o
n
s
:
{
2
,
2
,
2
}
Check the result is the same as running summation manually:
I
n
[
4
]
:
=
T
a
b
l
e
[
S
u
m
[
A
〚
i
,
j
,
k
〛
B
〚
j
,
l
〛
,
{
j
,
3
}
]
,
{
i
,
2
}
,
{
k
,
2
}
,
{
l
,
2
}
]
e
i
n
s
u
m
O
u
t
[
4
]
=
T
r
u
e
Use string notation for compact expressions:
I
n
[
5
]
:
=
A
c
t
i
v
a
t
e
@
E
i
n
s
t
e
i
n
S
u
m
m
a
t
i
o
n
[
"
i
j
k
,
j
l
"
,
{
A
,
B
}
]
e
i
n
s
u
m
O
u
t
[
5
]
=
T
r
u
e
Use string notation for compact expressions:
I
n
[
1
]
:
=
A
=
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
}
,
{
2
,
3
,
2
}
]
;
B
=
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
,
2
}
]
;
A
c
t
i
v
a
t
e
@
E
i
n
s
t
e
i
n
S
u
m
m
a
t
i
o
n
[
"
i
j
k
,
j
l
-
>
l
k
"
,
{
A
,
B
}
]
A
c
t
i
v
a
t
e
@
E
i
n
s
t
e
i
n
S
u
m
m
a
t
i
o
n
[
{
{
i
,
j
,
k
}
,
{
j
,
l
}
}
{
l
,
k
}
,
{
A
,
B
}
]
O
u
t
[
1
]
=
T
r
u
e
Define two symbolic arrays of 3-rank and 2-rank with dimension
{
n
1
,
n
2
,
n
3
}
and
{
n
2
,
n
4
}
:
I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