qml.liealg.change_basis_ad_rep

change_basis_ad_rep(adj, basis_change)[source]

Apply a basis_change between bases of operators to the adjoint representation adj.

Assume the adjoint repesentation is given in terms of a basis \(\{b_j\}\), \(\text{ad}^\mu_{\alpha \beta} \propto \text{tr}\left(b_\mu \cdot [b_\alpha, b_\beta] \right)\). We can represent the adjoint representation in terms of a new basis \(c_i = \sum_j T_{ij} b_j\) with the basis transformation matrix \(T\) using change_basis_ad_rep.

Parameters:
  • adj (TensorLike) – Adjoint representation in old basis.

  • basis_change (TensorLike) – Basis change matrix from old to new basis.

Returns:

Adjoint representation in new basis.

Return type:

TensorLike

Example

We choose a basis of a Lie algebra, compute its adjoint representation.

>>> import numpy as np
>>> from pennylane.liealg import change_basis_ad_rep
>>> basis = [qml.X(0), qml.Y(0), qml.Z(0)]
>>> adj = qml.structure_constants(basis)

Now we change the basis and re-compute the adjoint representation in that new basis.

>>> basis_change = np.array([[1., 1., 0.], [0., 1., 1.], [0., 1., 1.]])
>>> new_ops = [qml.sum(*[basis_change[i,j] * basis[j] for j in range(3)]) for i in range(3)]
>>> new_adj = qml.structure_constants(new_ops)

We confirm that instead of re-computing the adjoint representation (typically expensive), we can transform the old adjoint representation with the change of basis matrix.

>>> new_adj_re = change_basis_ad_rep(adj, basis_change)
>>> np.allclose(new_adj, new_adj_re)
True