Loading [MathJax]/jax/output/HTML-CSS/jax.js

qml.structure_constants

structure_constants(g, pauli=False, matrix=False, is_orthogonal=True)[source]

Compute the structure constants that make up the adjoint representation of a Lie algebra.

Given a DLA {iG1,iG2,..iGd} of dimension d, the structure constants yield the decomposition of all commutators in terms of DLA elements,

[iGα,iGβ]=d1γ=0fγα,βiGγ.

The adjoint representation (ad(iGγ))α,β=fγα,β is given by those structure constants, which can be computed via

fγα,β=tr(iGγ[iGα,iGβ])tr(iGγiGγ).

The inputs are assumed to be orthogonal unless is_orthogonal is set to False. However, we neither assume nor enforce normalization of the DLA elements Gα.

Parameters
  • g (List[Union[Operator, PauliWord, PauliSentence]]) – The (dynamical) Lie algebra for which we want to compute the adjoint representation. DLAs can be generated by a set of generators via lie_closure().

  • pauli (bool) – Indicates whether it is assumed that PauliSentence or PauliWord instances are input. This can help with performance to avoid unnecessary conversions to Operator and vice versa. Default is False.

  • matrix (bool) – Whether or not matrix matrix representations are used and output in the structure constants computation. Default is False.

  • is_orthogonal (bool) – Whether the set of operators in g is orthogonal with respect to the trace inner product. Default is True.

Returns

The adjoint representation of shape (d, d, d), corresponding to indices (gamma, alpha, beta).

Return type

TensorLike

Example

Let us first generate the DLA of the transverse field Ising model using lie_closure().

>>> n = 2
>>> gens = [X(i) @ X(i+1) for i in range(n-1)]
>>> gens += [Z(i) for i in range(n)]
>>> dla = qml.lie_closure(gens)
>>> print(dla)
[X(0) @ X(1), Z(0), Z(1), -1.0 * (Y(0) @ X(1)), -1.0 * (X(0) @ Y(1)), -1.0 * (Y(0) @ Y(1))]

The dimension of the DLA is d=6. Hence, the structure constants have shape (6, 6, 6).

>>> adjoint_rep = qml.structure_constants(dla)
>>> adjoint_rep.shape
(6, 6, 6)

The structure constants tell us the commutation relation between operators in the DLA via

[iGα,iGβ]=d1γ=0fγα,βiGγ.

Let us confirm those with an example. Take [iG1,iG3]=[iZ0,iY0X1]=i2X0X1=i2G0, so we should have f01,3=2, which is indeed the case.

>>> adjoint_rep[0, 1, 3]
-2.0

We can also look at the overall adjoint action of the first element G0=X0X1 of the DLA on other elements. In particular, at (ad(iG0))α,β=f0α,β, which corresponds to the following matrix.

>>> adjoint_rep[0]
array([[ 0.,  0.,  0.,  0.,  0.,  0.],
       [-0.,  0.,  0., -2.,  0.,  0.],
       [-0.,  0.,  0.,  0., -2.,  0.],
       [-0.,  2., -0.,  0.,  0.,  0.],
       [-0., -0.,  2.,  0.,  0.,  0.],
       [ 0., -0., -0., -0., -0.,  0.]])

Note that we neither enforce nor assume normalization by default.

To compute the structure constants of a non-orthogonal set of operators, use the option is_orthogonal=False:

>>> dla = [qml.X(0), qml.Y(0), qml.X(0) - qml.Z(0)]
>>> adjoint_rep = qml.structure_constants(dla, is_orthogonal=False)
>>> adjoint_rep[:, 0, 1] # commutator of X_0 and Y_0 consists of first and last operator
array([-2.,  0.,  2.])

We can also use matrix representations for the computation, which is sometimes faster, in particular for sums of many Pauli words. This alters how the structure constants are computed internally, but it does not change the result.

>>> adjoint_rep2 = qml.structure_constants(dla, is_orthogonal=False, matrix=True)
>>> qml.math.allclose(adjoint_rep, adjoint_rep2)
True

We can also input the DLA in form of matrices. For that we use lie_closure() with the matrix=True.

>>> n = 4
>>> gens = [qml.X(i) @ qml.X(i+1) + qml.Y(i) @ qml.Y(i+1) + qml.Z(i) @ qml.Z(i+1) for i in range(n-1)]
>>> g = qml.lie_closure(gens, matrix=True)
>>> g.shape
(12, 16, 16)

The DLA is represented by a collection of twelve 24×24 matrices. Hence, the dimension of the DLA is d=12 and the structure constants have shape (12, 12, 12).

>>> from pennylane.labs.dla import structure_constants_matrix
>>> adj = structure_constants_matrix(g)
>>> adj.shape
(12, 12, 12)

Consider a (dynamical) Lie algebra {iG1,iG2,..iGd} of dimension d. The defining property of the structure constants is that they express the decomposition of commutators in terms of the DLA elements, as described at the top. This can be written as

[iGα,iGβ]=d1γ=0fγα,βiGγ.

Now we may multiply this equation with the adjoint of a DLA element and apply the trace:

tr(iGη[iGα,iGβ])=tr(iGηd1γ=0fγα,βiGγ)=d1γ=0tr(iGηiGγ)gηγfγα,β fγα,β=(g1)γηtr(iGη[iGα,iGβ]).

Here we introduced the Gram matrix gαβ=tr(iGαiGβ) of the DLA elements. Note that this is just the projection of the commutator on the DLA element iGγ via the trace inner product.

Now, if the DLA elements are orthogonal, as assumed by structure_constants by default, the Gram matrix will be diagonal and simply consist of some rescaling factors, so that the above computation becomes the equation from the very top:

fγα,β=tr(iGγ[iGα,iGβ])tr(iGγiGγ).

This is cheaper than computing the full Gram matrix, inverting it, and multiplying it to the trace inner products.

For the case of an orthonormal set of operators, we even have gαβ=δαβ, so that the division in this calculation can be skipped.

Contents

Using PennyLane

Release news

Development

API

Internals