LinearPauliRotations
class qiskit.circuit.library.LinearPauliRotations(num_state_qubits=None, slope=1, offset=0, basis='Y', name='LinRot')
Bases: FunctionalPauliRotations
Linearly-controlled X, Y or Z rotation.
For a register of state qubits , a target qubit 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 slope
and offset
and the basis 'Y'
:
Since for small arguments 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 .
- 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