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`
MPSCanonicalQ
​
MPSCanonicalQ
[mps,"Left"]
returns
True
if every tensor of
mps
except the last is left-isometric. •
​
​
MPSCanonicalQ
[mps,"Right"]
returns
True
if every tensor of
mps
except the first is right-isometric. •
​
​
MPSCanonicalQ
[mps,{"Mixed",k}]
returns
True
if sites before
k
are left-isometric and sites after
k
are right-isometric. •
​
​
MPSCanonicalQ
[mps,form,tol]
uses Frobenius-norm tolerance
tol
when comparing each Gram matrix to the identity.
​
Details and Options
Examples  
(3)
Scope  
(1)
Build one MPS and canonicalize it three ways:
In[1]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]]
In[2]:=
MPSCanonicalQ

MPSCanonicalForm
[mps2,"Left"],"Left"
Out[2]=
True
In[3]:=
MPSCanonicalQ

MPSCanonicalForm
[mps2,"Right"],"Right"
Out[3]=
True
In[4]:=
MPSCanonicalQ

MPSCanonicalForm
[mps2,{"Mixed",3}],{"Mixed",3}
Out[4]=
True
​
A raw uncanonicalized MPS is not in any of the three forms:
In[1]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​
MPSCanonicalQ
[mps2,#]&/@{"Left","Right",{"Mixed",3}}
Out[1]=
{False,False,False}
Perturb a left-canonical MPS by a small amount; with the default tolerance the perturbed network no longer passes:
In[2]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​perturbed=BlockRandomSeedRandom[7];left=
MPSCanonicalForm
[mps2,"Left"];
TensorNetwork
[Map[#+
-8
10.
RandomReal[{-1,1},Dimensions[#]]&,left["Tensors"]],left["Hyperedges"],left["Output"]]
In[3]:=
MPSCanonicalQ
[perturbed,"Left"]
Out[3]=
False
​
Relaxing the tolerance to
-6
10
absorbs the noise:
In[1]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​perturbed=BlockRandomSeedRandom[7];left=
MPSCanonicalForm
[mps2,"Left"];
TensorNetwork
[Map[#+
-8
10.
RandomReal[{-1,1},Dimensions[#]]&,left["Tensors"]],left["Hyperedges"],left["Output"]];​​
MPSCanonicalQ
[perturbed,"Left",
-6
10.
]
Out[1]=
True
A mixed center outside the range
1≤k≤n
returns
False
without inspecting the tensors:
In[2]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​
MPSCanonicalQ

MPSCanonicalForm
[mps2,{"Mixed",3}],{"Mixed",100}
Out[2]=
False
​
Centers at the boundaries
k=1
and
k=n
are valid; they reduce to pure right- and left-canonical forms:
In[1]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​
MPSCanonicalQ

MPSCanonicalForm
[mps2,"Right"],{"Mixed",1}
Out[1]=
True
A left-canonical MPS typically fails the right-isometry check, since the two forms are related by a non-trivial gauge transformation:
In[2]:=
mps2=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​
MPSCanonicalQ

MPSCanonicalForm
[mps2,"Left"],"Right"
Out[2]=
False
Applications  
(1)

Properties & Relations  
(1)

SeeAlso
MPSCanonicalForm
 
▪
MPSOverlap
 
▪
MPSNorm
 
▪
MPSNormalize
 
▪
MPSSchmidtValues
 
▪
MPSEntanglementEntropy
 
▪
MPSTruncate
 
▪
RandomTensorNetwork
 
▪
IdentityMatrix
 
▪
Norm
TechNotes
▪
MPS Algorithms
RelatedGuides
▪
TensorNetworks
Start from a six-site MPS with bond dimension 4 and physical dimension 2:
In[1]:=
mps=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]]
The left-canonical form passes the left-isometry check:
In[2]:=
leftMPS=
MPSCanonicalForm
[mps,"Left"]
In[3]:=
MPSCanonicalQ
[leftMPS,"Left"]
Out[3]=
True
​
The right-canonical form passes the right-isometry check:
In[4]:=
mps=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​rightMPS=
MPSCanonicalForm
[mps,"Right"]
In[5]:=
MPSCanonicalQ
[rightMPS,"Right"]
Out[5]=
True
​
Mixed-canonical form at site
k=3
places the orthogonality center there; sites 1 and 2 are left-isometric, sites 4-6 are right-isometric:
In[6]:=
mps=BlockRandomSeedRandom[42];
RandomTensorNetwork
["MPS"[6,4,2]];​​mixedMPS=
MPSCanonicalForm
[mps,{"Mixed",3}]
In[7]:=
MPSCanonicalQ
[mixedMPS,{"Mixed",3}]
Out[7]=
True
""

© 2026 Wolfram. All rights reserved.

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