Skip to main contentIBM Quantum Documentation Mirror

LinearPauliRotations

class qiskit.circuit.library.LinearPauliRotations(num_state_qubits=None, slope=1, offset=0, basis='Y', name='LinRot')

GitHub

Bases: FunctionalPauliRotations

Linearly-controlled X, Y or Z rotation.

For a register of state qubits x|x\rangle, a target qubit 0|0\rangle and the basis 'Y' this circuit acts as:

    q_0: ─────────────────────────■───────── ... ──────────────────────

                                  .

q_(n-1): ─────────────────────────┼───────── ... ───────────■──────────
          ┌────────────┐  ┌───────┴───────┐       ┌─────────┴─────────┐
    q_n: ─┤ RY(offset) ├──┤ RY(2^0 slope) ├  ...  ┤ RY(2^(n-1) slope) ├
          └────────────┘  └───────────────┘       └───────────────────┘

This can for example be used to approximate linear functions, with a=a = slope/2/2 and b=b = offset/2/2 and the basis 'Y':

x0cos(ax+b)x0+sin(ax+b)x1|x\rangle |0\rangle \mapsto \cos(ax + b)|x\rangle|0\rangle + \sin(ax + b)|x\rangle |1\rangle

Since for small arguments sin(x)x\sin(x) \approx x this operator can be used to approximate linear functions.

Create a new linear rotation circuit.

Parameters

  • num_state_qubits (Optional[int]) – The number of qubits representing the state x|x\rangle.
  • slope (float) – The slope of the controlled rotation.
  • offset (float) – The offset of the controlled rotation.
  • basis (str) – The type of Pauli rotation (‘X’, ‘Y’, ‘Z’).
  • name (str) – The name of the circuit object.

Attributes

offset

The angle of the single qubit offset rotation on the target qubit.

Before applying the controlled rotations, a single rotation of angle offset is applied to the target qubit.

Returns

The offset angle.

slope

The multiplicative factor in the rotation angle of the controlled rotations.

The rotation angles are slope * 2^0, slope * 2^1, … , slope * 2^(n-1) where n is the number of state qubits.

Returns

The rotation angle common in all controlled rotations.

name

Type: str

A human-readable name for the circuit.

Example

from qiskit import QuantumCircuit
 
qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
my_circuit