ZZFeatureMap

class ZZFeatureMap(entangling_layout='linear')[source]

Bases: FeatureMap

ZZ entangling encoding (Havlíček et al., 2019).

Applies Hadamards on every qubit, RZ(2 * x_i) per qubit, then RZZ(2 * x_i)(π x_j)) on every pair from the entangling layout.

Parameters:

entangling_layout (Literal['linear', 'circular', 'all-to-all']) – Pair pattern for the ZZ interactions. "linear" ((i, i+1)), "circular" (linear + wrap-around), or "all-to-all" (all unordered pairs). Defaults to "linear". For n_qubits == 2, "circular" is equivalent to "linear": the single pair already connects both qubits and RZZ is symmetric.

Methods Summary

build(features, n_qubits, **kwargs)

Build the feature-map circuit.

n_params(n_qubits, **kwargs)

One feature per qubit (re-used inside the ZZ pair terms).

Methods Documentation

build(features, n_qubits, **kwargs)[source]

Build the feature-map circuit.

Parameters:
  • features – Flat parameter array of length n_params(n_qubits). Entries are Qiskit Parameter objects bound from classical data at execution time.

  • n_qubits (int) – Number of qubits.

Returns:

Qiskit circuit implementing the encoding.

Return type:

QuantumCircuit

static n_params(n_qubits, **kwargs)[source]

One feature per qubit (re-used inside the ZZ pair terms).

Return type:

int