---
title: library (latest version)
description: API reference for qiskit_fermions.mappers.library in the latest version of qiskit-fermions
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit-fermions/mappers-library
---

# Mapper Library

This module provides efficient implementations of commonly used operator representation mapper routines.

## Python wrappers

The functions below are thin, type-agnostic convenience mappers. Each delegates to the appropriate library implementation below under the hood, based on the type of the object it is given. They do not implement any conversion logic themselves.

|                                                                                                                                                                                                       |                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`fermion_operator`](/docs/api/qiskit-fermions/mappers-library-fermion-operator#qiskit_fermions.mappers.library.fermion_operator "qiskit_fermions.mappers.library.fermion_operator")(operator)        | Converts an operator into a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator").     |
| [`jordan_wigner`](/docs/api/qiskit-fermions/mappers-library-jordan-wigner#qiskit_fermions.mappers.library.jordan_wigner "qiskit_fermions.mappers.library.jordan_wigner")(operator, num\_qubits)       | Map an operator to a `SparseObservable` under the Jordan-Wigner transformation.                                                                                                                  |
| [`majorana_operator`](/docs/api/qiskit-fermions/mappers-library-majorana-operator#qiskit_fermions.mappers.library.majorana_operator "qiskit_fermions.mappers.library.majorana_operator")(operator)    | Converts an operator into a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator"). |
| [`ternary_tree`](/docs/api/qiskit-fermions/mappers-library-ternary-tree#qiskit_fermions.mappers.library.ternary_tree "qiskit_fermions.mappers.library.ternary_tree")(operator, encoding, num\_qubits) | Map an operator to a `SparseObservable` under a ternary-tree encoding.                                                                                                                           |

## Library implementations

The functions below are the native, efficient mapper implementations backing this module.

|                                                                                                                                                                                                                                                           |                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`fermion_jordan_wigner`](/docs/api/qiskit-fermions/mappers-library-fermion-jordan-wigner#qiskit_fermions.mappers.library.fermion_jordan_wigner "qiskit_fermions.mappers.library.fermion_jordan_wigner")(op, num\_qubits)                                 | Map a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under the Jordan-Wigner transformation.                                                                                         |
| [`majorana_jordan_wigner`](/docs/api/qiskit-fermions/mappers-library-majorana-jordan-wigner#qiskit_fermions.mappers.library.majorana_jordan_wigner "qiskit_fermions.mappers.library.majorana_jordan_wigner")(op, num\_qubits)                             | Map a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under the Jordan-Wigner transformation.                                                                                     |
| [`edge_vertex_jordan_wigner`](/docs/api/qiskit-fermions/mappers-library-edge-vertex-jordan-wigner#qiskit_fermions.mappers.library.edge_vertex_jordan_wigner "qiskit_fermions.mappers.library.edge_vertex_jordan_wigner")(op, num\_qubits)                 | Map an [`EdgeVertexOperator`](/docs/api/qiskit-fermions/operators-edge-vertex-operator#qiskit_fermions.operators.EdgeVertexOperator "qiskit_fermions.operators.EdgeVertexOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under the Jordan-Wigner transformation.                                                                           |
| [`transfer_vertex_jordan_wigner`](/docs/api/qiskit-fermions/mappers-library-transfer-vertex-jordan-wigner#qiskit_fermions.mappers.library.transfer_vertex_jordan_wigner "qiskit_fermions.mappers.library.transfer_vertex_jordan_wigner")(op, num\_qubits) | Map a [`TransferVertexOperator`](/docs/api/qiskit-fermions/operators-transfer-vertex-operator#qiskit_fermions.operators.TransferVertexOperator "qiskit_fermions.operators.TransferVertexOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under the Jordan-Wigner transformation.                                                            |
| [`fermion_to_majorana`](/docs/api/qiskit-fermions/mappers-library-fermion-to-majorana#qiskit_fermions.mappers.library.fermion_to_majorana "qiskit_fermions.mappers.library.fermion_to_majorana")(fer\_op)                                                 | Map a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator") to a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator").                                        |
| [`majorana_to_fermion`](/docs/api/qiskit-fermions/mappers-library-majorana-to-fermion#qiskit_fermions.mappers.library.majorana_to_fermion "qiskit_fermions.mappers.library.majorana_to_fermion")(maj\_op)                                                 | Map a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator") to a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator").                                        |
| [`edge_vertex_to_fermion`](/docs/api/qiskit-fermions/mappers-library-edge-vertex-to-fermion#qiskit_fermions.mappers.library.edge_vertex_to_fermion "qiskit_fermions.mappers.library.edge_vertex_to_fermion")(inter\_op)                                   | Map an [`EdgeVertexOperator`](/docs/api/qiskit-fermions/operators-edge-vertex-operator#qiskit_fermions.operators.EdgeVertexOperator "qiskit_fermions.operators.EdgeVertexOperator") to a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator").                              |
| [`edge_vertex_to_majorana`](/docs/api/qiskit-fermions/mappers-library-edge-vertex-to-majorana#qiskit_fermions.mappers.library.edge_vertex_to_majorana "qiskit_fermions.mappers.library.edge_vertex_to_majorana")(inter\_op)                               | Map an [`EdgeVertexOperator`](/docs/api/qiskit-fermions/operators-edge-vertex-operator#qiskit_fermions.operators.EdgeVertexOperator "qiskit_fermions.operators.EdgeVertexOperator") to a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator").                          |
| [`transfer_vertex_to_fermion`](/docs/api/qiskit-fermions/mappers-library-transfer-vertex-to-fermion#qiskit_fermions.mappers.library.transfer_vertex_to_fermion "qiskit_fermions.mappers.library.transfer_vertex_to_fermion")(inter\_op)                   | Map a [`TransferVertexOperator`](/docs/api/qiskit-fermions/operators-transfer-vertex-operator#qiskit_fermions.operators.TransferVertexOperator "qiskit_fermions.operators.TransferVertexOperator") to a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator").               |
| [`transfer_vertex_to_majorana`](/docs/api/qiskit-fermions/mappers-library-transfer-vertex-to-majorana#qiskit_fermions.mappers.library.transfer_vertex_to_majorana "qiskit_fermions.mappers.library.transfer_vertex_to_majorana")(inter\_op)               | Map a [`TransferVertexOperator`](/docs/api/qiskit-fermions/operators-transfer-vertex-operator#qiskit_fermions.operators.TransferVertexOperator "qiskit_fermions.operators.TransferVertexOperator") to a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator").           |
| [`transfer_vertex_to_edge_vertex`](/docs/api/qiskit-fermions/mappers-library-transfer-vertex-to-edge-vertex#qiskit_fermions.mappers.library.transfer_vertex_to_edge_vertex "qiskit_fermions.mappers.library.transfer_vertex_to_edge_vertex")(inter\_op)   | Map a [`TransferVertexOperator`](/docs/api/qiskit-fermions/operators-transfer-vertex-operator#qiskit_fermions.operators.TransferVertexOperator "qiskit_fermions.operators.TransferVertexOperator") to an [`EdgeVertexOperator`](/docs/api/qiskit-fermions/operators-edge-vertex-operator#qiskit_fermions.operators.EdgeVertexOperator "qiskit_fermions.operators.EdgeVertexOperator"). |

## Ternary-tree encodings

These map an operator through a ternary-tree encoding, which is built with [`TernaryTree`](/docs/api/qiskit-fermions/mappers-ternary-tree#qiskit_fermions.mappers.TernaryTree "qiskit_fermions.mappers.TernaryTree") and [`TernaryTreeEncoding`](/docs/api/qiskit-fermions/mappers-ternary-tree-encoding#qiskit_fermions.mappers.TernaryTreeEncoding "qiskit_fermions.mappers.TernaryTreeEncoding") from the [`mappers`](/docs/api/qiskit-fermions/mappers#module-qiskit_fermions.mappers "qiskit_fermions.mappers") framework module. Compile a tree once and reuse the encoding across every operator mapped through it. The type-agnostic [`ternary_tree()`](/docs/api/qiskit-fermions/mappers-library-ternary-tree#qiskit_fermions.mappers.library.ternary_tree "qiskit_fermions.mappers.library.ternary_tree") wrapper dispatches to these.

|                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`fermion_ternary_tree`](/docs/api/qiskit-fermions/mappers-library-fermion-ternary-tree#qiskit_fermions.mappers.library.fermion_ternary_tree "qiskit_fermions.mappers.library.fermion_ternary_tree")(op, encoding, num\_qubits)                         | Map a [`FermionOperator`](/docs/api/qiskit-fermions/operators-fermion-operator#qiskit_fermions.operators.FermionOperator "qiskit_fermions.operators.FermionOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under a ternary-tree encoding.                              |
| [`majorana_ternary_tree`](/docs/api/qiskit-fermions/mappers-library-majorana-ternary-tree#qiskit_fermions.mappers.library.majorana_ternary_tree "qiskit_fermions.mappers.library.majorana_ternary_tree")(op, encoding, num\_qubits)                     | Map a [`MajoranaOperator`](/docs/api/qiskit-fermions/operators-majorana-operator#qiskit_fermions.operators.MajoranaOperator "qiskit_fermions.operators.MajoranaOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under a ternary-tree encoding.                          |
| [`edge_vertex_ternary_tree`](/docs/api/qiskit-fermions/mappers-library-edge-vertex-ternary-tree#qiskit_fermions.mappers.library.edge_vertex_ternary_tree "qiskit_fermions.mappers.library.edge_vertex_ternary_tree")(op, encoding, ...)                 | Map an [`EdgeVertexOperator`](/docs/api/qiskit-fermions/operators-edge-vertex-operator#qiskit_fermions.operators.EdgeVertexOperator "qiskit_fermions.operators.EdgeVertexOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under a ternary-tree encoding.                |
| [`transfer_vertex_ternary_tree`](/docs/api/qiskit-fermions/mappers-library-transfer-vertex-ternary-tree#qiskit_fermions.mappers.library.transfer_vertex_ternary_tree "qiskit_fermions.mappers.library.transfer_vertex_ternary_tree")(op, encoding, ...) | Map a [`TransferVertexOperator`](/docs/api/qiskit-fermions/operators-transfer-vertex-operator#qiskit_fermions.operators.TransferVertexOperator "qiskit_fermions.operators.TransferVertexOperator") to a [`SparseObservable`](/docs/api/qiskit/qiskit.quantum_info.SparseObservable) under a ternary-tree encoding. |
