Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • 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
    • 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`
RandomTensorNetwork
​
RandomTensorNetwork
[{n,m},maxDim]
creates a random tensor network with graph
RandomGraph[{n,m}]
and bond dimensions up to
maxDim
.
​
​
RandomTensorNetwork
[graph,maxDim]
uses an arbitrary
graph
and samples each bond dimension from
{2,maxDim}
.
​
​
RandomTensorNetwork
[graph,{dim}]
makes every bond dimension exactly
dim
.
​
​
RandomTensorNetwork
[graph,dim,r]
adds up to
r
free legs per vertex on top of its degree.
​
​
RandomTensorNetwork
["MPS"[n,χ,d]]
creates a random Matrix Product State of length
n
, bond dimension
χ
and physical dimension
d
.
​
​
RandomTensorNetwork
["TT"[n,χ]]
creates a Tensor Train of length
n
and bond dimension
χ
(no physical legs).
​
​
RandomTensorNetwork
["MPO"[n,χ,d]]
creates a random Matrix Product Operator of length
n
with bond dimension
χ
and physical dimension
d
.
​
​
RandomTensorNetwork
["PEPS"[{rows,cols},χ,d]]
creates a Projected Entangled Pair State on a
rows×cols
grid.
​
​
RandomTensorNetwork
["TTN"[depth,χ,b]]
creates a Tree Tensor Network of binary depth
depth
with branching factor
b
.
​
​
RandomTensorNetwork
["MERA"[w,χ,L]]
creates a Multi-scale Entanglement Renormalization Ansatz of width
w
and
L
coarse-graining layers.
​
Details and Options
▪
The result of
RandomTensorNetwork
is a
TensorNetwork
object; all its property accessors apply (
"Tensors"
,
"Hyperedges"
,
"FreeIndices"
,
"Bonds"
, …).
▪
For the general graph form, the rank of each vertex is sampled uniformly from
{VertexDegree[v],VertexDegree[v]+r}
; the extra legs are free indices of the resulting network.
▪
Free leg dimensions match bond dimensions: with the
{dim}
form every index has dimension
dim
; with the
maxDim
form every index dimension is an independent random integer in
{2,maxDim}
.
▪
For named topologies the indices are integer labels assigned in a fixed, predictable layout. For an MPS of length
n
, bond indices use
1,…,n-1
and physical indices use
n+1,…,2n
.
▪
For an MPO of length
n
, physical input indices start at
n+1
and physical output indices at
2n+1
; this leaves the bulk bond labels
1,…,n-1
untouched.
▪
The scalar-arguments form
"PEPS"[rows,cols,χ,d]
is equivalent to the list-arguments form
"PEPS"[{rows,cols},χ,d]
.
▪
Tensor entries are independent draws from a uniform distribution on
{-1,1}
(real) or on a complex square of side
2
centered at the origin (
"Complex"
). The state is not normalized.
▪
The following options can be given:
Method
Automatic
use real (default) or complex random tensors
"Boundary"
"Open"
for chain topologies (MPS, TT, MPO), choose "Open" or "Periodic"
​
Examples  
(21)
Basic Examples  
(4)
Create a random tensor network from a small random graph:
In[1]:=
RandomTensorNetwork
[{5,8},3]
Out[1]=
TensorNetwork
Tensors: 5
Binary: Yes
Free indices: 4
Sparse: No
Output dimension: 16
​

​
Create a random Matrix Product State of length 4 with bond dimension 2:
In[1]:=
RandomTensorNetwork
["MPS"[4,2,2]]
Out[1]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 4
Sparse: No
Output dimension: 16
​

​
Use periodic boundary conditions to get a uniform ring of rank-3 tensors:
In[1]:=
RandomTensorNetwork
["MPS"[4,2,2],"Boundary""Periodic"]
Out[1]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 4
Sparse: No
Output dimension: 16
​

​
Properties of the generated network can be queried directly:
In[1]:=
RandomTensorNetwork
["MPS"[4,2,2]]["Hyperedges"]
Out[1]=
{{1,5},{1,2,6},{2,3,7},{3,8}}
Scope  
(11)

Options  
(3)

Applications  
(2)

Properties & Relations  
(1)

SeeAlso
TensorNetwork
 
▪
TensorNetworkQ
 
▪
BinaryTensorNetwork
 
▪
TensorNetworkContract
 
▪
OptimalContractionPath
 
▪
MPSCanonicalForm
 
▪
RandomGraph
 
▪
GraphQ
 
▪
BlockRandom
 
▪
SeedRandom
TechNotes
▪
Building Tensor Networks
​​
▪
​​
MPS Algorithms
RelatedGuides
▪
TensorNetworks
RelatedLinks
▪
Tensor Network on Wikipedia
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com