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`
SparseTensorNetwork
​
SparseTensorNetwork
[tn]
returns a tensor network with every rank-
>0
tensor of
tn
converted to a
SparseArray
.
​
Details and Options
▪
Rank-0 tensors (scalars) are preserved as-is—
SparseArray
is not applied to them.
▪
The hyperedges and the output specification of the input network are preserved unchanged.
▪
The dual property form is
tn["SparseQ"]
, a predicate testing whether every tensor of
tn
is already a
SparseArray
;
SparseTensorNetwork
[tn]["SparseQ"]
is always
True
.
▪
All paclet operations (
TensorNetworkContract
, path finders, and so on) work transparently on sparse-stored networks; choose
SparseArray
storage for memory savings when most tensor entries are zero.
Examples  
(7)
Basic Examples  
(1)
Construct a tensor network with two dense tensors and convert it to a sparse-stored tensor network:
In[1]:=
{A,B}={RandomReal[{-1,1},{3,4}],RandomReal[{-1,1},{4,5}]};
In[2]:=
tn=
TensorNetwork
[{A,B},{{1,2},{2,3}}]
Out[2]=
TensorNetwork
Tensors: 2
Binary: Yes
Free indices: 2
Sparse: No
Output dimension: 15
​

The Sparse: Yes flag in the summary box indicates that every stored tensor is now a SparseArray:
In[3]:=
sparse=
SparseTensorNetwork
[tn]
Out[3]=
TensorNetwork
Tensors: 2
Binary: Yes
Free indices: 2
Sparse: Yes
Output dimension: 15
​

Convert a randomly generated matrix product state to sparse storage:
In[4]:=
SparseTensorNetwork

RandomTensorNetwork
["MPS"[4,2,2]]
Out[4]=
TensorNetwork
Tensors: 4
Binary: Yes
Free indices: 4
Sparse: Yes
Output dimension: 16
​

Confirm that every tensor is now stored as a SparseArray:
In[5]:=
sparse["SparseQ"]
Out[5]=
True
The heads of the stored tensors are SparseArray:
In[6]:=
Head/@sparse["Tensors"]
Out[6]=
{SparseArray,SparseArray}
Scope  
(4)

Applications  
(1)

Properties & Relations  
(1)

SeeAlso
TensorNetwork
 
▪
BinaryTensorNetwork
 
▪
RandomTensorNetwork
 
▪
TensorNetworkContract
 
▪
TensorNetworkQ
 
▪
SparseArray
 
▪
SparseArrayQ
TechNotes
▪
Building Tensor Networks
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

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