---
title: z_feature_map (v2.1)
description: API reference for qiskit.circuit.library.z_feature_map in qiskit v2.1
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/2.1/qiskit.circuit.library.z_feature_map
---

# qiskit.circuit.library.z\_feature\_map

`qiskit.circuit.library.z_feature_map(feature_dimension, reps=2, entanglement='full', alpha=2.0, data_map_func=None, parameter_prefix='x', insert_barriers=False, name='ZFeatureMap')`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.1/qiskit/circuit/library/data_preparation/pauli_feature_map.py#L170-L246)

The first order Pauli Z-evolution circuit.

On 3 qubits and with 2 repetitions the circuit is represented by:

```text
┌───┐┌─────────────┐┌───┐┌─────────────┐
┤ H ├┤ P(2.0*x[0]) ├┤ H ├┤ P(2.0*x[0]) ├
├───┤├─────────────┤├───┤├─────────────┤
┤ H ├┤ U(2.0*x[1]) ├┤ H ├┤ P(2.0*x[1]) ├
├───┤├─────────────┤├───┤├─────────────┤
┤ H ├┤ P(2.0*x[2]) ├┤ H ├┤ P(2.0*x[2]) ├
└───┘└─────────────┘└───┘└─────────────┘
```

This is a sub-class of [`PauliFeatureMap`](/docs/api/qiskit/2.1/qiskit.circuit.library.PauliFeatureMap "qiskit.circuit.library.PauliFeatureMap") where the Pauli strings are fixed as \[‘Z’]. As a result the first order expansion will be a circuit without entangling gates.

**Examples**

```python
>>> prep = z_feature_map(3, reps=3, insert_barriers=True)
>>> print(prep)
     ┌───┐ ░ ┌─────────────┐ ░ ┌───┐ ░ ┌─────────────┐ ░ ┌───┐ ░ ┌─────────────┐
q_0: ┤ H ├─░─┤ P(2.0*x[0]) ├─░─┤ H ├─░─┤ P(2.0*x[0]) ├─░─┤ H ├─░─┤ P(2.0*x[0]) ├
     ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤
q_1: ┤ H ├─░─┤ P(2.0*x[1]) ├─░─┤ H ├─░─┤ P(2.0*x[1]) ├─░─┤ H ├─░─┤ P(2.0*x[1]) ├
     ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤ ░ ├───┤ ░ ├─────────────┤
q_2: ┤ H ├─░─┤ P(2.0*x[2]) ├─░─┤ H ├─░─┤ P(2.0*x[2]) ├─░─┤ H ├─░─┤ P(2.0*x[2]) ├
     └───┘ ░ └─────────────┘ ░ └───┘ ░ └─────────────┘ ░ └───┘ ░ └─────────────┘
```

```python
>>> data_map = lambda x: x[0]*x[0] + 1  # note: input is an array
>>> prep = z_feature_map(3, reps=1, data_map_func=data_map)
>>> print(prep)
     ┌───┐┌──────────────────────┐
q_0: ┤ H ├┤ P(2.0*x[0]**2 + 2.0) ├
     ├───┤├──────────────────────┤
q_1: ┤ H ├┤ P(2.0*x[1]**2 + 2.0) ├
     ├───┤├──────────────────────┤
q_2: ┤ H ├┤ P(2.0*x[2]**2 + 2.0) ├
     └───┘└──────────────────────┘
```

```python
>>> from qiskit.circuit.library import TwoLocal
>>> ry = TwoLocal(3, "ry", "cz", reps=1).decompose()
>>> classifier = z_feature_map(3, reps=1) + ry
>>> print(classifier)
     ┌───┐┌─────────────┐┌──────────┐      ┌──────────┐
q_0: ┤ H ├┤ P(2.0*x[0]) ├┤ RY(θ[0]) ├─■──■─┤ RY(θ[3]) ├────────────
     ├───┤├─────────────┤├──────────┤ │  │ └──────────┘┌──────────┐
q_1: ┤ H ├┤ P(2.0*x[1]) ├┤ RY(θ[1]) ├─■──┼──────■──────┤ RY(θ[4]) ├
     ├───┤├─────────────┤├──────────┤    │      │      ├──────────┤
q_2: ┤ H ├┤ P(2.0*x[2]) ├┤ RY(θ[2]) ├────■──────■──────┤ RY(θ[5]) ├
     └───┘└─────────────┘└──────────┘                  └──────────┘
```

**Parameters**

- **feature\_dimension** ([*int*](https://docs.python.org/3/library/functions.html#int)) –
- **reps** ([*int*](https://docs.python.org/3/library/functions.html#int)) –
- **entanglement** ([*str*](https://docs.python.org/3/library/stdtypes.html#str) *| Sequence\[Sequence\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]] | Callable\[\[*[*int*](https://docs.python.org/3/library/functions.html#int)*],* [*str*](https://docs.python.org/3/library/stdtypes.html#str) *| Sequence\[Sequence\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]]]*) –
- **alpha** ([*float*](https://docs.python.org/3/library/functions.html#float)) –
- **data\_map\_func** (*Callable\[\[*[*Parameter*](/docs/api/qiskit/2.1/qiskit.circuit.Parameter "qiskit.circuit.Parameter")*],* [*ParameterExpression*](/docs/api/qiskit/2.1/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression")*] | None*) –
- **parameter\_prefix** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) –
- **insert\_barriers** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) –
- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) –

**Return type**

[QuantumCircuit](/docs/api/qiskit/2.1/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")
