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

PiecewiseLinearRotation.num_target_qubits

Returns the number of target qubits

Methods

PiecewiseLinearRotation.build(qc, q[, …])

Build the circuit.

PiecewiseLinearRotation.build_controlled(qc, …)

Adds corresponding controlled sub-circuit to given circuit

PiecewiseLinearRotation.build_controlled_inverse(qc, …)

Adds controlled inverse of corresponding sub-circuit to given circuit

PiecewiseLinearRotation.build_controlled_inverse_power(qc, …)

Adds controlled, inverse, power of corresponding circuit.

PiecewiseLinearRotation.build_controlled_power(qc, …)

Adds controlled power of corresponding circuit.

PiecewiseLinearRotation.build_inverse(qc, q)

Adds inverse of corresponding sub-circuit to given circuit

PiecewiseLinearRotation.build_inverse_power(qc, …)

Adds inverse power of corresponding circuit.

PiecewiseLinearRotation.build_power(qc, q, power)

Adds power of corresponding circuit.

PiecewiseLinearRotation.evaluate(x)

Classically evaluate the piecewise linear rotation

PiecewiseLinearRotation.get_num_qubits()

returns number of qubits

PiecewiseLinearRotation.get_num_qubits_controlled()

returns number of qubits controlled

PiecewiseLinearRotation.required_ancillas()

Return the number of required ancillas.

PiecewiseLinearRotation.required_ancillas_controlled()

returns required ancillas controlled