qml.qchem.qubit_observable¶
-
qubit_observable
(o_ferm, cutoff=1e-12)[source]¶ Convert a fermionic observable to a PennyLane qubit observable.
The fermionic operator is a tuple containing the fermionic coefficients and operators. For instance, the one-body fermionic operator \(a_2^\dagger a_0\) is specified as [2, 0] and the two-body operator \(a_4^\dagger a_3^\dagger a_2 a_1\) is specified as [4, 3, 2, 1].
- Parameters
tuple (o_ferm) – fermionic operator
cutoff (float) – cutoff value for discarding the negligible terms
- Returns
Simplified PennyLane Hamiltonian
- Return type
Example
>>> coeffs = np.array([1.0, 1.0]) >>> ops = [[0, 0], [0, 0]] >>> f = (coeffs, ops) >>> print(qubit_observable(f)) ((-1+0j)) [Z0] + ((1+0j)) [I0]
code/api/pennylane.qchem.qubit_observable
Download Python script
Download Notebook
View on GitHub