JordanWignerMapper¶
- class zixy.fermion.mappings.JordanWignerMapper(qubits: int | Qubits, mode_ordering: Sequence[int] | None = None)[source]¶
Bases:
MapperJordan–Wigner fermion to qubit mapper.
- __init__(qubits: int | Qubits, mode_ordering: Sequence[int] | None = None)[source]¶
Initialize the mapper.
- Parameters:
qubits – The qubits, or number thereof.
mode_ordering – The ordering of the modes with respect to the qubits. If
None, the modes are ordered in the same way as the qubits.
- encode(fermion_ops: Sequence[tuple[int, bool]]) Contribution[float][source]¶
Encode a sequence of fermionic operators.
- Parameters:
fermion_ops – A sequence of tuples, where each tuple consists of an integer index indicating the mode and a boolean indicating whether it’s a creation (
True) or annihilation (False) operator.- Returns:
The encoded contribution.
- encode_ca(c: int, a: int) Contribution[float]¶
Encode the product of a creation operator and an annihilation operator.
The operator is defined as
\[a^\dagger_c a_a.\]- Parameters:
c – The fermionic mode of the creation operator.
a – The fermionic mode of the annihilation operator.
- Returns:
The encoded contribution.
- encode_caca(c1: int, a1: int, c2: int, a2: int) Contribution[float]¶
Encode the product of two creation-annihilation operator products.
The operator is defined as
\[a^\dagger_{c1} a_{a1} a^\dagger_{c2} a_{a2}.\]- Parameters:
c1 – The fermionic mode of the first creation operator.
a1 – The fermionic mode of the first annihilation operator.
c2 – The fermionic mode of the second creation operator.
a2 – The fermionic mode of the second annihilation operator.
- Returns:
The encoded contribution.
- encode_ccaa(c1: int, c2: int, a1: int, a2: int) Contribution[float]¶
Encode the product of two creation operators and two annihilation operators.
The operator is defined as
\[a^\dagger_{c1} a^\dagger_{c2} a_{a1} a_{a2}.\]- Parameters:
c1 – The fermionic mode of the first creation operator.
c2 – The fermionic mode of the second creation operator.
a1 – The fermionic mode of the first annihilation operator.
a2 – The fermionic mode of the second annihilation operator.
- Returns:
The encoded contribution.
- encode_n(i: int) Contribution[float]¶
Encode the local number operator for a given mode.
The operator is defined as
\[n_i = a^\dagger_i a_i.\]- Parameters:
i – The fermionic mode to encode.
- Returns:
The encoded contribution.
- encode_nn(i: int, j: int) Contribution[float]¶
Encode the product of two local number operators.
The operator is defined as
\[n_i n_j = a^\dagger_i a_i a^\dagger_j a_j.\]- Parameters:
i – The fermionic mode of the first number operator.
j – The fermionic mode of the second number operator.
- Returns:
The encoded contribution.