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
A Working Tour of the Symmetry Functions
This tutorial walks through every function in
Wolfram`TensorNetworks`Symmetry`
in the order a tensor-network practitioner meets them. After it you can (i) decide whether a partition or a tableau is the right object for a problem, (ii) predict the size of every block of a symmetry-resolved tensor in closed form, and (iii) project a TN tensor onto the irreducible-representation subspace it physically belongs to. Every claim is paired with a Wolfram Language cell; nothing is asserted without being computed.
The arc starts at two indistinguishable particles and walks up the rank, picking up one Symmetry function per step. By the end all sixteen exported functions appear at least once on a tensor with a tensor-network reason to exist.
Inventory
The Symmetry layer exports sixteen symbols. Six handle the combinatorics of Young diagrams. Two are typed accessors for the row and column structure of a tableau. Six are dimensions of the irreducible-representation blocks, split between the
S
n
side (
dim
V
λ
) and the
GL(d)
side (
dim
W
λ
(d)
). Two are tensor actions that produce a tensor in a chosen symmetry class.
Symbol
Layer
One-line role
PartitionQ
combinatorics
Is this list a valid Young-diagram shape?
TransposePartition
combinatorics
Swap rows and columns of the diagram.
YoungTableau
combinatorics
Wrap a diagram (with slot labels) into a typed object.
YoungTableauQ
combinatorics
Is this
YoungTableau[...]
well-formed?
TableauShape
combinatorics
Read off the partition from a tableau.
TableauSize
combinatorics
Total box count
n
(the rank we will act on).
TableauRows
accessor
The list-of-rows out of an atomic
YoungTableau[...]
.
TableauColumns
accessor
The column-slot lists (handles ragged shapes).
HookLength
dimensions
One cell's hook length.
HookLengths
dimensions
All hook lengths in one nested list.
HookFactor
dimensions
1/∏h(i,j)
, the prefactor in the dimension formula.
TableauDimension
dimensions
dim
V
λ
, the
S
n
irreducible representation dimension.
SchurDimension
dimensions
dim
W
λ
(d)
, the
GL(d)
Weyl module dimension via the hook-content formula.
TableauWeylDimension
dimensions
Same value as
SchurDimension
, but tableau-keyed (parallel to
TableauDimension
).
YoungSymmetrize
tensor action
Unnormalised Young symmetriser
c
T
·T
.
YoungProject
tensor action
Idempotent projector
P
T
(
d
λ
/n!)
c
T
.
The tutorial is structured around two physical settings that together bring every function into play:
1
.
Familiar rank-2 tensors and their TN-bond payoffs introduces
YoungTableau
,
YoungTableauQ
, the four accessors (
TableauShape
,
TableauSize
,
TableauRows
,
TableauColumns
),
YoungSymmetrize
, and
YoungProject
through symmetric / antisymmetric matrices from physics (metric, Pauli, EM tensor, …) and operational TN constructs (singlet/triplet decomposition, SWAP-gate eigenspace, fermionic bond), closing with a block-sparse trace identity on a rank-2 bond.
2
.
Beyond rank 2: three higher-rank payoffs introduces
PartitionQ
,
TransposePartition
,
HookLength
,
HookLengths
,
HookFactor
, and
TableauDimension
through three larger examples: the Schur-Weyl block decomposition on three sites (with a block-sparse Frobenius contraction), the Riemann curvature tensor as a rank-4 TN node (with multi-term algebraic identities derived from the
{2,2}
projector, including the first Bianchi identity), and the spectrum of a class-function Hamiltonian via content sums.
Where the Symmetry functions sit in WL's tensor stack
Before any code, fix the structural relationship between the Symmetry functions and built-in Wolfram Language tensor symmetry. Built-in WL (since 9.0) ships a complete language for mono-term symmetries: relations of the form
ϕTensorTranspose[T,σ]T
for one permutation
σ
and one root of unity
ϕ
. The kernel surface for these is
◼
  • named heads
    Symmetric[{slots}]
    ,
    Antisymmetric[{slots}]
    ,
    Hermitian[{1,2}]
    ,
    Antihermitian[{1,2}]
    ,
    ZeroSymmetric[{slots}]
    ,
  • ◼
  • generic generators as lists
    {{Cycles[...],phase},...}
    ,
  • ◼
  • the projector
    Symmetrize[T,sym]
    (group-averaging; the idempotent normalised form),
  • ◼
  • the analyser
    TensorSymmetry[T]
    ,
  • ◼
  • the compressed-storage type
    SymmetrizedArray[rules,dims,sym]
    ,
  • ◼
  • the assumption-layer envelopes
    Arrays[...]
    /
    Matrices[...]
    /
    Vectors[...]
    that drive
    TensorReduce
    /
    TensorExpand
    .
  • This is everything you need to declare "this tensor is symmetric in slots 1, 2", "this matrix is Hermitian", "this rank-4 tensor antisymmetrises in
    (1,2)
    and in
    (3,4)
    and is invariant under swapping the pairs". It is not enough to declare "
    R
    abcd
    +
    R
    acdb
    +
    R
    adbc
    0
    ": that is a multi-term relation (three permuted copies summing to zero) and lies outside the mono-term language. The same gap is what blocks Young projection onto a mixed-symmetry irreducible representation: those projectors are sums-with-signs over the group on each row and each column of a Young diagram, and the image is defined by satisfying several permutation relations together, not one.
    The Symmetry functions in
    Wolfram`TensorNetworks`Symmetry`
    fill exactly this gap. Its
    YoungProject
    produces tensors that lie in one
    S
    n
    irreducible representation, a condition that always implies extra multi-term identities. The Riemann curvature tensor is the canonical example: living in the
    {2,2}
    irreducible representation simultaneously satisfies pair-antisymmetry
    R
    abcd
    -
    R
    bacd
    , pair-antisymmetry
    R
    abcd
    -
    R
    abdc
    , pair-swap
    R
    abcd
    
    R
    cdab
    , and the algebraic first Bianchi identity
    R
    abcd
    +
    R
    acdb
    +
    R
    adbc
    0
    . The three pair conditions are mono-term and reachable by built-in
    Symmetrize
    ; the Bianchi identity is multi-term and is not.
    The Riemann-tensor example later in the tutorial makes this concrete: built-in
    Symmetrize
    with the three Riemann pair generators leaves a finite Bianchi residual, while
    YoungProject
    zeroes it. The map between the two layers:
    Operation
    Built-in WL
    Symmetry functions
    Mono-term symmetrise (boson, fermion, Riemann pair)
    Symmetrize[T,sym]
    (wrapped by the Symmetry functions)
    Detect mono-term symmetry group
    TensorSymmetry[T]
    (no analogue)
    Compressed storage by orbit
    SymmetrizedArray
    (no analogue; the Symmetry functions emit dense /
    Normal
    )
    Single-tableau / mixed-symmetry projection (multi-term)
    (not supported)
    YoungProject[T,tab]
    Irreducible representation dimension
    dim
    V
    λ
    via hook formula
    (not supported)
    TableauDimension[par]
    Hook lengths for
    S
    n
    representation theory
    (not supported)
    HookLength
    ,
    HookLengths
    ,
    HookFactor
    The two layers compose.
    YoungSymmetrize
    is two
    Symmetrize
    calls (
    Symmetric/@rows
    , then
    Antisymmetric/@columns
    ) plus the row- and column-stabiliser normalisation factors. The multi-term machinery extends the mono-term machinery, not competes with it.
    Setup
    Load the paclet and pull the Symmetry functions into scope; both
    Needs
    are assumed in every subsequent cell. The
    tol
    constant sets the numerical tolerance for "is this tensor identity satisfied?" checks throughout.
    In[242]:=
    Needs["Wolfram`TensorNetworks`"];​​Needs["Wolfram`TensorNetworks`Symmetry`"];​​​​tol=10^-10;
    Picturing a tensor as a diagram
    A rank-
    n
    tensor is a node with
    n
    labelled legs, one per slot. This is the visual vocabulary every tensor-network argument uses when an indexed sum reads more naturally as a diagram.
    Render a generic rank-
    7
    tensor as a hypergraph.
    In[246]:=
    TensorNetwork
    [{Range[7]}]["Hypergraph"]
    Out[246]=
    The central blob is the tensor; the seven labelled legs are its slots. Shared legs become bonds between two such nodes, and a tensor network is a collection of these stars glued at common legs.
    Two group actions live on this picture, and both recur throughout the tutorial:
    ◼
  • S
    n
    , the symmetric group on
    n
    letters, comprises the
    n!
    permutations of the slots. It acts on the diagram by permuting which leg is which. For rank
    7
    ,
    |
    S
    7
    |5040
    .
  • ◼
  • GL(d)
    , the general linear group of
    dd
    invertible matrices, acts on a single leg of dimension
    d
    by basis change, and on the full tensor by changing basis at every leg simultaneously. It is a continuous group of dimension
    2
    d
    .
  • The two actions commute, and Schur-Weyl duality turns that commuting pair into a direct-sum decomposition of
    ⊗n
    V
    into blocks indexed by Young diagrams of size
    n
    . The Symmetry functions handle the
    S
    n
    side (
    YoungProject
    lands a tensor in a chosen block);
    SchurDimension
    reports the
    GL(d)
    side (the block size at bond dimension
    d
    ).
    Two indistinguishable particles on a bond
    The simplest non-trivial tensor in a tensor network is a rank-2 node
    T
    ij
    on a bond between two physical sites, with each index ranging over a
    d
    -dimensional local Hilbert space
    V
    , so
    T∈V⊗V
    . This rank-2 bond is the elementary building block of every MPS, MERA, and PEPS, and the symmetry rule worked out here generalises slot-by-slot to every higher-rank tensor in the rest of the tutorial.

    Identical particles and the exchange operator

    Identical quantum particles carry no intrinsic labels: photons in a cavity, electrons in an atom, helium-4 atoms in a superfluid, the indices we attach are bookkeeping, not physics. Quantum mechanics enforces this with a sharp rule on the two-particle wavefunction
    Ψ(
    x
    1
    ,
    x
    2
    )
    :
    Ψ(
    x
    2
    ,
    x
    1
    )±Ψ(
    x
    1
    ,
    x
    2
    ).
    The plus sign is the bosonic case (integer spin: photons, mesons, He-4, Cooper pairs). The minus sign is the fermionic case (half-integer spin: electrons, protons, He-3); setting
    x
    1
    
    x
    2
    forces
    Ψ0
    , the Pauli exclusion principle.
    Write the wavefunction in tensor form,
    |Ψ〉
    ∑
    ij
    T
    ij
    |i〉⊗|j〉∈V⊗V
    . The exchange operator (the SWAP gate in quantum computing)
    P
    12
    acts by relabelling the two factors,
    P
    12
    (|i〉⊗|j〉)|j〉⊗|i〉,
    sending coefficients
    T
    ij
    ↦
    T
    ji
    . This is the ordinary transpose
    T
    T
    , not the adjoint
    †
    T
    . SWAP relabels slots; no complex conjugation enters. So even for complex
    T
    , the bosonic and fermionic conditions are
    boson:T
    T
    T
    ,fermion:T-
    T
    T
    .
    Hermiticity,
    T
    †
    T
    
    T
    (
    *
    T
    )
    , is a separate constraint outside the symmetric-group story; built-in WL captures it via
    Hermitian[{1,2}]
    . On real entries the kernel collapses
    Matrices[{n,n},Reals,Hermitian[{1,2}]]
    to
    Matrices[{n,n},Reals,Symmetric[{1,2}]]
    because the conjugation has no imaginary part to act on.

    The symmetric / antisymmetric decomposition

    A generic complex matrix
    T∈V⊗V
    is neither symmetric nor antisymmetric, but it splits cleanly:
    T
    1
    2
    (T+
    T
    T
    )+
    1
    2
    (T-
    T
    T
    ),
    with
    T
    sym
    ∈
    2
    Sym
    V
    (dimension
    d(d+1)/2
    ) and
    T
    anti
    ∈
    2
    Λ
    V
    (dimension
    d(d-1)/2
    ). These are the
    +1
    and
    -1
    eigenspaces of SWAP, and their dimensions sum to
    2
    d
    . The Symmetry functions name the two pieces by their symmetry class (the partition
    {2}
    for boson,
    {1,1}
    for fermion) and produce each with a single call. The naming object is the
    YoungTableau
    .

    YoungTableau
    : the named handle for a symmetry class

    A Young tableau is a left-justified arrangement of boxes (the "shape") together with a labelling of those boxes by the slot indices
    {1,2,…,n}
    of the tensor we plan to act on. The labelling must be a permutation of
    1,2,…,n
    (a standard tableau). For two indices there are exactly two shapes:
    ◼
  • one row of two boxes, written
    {2}
    , labels the symmetric class;
  • ◼
  • one column of two boxes, written
    {1,1}
    , labels the antisymmetric class.
  • Build the symmetric two-box tableau.
    In[247]:=
    YoungTableau
    [{2}]
    Out[247]=
    YoungTableau
    Shape: {2}
    Dimension: 1
    
    Build the antisymmetric two-box tableau.
    The antisymmetric two-tableau equivalent reads:
    Duplicate slot labels are rejected.

    Familiar rank-2 tensors and their TN-bond payoffs

    Name the antisymmetric two-box tableau.
    Read the antisymmetric tableau's row and column lists.
    Check the antisymmetric tableau.
    Read its box count.
    Read the antisymmetric tableau's partition.
    Read its box count.
    Both tableaux carry two boxes, so they act on rank-2 tensors. Every concrete example in the rest of this section is a rank-2 tensor, so this constraint is automatically met; later sections that work with rank-3 and rank-4 tensors will need different tableaux of the matching size.
    Read the symmetry class from the built-in detector.
    Read the symmetry class.
    Project onto the symmetric shape and compare with the original.
    Project onto the antisymmetric shape; the projection is identically zero.
    Read the symmetry class.

    Symbolic covariance matrix of a bivariate normal distribution

    Project onto the symmetric shape and compare with the original.
    Project onto the antisymmetric shape; the projection is identically zero.
    Read the symmetry class.
    Project onto the symmetric shape; the projection is identically zero.
    Project onto the antisymmetric shape and compare with the original.
    Read the symmetry class.
    The 2D Levi-Civita tensor is the canonical antisymmetric rank-2 object.
    Project onto the symmetric shape; the projection is identically zero.
    Project onto the antisymmetric shape and compare with the original.
    Read the symmetry class.
    The antisymmetric projection of the singlet returns the singlet itself.
    The symmetric projection of the singlet vanishes (no triplet content).
    The symmetric projection of the triplet returns the triplet itself.
    The antisymmetric projection of the triplet vanishes.

    SWAP gate as the symmetrise/antisymmetrise machine

    Build a generic symbolic rank-2 coefficient tensor.

    A fermionic bond in a TN

    Project onto the antisymmetric (fermionic) shape.
    Build random vectors for the two surrounding nodes.
    The same project-first-then-contract pattern carries to higher-rank fermionic networks, to bosonic permutation-invariant Hamiltonians, and (with a different Young diagram) to the Riemann curvature tensor in the next section.
    Set the chain length and the relevant Young tableau.

    Block-sparse trace: cross-shape contractions vanish identically

    Compute the dense Frobenius trace as a baseline.
    The full trace equals the sum of only the two same-shape block traces.
    Beyond rank 2: three higher-rank payoffs

    Schur-Weyl on three sites: how a tensor decomposes by symmetry

    Validate each one is a legal Young-diagram shape (non-increasing, positive integers, non-empty).
    The three pieces sum to the original tensor (completeness of the isotypic decomposition).
    And the predicted vanishing of the fermionic piece holds identically:
    The decomposition is exact, computed without any eigenvalue routine. Each Symmetry function plays a distinct role:
    Project the complex tensor onto the fully symmetric block.
    Project onto the mixed-symmetry block.
    Project onto the fully antisymmetric block.
    The three complex pieces still sum to the original tensor.

    Block-sparse Frobenius contraction on a rank-3 bond

    Compute the full Frobenius contraction directly.
    Contract within the fully symmetric block.
    Contract within the mixed-symmetry block.
    Contract within the fully antisymmetric block.
    List the three standard-tableau sets and evaluate the three within-sector contractions through the paclet's contraction engine.
    The three within-sector contractions sum to the bare Frobenius product.
    The sum of the three within-block contractions reproduces the full Frobenius product.

    The Riemann tensor as a TN node

    Apply the built-in projector to obtain a mono-term-symmetrised rank-4 tensor.
    All three pass. Now check the first Bianchi identity.

    The Young-projector solution: discovering the algebraic identities

    Begin by fixing a slot labelling: build the rank-4 Young tableau whose two columns hold the two antisymmetric pairs and whose two rows hold the pair-swap-symmetric slots.
    The search returns 84 two-term identities, derived without input from the textbook. They include the three classical Riemann pair-symmetries plus every consequence (composing two pair-antisymmetries gives a pair-swap, etc.). Extract the textbook three from the discovered list by set intersection.

    The TN reward

    No separate re-symmetrisation step. The scalar curvature is the trace of the Ricci tensor:

    Component count at arbitrary spacetime dimension

    TN-bond enumeration for a rank-4 bond

    The dimension counting itself costs only a few hook-length products, the cheapest pre-allocation step in a symmetry-resolved TN code.

    Block-sparse contraction on a rank-4 bond

    A class-function Hamiltonian and content sums

    Encode the content sum:
    Diagonalise and sort the eigenvalues in descending order.
    The numerical spectrum agrees with the combinatorial prediction.
    Where this leaves us
    Three traps worth flagging:
    ◼
  • The Young symmetriser is applied rows-first, columns-second: row symmetry can be broken by the subsequent column antisymmetrisation. For mixed-symmetry diagrams (anything other than fully-row or fully-column) the first symmetry imposed is not generally preserved.
  • Function-by-function quick reference

    The sections above sit on top of these sixteen calls. Anywhere a symmetry-resolved tensor network needs sizing, block enumeration, or constraint enforcement, the right call is one of them.

    © 2026 Wolfram. All rights reserved.

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