Mapper Library

The C API provides efficient implementations of commonly used operator representation mapper routines.


QkObs *qf_jordan_wigner(const QfFermionOperator *op, uint32_t num_qubits)

Applies the Jordan-Wigner transformation to an operator.

Map a QfFermionOperator to a QkObs under the Jordan-Wigner transformation. [1]


Definition

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

\[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 \(a^\dagger_j\) (\(a_j\)) is the fermionic creation (annihilation) operator acting on the \(j\)-th spin-less fermionic mode, \(\sigma^P\) with \(P \in \{X,Y,Z\}\) are the spin-\(\frac{1}{2}\) Pauli operators and \(\sigma^\pm = (\sigma^X \pm \mathrm{i} \sigma^Y) / 2\).

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

Example

1// define some kind of fermionic operator
2QfFermionOperator *hamil = qf_ferm_op_one();
3
4// and map it to a qubit operator
5QkObs *result = qf_jordan_wigner(hamil, 4);

Parameters:
  • op – A pointer to the fermionic operator to be mapped.

  • num_qubits – The number of qubits of the resulting operator.

Returns:

A pointer to the created qubit operator.

QfMajoranaOperator *qf_fermion_to_majorana(const QfFermionOperator *fer_op)

Map a QfFermionOperator to a QfMajoranaOperator.

Definition

This function implements the simple transformation:

\[a^\dagger_j \rightarrow \frac{1}{2} (\gamma_j - i \gamma'_j) ~~\text{and}~~ a_j \rightarrow \frac{1}{2} (\gamma_j + i \gamma'_j)\]

where \(a^\dagger_j\) (\(a_j\)) is the fermionic creation (annihilation) operator acting on the \(j\)-th spin-less fermionic mode, and \(\gamma_j\)/\(\gamma'_j\) are the two Majorana fermion operators. In the case of the QfMajoranaOperator these will be stored on the even and odd Majorana modes, respectively.

Example

1// define some kind of fermionic operator
2QfFermionOperator *fer_op = qf_ferm_op_one();
3
4// and map it to a majorana operator
5QfMajoranaOperator *maj_op = qf_fermion_to_majorana(fer_op);

Parameters:
  • fer_op – A pointer to the fermionic operator to be mapped.

Returns:

A pointer to the mapped majorana operator.

QfFermionOperator *qf_majorana_to_fermion(const QfMajoranaOperator *maj_op)

Map a QfMajoranaOperator to a QfFermionOperator.

Definition

This function implements the simple transformation:

\[\gamma_j \rightarrow a^\dagger_j + a_j ~~\text{and}~~ \gamma'_j \rightarrow i (a^\dagger_j - a_j)\]

where \(\gamma_j\)/\(\gamma'_j\) are the two Majorana fermion operators (stored on the even and odd modes, respectively), and \(a^\dagger_j\) (\(a_j\)) is the fermionic creation (annihilation) operator acting on the \(j\)-th spin-less fermionic mode.

Example

1// define some kind of majorana operator
2QfMajoranaOperator *maj_op = qf_maj_op_one();
3
4// and map it to a fermion operator
5QfFermionOperator *fer_op = qf_majorana_to_fermion(maj_op);

Parameters:
  • maj_op – A pointer to the majorana operator to be mapped.

Returns:

A pointer to the mapped fermion operator.