Mapper Library
The C API provides efficient implementations of commonly used operator representation mapper routines.
qf_ferm_op_jordan_wigner() | Map a QfFermionOperator to a QkObs under the Jordan-Wigner transformation. |
qf_fermion_to_majorana() | Map a QfFermionOperator to a QfMajoranaOperator. |
qf_majorana_to_fermion() | Map a QfMajoranaOperator to a QfFermionOperator. |
qf_ferm_op_jordan_wigner
QfExitCode qf_ferm_op_jordan_wigner(const QfFermionOperator *op, uint32_t num_qubits, QkObs **out)
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:
where () is the fermionic creation (annihilation) operator acting on the -th spin-less fermionic mode, with are the spin- Pauli operators and .
This mapping preserves the fermionic anti-commutation relations by introducing a chain of operators on all qubits preceding the acted-upon index .
[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.
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;
6QfExitCode exit = qf_ferm_op_jordan_wigner(hamil, 4, &result);
7
8assert(exit == QfExitCode_Success);Parameters
- op – A pointer to the fermionic operator to be mapped.
- num_qubits – The number of qubits of the resulting operator. This must be strictly greater than the largest mode index acted upon by
op. - out – A pointer to where the created qubit operator will be written on success. It is left untouched if the transformation fails.
Returns
An exit code. This is >0 if an error occurred. In particular, a QfExitCode_ValueError is returned if num_qubits is too small to hold the operator’s support.
qf_fermion_to_majorana
QfMajoranaOperator *qf_fermion_to_majorana(const QfFermionOperator *fer_op)
Map a QfFermionOperator to a QfMajoranaOperator.
Definition
This function implements the simple transformation:
where () is the fermionic creation (annihilation) operator acting on the -th spin-less fermionic mode, and / 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.
qf_majorana_to_fermion
QfFermionOperator *qf_majorana_to_fermion(const QfMajoranaOperator *maj_op)
Map a QfMajoranaOperator to a QfFermionOperator.
Definition
This function implements the simple transformation:
where / are the two Majorana fermion operators (stored on the even and odd modes, respectively), and () is the fermionic creation (annihilation) operator acting on the -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.