Skip to main contentIBM Quantum Documentation Mirror

fermion_jordan_wigner

fermion_jordan_wigner(op, num_qubits)

Map a FermionOperator to a SparseObservable under the Jordan-Wigner transformation. [1]

Fermionic mode jj is mapped to qubit jj of the resulting SparseObservable (i.e. the identity is used on any qubit outside the operator’s support). This follows Qiskit’s little-endian qubit ordering, where the qubit index in a Pauli label such as X_2 Z_1 Z_0 is the mode index.

Parameters

  • op – the fermionic operator to map.
  • num_qubits – the number of qubits for the resulting qubit operator. This must be strictly greater than the largest mode index in op (any additional qubits are padded with the identity).

Returns

The mapped qubit operator. The result is not simplified; call simplify() to combine duplicate terms.

Raises

ValueError – if num_qubits is too small to hold the operator’s support, i.e. if it is not larger than the largest mode index acted upon by op.


Definition

The Jordan-Wigner transformation maps fermionic creation and annihilation operators to spin (or in this case, qubit) operators:

ajk<jσkZσj  and  ajk<jσkZσj+,a^\dagger_j \rightarrow \bigotimes_{k\lt j} \sigma^Z_k \otimes \sigma^-_j ~~\text{and}~~ a_j \rightarrow \bigotimes_{k\lt j} \sigma^Z_k \otimes \sigma^+_j \, ,

where aja^\dagger_j (aja_j) is the fermionic creation (annihilation) operator acting on the jj-th spin-less fermionic mode, σP\sigma^P with P{X,Y,Z}P \in \{X,Y,Z\} are the spin-12\frac{1}{2} Pauli operators and σ±=(σX±iσY)/2\sigma^\pm = (\sigma^X \pm \mathrm{i} \sigma^Y) / 2.

This mapping preserves the fermionic anti-commutation relations by introducing a chain of σZ\sigma^Z operators on all qubits preceding the acted-upon index jj.


Usage

Since a FermionOperator does not determine a fixed number of modes which it acts upon, one can specify the number of qubits to map onto when calling this function.

>>> from qiskit_fermions.mappers.library import fermion_jordan_wigner
>>> from qiskit_fermions.operators import FermionOperator
>>> fop = FermionOperator.from_dict(
...     {
...         (): 2.0,
...         ((True, 0), (False, 0)): 0.1,
...         ((True, 1), (False, 2), (True, 2), (False, 1)): -1.0j,
...     }
... )
>>> qop = fermion_jordan_wigner(fop, 4)
>>> qop.simplify()
<SparseObservable with 5 terms on 4 qubits: (2.05-0.25j)() + (-0.05+0j)(Z_0) + (0+0.25j)(Z_1) + (0+0.25j)(Z_2 Z_1) + (0-0.25j)(Z_2)>

[1]

P. Jordan and E. Wigner, Über das Paulische Äquivalenzverbot, Zeitschrift für Physik 47, No. 9. (1928), pp. 631–651, doi:10.1007/BF01331938.