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
  • Index conventions and contraction path
  • 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
  • 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
  • $TensorNetworkContractionMethods
Wolfram`TensorNetworks`
$TensorNetworkContractionMethods
​
$TensorNetworkContractionMethods
is the list of binary-contraction engines available as the
Method
option to
TensorNetworkContraction
and
TensorNetworkContract
.
​
Details and Options
▪
The constant value is
{"ArrayDotTranspose","ArrayDot","Dot","TensorContract","TableSum"}
.
▪
All five engines produce numerically identical results; they differ only in the shape of the
Inactive
expression tree returned by
TensorNetworkContraction
and in the runtime cost of evaluation.
▪
The default engine is
"ArrayDot"
.
▪
Each engine has the following form and use case:
"ArrayDot"
ArrayDot
[a, b, axes] (default)
general-purpose dense contraction.
"ArrayDotTranspose"
permutes axes to a canonical layout, then ArrayDot with a flat contraction count.
uniform-layout audit of intermediate transposes.
"Dot"
reshape to matrices, apply
Dot
, reshape back.
BLAS performance critical for large dense tensors.
"TensorContract"
TensorContract
[
TensorProduct
[…], axes]
symbolic/pedagogical inspection closest to the textbook definition.
"TableSum"
Table
[
Sum
[…], iterators]
explicit-form audit of the underlying scalar arithmetic.
▪
All five engines must produce numerically identical results. Any non-zero difference outside floating-point rounding is a bug; the diagnostic is the
AssociationMap
sweep shown in Basic Examples.
▪
The
"TableSum"
engine emits an explicit
Table
of
Sum
of scalar
Part
accesses; evaluation cost is
O(∏dims)
without BLAS acceleration, so this engine is slow for high-rank dense tensors. Use it for audit and pedagogy, not for production contractions.
​
Examples  
(2)
Basic Examples  
(1)
List the available binary-contraction engines:
In[1]:=
$TensorNetworkContractionMethods
Out[1]=
{ArrayDotTranspose,ArrayDot,Dot,TensorContract,TableSum}
Build a small two-tensor network used in the examples below:
In[2]:=
tn=
TensorNetwork
[{{{0.5,-0.2,0.3},{0.1,0.8,-0.4}},{{0.6,0.4,-0.1,0.2},{-0.3,0.5,0.7,-0.2},{0.1,-0.4,0.3,0.5}}},{{i,j},{j,k}}]
Out[2]=
TensorNetwork
Tensors: 2
Binary: Yes
Free indices: 2
Sparse: No
Output dimension: 8
​

Use the first available engine as the Method value:
In[3]:=
TensorNetworkContract
[tn,MethodFirst[$TensorNetworkContractionMethods]]
Out[3]=
{{0.39,-0.02,-0.1,0.29},{-0.22,0.6,0.43,-0.34}}
Iterate over every engine and collect the contracted tensors:
In[4]:=
AssociationMap
TensorNetworkContract
[tn,Method#1]&,$TensorNetworkContractionMethods
Out[4]=
ArrayDotTranspose{{0.39,-0.02,-0.1,0.29},{-0.22,0.6,0.43,-0.34}},ArrayDot{{0.39,-0.02,-0.1,0.29},{-0.22,0.6,0.43,-0.34}},Dot{{0.39,-0.02,-0.1,0.29},{-0.22,0.6,0.43,-0.34}},TensorContract{{0.39,-0.02,-0.1,0.29},{-0.22,0.6,0.43,-0.34}},TableSum{{0.39,-0.02,-0.1,0.29},{-0.22,0.6,0.43,-0.34}}
All five engines produce numerically identical results. The maximum absolute difference between any two is zero up to floating-point noise:
In[5]:=
MaxAbsFlatten#1-
TensorNetworkContract
[tn,Method"ArrayDot"]&/@ValuesAssociationMap
TensorNetworkContract
[tn,Method#1]&,$TensorNetworkContractionMethods
Out[5]=
0.
Clean up the example variables to keep subsequent sections self-contained:
In[6]:=
Clear[tn]
Scope  
(1)

SeeAlso
TensorNetworkContract
 
▪
TensorNetworkContraction
 
▪
Method
 
▪
ArrayDot
 
▪
Dot
 
▪
TensorContract
 
▪
Table
 
▪
Sum
TechNotes
▪
Contraction Paths and Execution
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

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