qml.labs.dla.lie_closure_dense¶
- lie_closure_dense(generators, n=None, max_iterations=10000, verbose=False, tol=None)[source]¶
Compute the dynamical Lie algebra \(\mathfrak{g}\) from a set of generators using their dense matrix representation.
This function computes the Lie closure of a set of generators using their dense matrix representation. This is sometimes more efficient than using the sparse Pauli representations of
PauliWord
andPauliSentence
employed inlie_closure()
, e.g., when few generators are sums of many Paulis.See also
For details on the mathematical definitions, see
lie_closure()
and our Introduction to Dynamical Lie Algebras for quantum practitioners.- Parameters
generators (Iterable[Union[PauliWord, PauliSentence, Operator, np.ndarray]]) – generating set for which to compute the Lie closure.
n (int) – The number of qubits involved. If
None
is provided, it is automatically deduced from the generators. Ignored when the inputs arenp.ndarray
instances.max_iterations (int) – maximum depth of nested commutators to consider. Default is
10000
.verbose (bool) – whether to print out progress updates during Lie closure calculation. Default is
False
.tol (float) – Numerical tolerance for the linear independence check between algebra elements
- Returns
The
(dim(g), 2**n, 2**n)
array containing the linearly independent basis of the DLA \(\mathfrak{g}\) as dense matrices.- Return type
numpy.ndarray
Example
Compute the Lie closure of the isotropic Heisenberg model with generators \(\{X_i X_{i+1} + Y_i Y_{i+1} + Z_i Z_{i+1}\}_{i=0}^{n-1}\).
>>> n = 5 >>> gens = [X(i) @ X(i+1) + Y(i) @ Y(i+1) + Z(i) @ Z(i+1) for i in range(n-1)] >>> g = lie_closure_mat(gens, n)
The result is a
numpy
array. We can turn the matrices back into PennyLane operators by employingbatched_pauli_decompose()
.>>> g_ops = [qml.pauli_decompose(op) for op in g]
Internal representation
The input operators are converted to Hermitian matrices internally. This means that we compute the operators \(G_\alpha\) in the algebra \(\{iG_\alpha\}_\alpha\), which itself consists of skew-Hermitian objects (commutators produce skew-Hermitian objects, so Hermitian operators alone can not form an algebra with the standard commutator).