PiecewiseLinearPauliRotations
class qiskit.circuit.library.PiecewiseLinearPauliRotations(num_state_qubits=None, breakpoints=None, slopes=None, offsets=None, basis='Y', name='pw_lin')
Bases: FunctionalPauliRotations
Piecewise-linearly-controlled Pauli rotations.
For a piecewise linear (not necessarily continuous) function , which is defined through breakpoints, slopes and offsets as follows. Suppose the breakpoints are a subset of , where is the number of state qubits. Further on, denote the corresponding slopes and offsets by and respectively. Then f(x) is defined as:
where we implicitly assume .
Construct piecewise-linearly-controlled Pauli rotations.
Parameters
- num_state_qubits (int | None) – The number of qubits representing the state.
- breakpoints (list[int] | None) – The breakpoints to define the piecewise-linear function. Defaults to
[0]
. - slopes (list[float] | np.ndarray | None) – The slopes for different segments of the piecewise-linear function. Defaults to
[1]
. - offsets (list[float] | np.ndarray | None) – The offsets for different segments of the piecewise-linear function. Defaults to
[0]
. - basis (str) – The type of Pauli rotation (
'X'
,'Y'
,'Z'
). - name (str) – The name of the circuit.
Attributes
breakpoints
The breakpoints of the piecewise linear function.
The function is linear in the intervals [point_i, point_{i+1}]
where the last point implicitly is 2**(num_state_qubits + 1)
.
contains_zero_breakpoint
Whether 0 is the first breakpoint.
Returns
True, if 0 is the first breakpoint, otherwise False.
mapped_offsets
The offsets mapped to the internal representation.
Returns
The mapped offsets.
mapped_slopes
The slopes mapped to the internal representation.
Returns
The mapped slopes.
offsets
The breakpoints of the piecewise linear function.
The function is linear in the intervals [point_i, point_{i+1}]
where the last point implicitly is 2**(num_state_qubits + 1)
.
slopes
The breakpoints of the piecewise linear function.
The function is linear in the intervals [point_i, point_{i+1}]
where the last point implicitly is 2**(num_state_qubits + 1)
.
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