Skip to main content
IBM Quantum Platform
Esta página pertence a uma versão antiga do Qiskit SDK Ir para a versão mais recente

PiecewiseLinearPauliRotations

class qiskit.circuit.library.PiecewiseLinearPauliRotations(num_state_qubits=None, breakpoints=None, slopes=None, offsets=None, basis='Y', name='pw_lin')

GitHub

Bases: FunctionalPauliRotations

Piecewise-linearly-controlled Pauli rotations.

For a piecewise linear (not necessarily continuous) function f(x)f(x), which is defined through breakpoints, slopes and offsets as follows. Suppose the breakpoints (x0,...,xJ)(x_0, ..., x_J) are a subset of [0,2n1][0, 2^n-1], where nn is the number of state qubits. Further on, denote the corresponding slopes and offsets by aja_j and bjb_j respectively. Then f(x) is defined as:

f(x)={0,x<x0aj(xxj)+bj,xjx<xj+1f(x) = \begin{cases} 0, x < x_0 \\ a_j (x - x_j) + b_j, x_j \leq x < x_{j+1} \end{cases}

where we implicitly assume xJ+1=2nx_{J+1} = 2^n.

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

Tipo: 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

Methods

evaluate

evaluate(x)

GitHub

Classically evaluate the piecewise linear rotation.

Parameters

x (float) – Value to be evaluated at.

Returns

Value of piecewise linear function at x.

Return type

float

Esta página foi útil?
Relate um bug, erro de digitação ou solicite conteúdo no GitHub.