PiecewiseLinearRotation¶
- class PiecewiseLinearRotation(breakpoints, slopes, offsets, num_state_qubits, basis='Y', i_state=None, i_target=None)[source]¶
DEPRECATED. Piecewise-linearly-controlled rotation.
Deprecated since version 0.7.0: Use Terra’s qiskit.circuit.library.PiecewiseLinearPauliRotations instead.
For a piecewise linear (not necessarily continuous) function f(x). The function f(x) is defined through breakpoints, slopes and offsets as follows. Suppose the breakpoints { x_0, …, x_J } are a subset of [0, 2^n-1], where n is the number of state qubits. Further on, denote the corresponding slopes and offsets by a_j, b_j respectively. Then f(x) is defined as:
x < x_0 –> f(x) = 0 x_j <= x < x_{j+1} –> f(x) = a_j * (x - x_j) + b_j
where we implicitly assume x_{J+1} = 2^n.
- Parameters
breakpoints (Union(list, numpy.ndarray)) – breakpoints to define piecewise-linear function
slopes (Union(list, numpy.ndarray)) – slopes for different segments of piecewise-linear function
offsets (Union(list, numpy.ndarray)) – offsets for different segments of piecewise-linear function
num_state_qubits (int) – number of qubits representing the state
basis (Optional(str)) – type of Pauli rotation (‘X’, ‘Y’, ‘Z’)
i_state (Optional(Union(list, numpy.ndarray))) – indices of qubits representing the state, set to range(num_state_qubits) if None
i_target (Optional(int)) – index of target qubit, set to num_state_qubits if None
Attributes
Returns the number of target qubits
Methods
PiecewiseLinearRotation.build
(qc, q[, …])Build the circuit.
Adds corresponding controlled sub-circuit to given circuit
Adds controlled inverse of corresponding sub-circuit to given circuit
PiecewiseLinearRotation.build_controlled_inverse_power
(qc, …)Adds controlled, inverse, power of corresponding circuit.
Adds controlled power of corresponding circuit.
Adds inverse of corresponding sub-circuit to given circuit
Adds inverse power of corresponding circuit.
PiecewiseLinearRotation.build_power
(qc, q, power)Adds power of corresponding circuit.
Classically evaluate the piecewise linear rotation
returns number of qubits
returns number of qubits controlled
Return the number of required ancillas.
returns required ancillas controlled