Mapper¶
- class zixy.fermion.mappings.Mapper[source]¶
Bases:
ABCBase class for fermion to qubit mappers.
- abstractmethod encode(fermion_ops: Sequence[tuple[int, bool]]) Contribution[float][source]¶
Encode a sequence of fermionic creation and annihilation operators to qubit 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 to a linear combination of qubit Pauli strings.
- encode_ca(c: int, a: int) Contribution[float][source]¶
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][source]¶
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][source]¶
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][source]¶
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][source]¶
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.