# PiecewiseLinearPauliRotations¶

class PiecewiseLinearPauliRotations(num_state_qubits=None, breakpoints=None, slopes=None, offsets=None, basis='Y', name='pw_lin')[source]

Piecewise-linearly-controlled Pauli rotations.

For a piecewise linear (not necessarily continuous) function $$f(x)$$, which 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$$ and $$b_j$$ respectively. Then f(x) is defined as:

$\begin{split}f(x) = \begin{cases} 0, x < x_0 \\ a_j (x - x_j) + b_j, x_j \leq x < x_{j+1} \end{cases}\end{split}$

where we implicitly assume $$x_{J+1} = 2^n$$.

Construct piecewise-linearly-controlled Pauli rotations.

Parameters
• num_state_qubits (Optional[int]) – The number of qubits representing the state.

• breakpoints (Optional[List[int]]) – The breakpoints to define the piecewise-linear function. Defaults to [0].

• slopes (Optional[List[float]]) – The slopes for different segments of the piecewise-linear function. Defaults to [1].

• offsets (Optional[List[float]]) – 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

 PiecewiseLinearPauliRotations.basis The kind of Pauli rotation to be used. PiecewiseLinearPauliRotations.breakpoints The breakpoints of the piecewise linear function. PiecewiseLinearPauliRotations.clbits Returns a list of classical bits in the order that the registers were added. PiecewiseLinearPauliRotations.contains_zero_breakpoint Whether 0 is the first breakpoint. PiecewiseLinearPauliRotations.data Return the circuit data (instructions and context). PiecewiseLinearPauliRotations.extension_lib PiecewiseLinearPauliRotations.header PiecewiseLinearPauliRotations.instances PiecewiseLinearPauliRotations.mapped_offsets The offsets mapped to the internal representation. PiecewiseLinearPauliRotations.mapped_slopes The slopes mapped to the internal representation. PiecewiseLinearPauliRotations.n_qubits Deprecated, use num_qubits instead. PiecewiseLinearPauliRotations.num_ancilla_qubits The number of ancilla qubits. PiecewiseLinearPauliRotations.num_clbits Return number of classical bits. PiecewiseLinearPauliRotations.num_parameters Convenience function to get the number of parameter objects in the circuit. PiecewiseLinearPauliRotations.num_qubits Return number of qubits. PiecewiseLinearPauliRotations.num_state_qubits The number of state qubits representing the state $$|x\rangle$$. PiecewiseLinearPauliRotations.offsets The breakpoints of the piecewise linear function. PiecewiseLinearPauliRotations.parameters Convenience function to get the parameters defined in the parameter table. PiecewiseLinearPauliRotations.prefix PiecewiseLinearPauliRotations.qregs A list of the quantum registers associated with the circuit. PiecewiseLinearPauliRotations.qubits Returns a list of quantum bits in the order that the registers were added. PiecewiseLinearPauliRotations.slopes The breakpoints of the piecewise linear function.

Methods

 Build a collective conjunction (AND) circuit in place using mct. Build a collective disjunction (OR) circuit in place using mct. Return indexed operation. Return number of operations in circuit. Add registers. PiecewiseLinearPauliRotations.append(instruction) Append one or more instructions to the end of the circuit, modifying the circuit in place. Assign parameters to new parameters or values. Apply Barrier. Assign numeric parameters to values yielding a new circuit. PiecewiseLinearPauliRotations.cast(value, _type) Best effort to cast value to type. Converts several classical bit representations (such as indexes, range, etc.) into a list of classical bits. Apply CCXGate. Apply CHGate. Return the current number of instances of this class, useful for auto naming. Return the prefix to use for auto naming. Apply CXGate. Append rhs to self if self contains compatible registers. Compose circuit with other circuit or instruction, optionally permuting wires. Copy the circuit. Count each operation kind in the circuit. Apply CRXGate. Apply CRYGate. Apply CRZGate. Apply CSwapGate. Apply CU1Gate. Apply CU3Gate. Apply CXGate. Apply CYGate. Apply CZGate. PiecewiseLinearPauliRotations.dcx(qubit1, qubit2) Apply DCXGate. Call a decomposition pass on this circuit, to decompose one level (shallow decompose). Return circuit depth (i.e., length of critical path). Deprecated version of QuantumCircuit.diagonal. Attach a diagonal gate to a circuit. PiecewiseLinearPauliRotations.draw([output, …]) Draw the quantum circuit. Classically evaluate the piecewise linear rotation. Append QuantumCircuit to the right hand side if it contains compatible registers. Apply CSwapGate. Take in a QASM file and generate a QuantumCircuit object. Take in a QASM string and generate a QuantumCircuit object. PiecewiseLinearPauliRotations.h(qubit, *[, q]) Apply HGate. Apply hamiltonian evolution to to qubits. Test if this circuit has the register r. PiecewiseLinearPauliRotations.i(qubit, *[, q]) Apply IGate. PiecewiseLinearPauliRotations.id(qubit, *[, q]) Apply IGate. Deprecated identity gate. Apply initialize to circuit. Invert this circuit. PiecewiseLinearPauliRotations.iso(isometry, …) Attach an arbitrary isometry from m to n qubits to a circuit. Attach an arbitrary isometry from m to n qubits to a circuit. Apply iSwapGate. Apply a multi-control, multi-target using a generic gate. Apply Multiple-Controlled X rotation gate Apply Multiple-Controlled Y rotation gate Apply Multiple-Controlled Z rotation gate Apply MCXGate. Apply MCU1Gate. Apply MCXGate. Measure quantum bit into classical bit (tuples). Adds measurement to all non-idle qubits. Adds measurement to all qubits. Mirror the circuit by reversing the instructions. PiecewiseLinearPauliRotations.ms(theta, qubits) Apply MSGate. How many non-entangled subcircuits can the circuit be factored to. Return number of non-local gates (i.e. Computes the number of tensor factors in the unitary (quantum) part of the circuit only. Computes the number of tensor factors in the unitary (quantum) part of the circuit only. Return OpenQASM string. Converts several qubit representations (such as indexes, range, etc.) into a list of qubits. PiecewiseLinearPauliRotations.r(theta, phi, …) Apply RGate. Apply RC3XGate. Apply RCCXGate. Removes final measurement on all qubits if they are present. Reset q. PiecewiseLinearPauliRotations.rx(theta, qubit, *) Apply RXGate. Apply RXXGate. PiecewiseLinearPauliRotations.ry(theta, qubit, *) Apply RYGate. Apply RYYGate. PiecewiseLinearPauliRotations.rz(phi, qubit, *) Apply RZGate. Apply RZXGate. Apply RZZGate. PiecewiseLinearPauliRotations.s(qubit, *[, q]) Apply SGate. Apply SdgGate. Returns total number of gate operations in circuit. Take a statevector snapshot of the internal simulator representation. Take a density matrix snapshot of simulator state. Take a snapshot of expectation value of an Operator. Take a probability snapshot of the simulator state. Take a stabilizer snapshot of the simulator state. Take a statevector snapshot of the simulator state. Decompose an arbitrary 2*2 unitary into three rotation gates. PiecewiseLinearPauliRotations.swap(qubit1, …) Apply SwapGate. PiecewiseLinearPauliRotations.t(qubit, *[, q]) Apply TGate. Apply TdgGate. Create a Gate out of this circuit. Create an Instruction out of this circuit. Apply CCXGate. PiecewiseLinearPauliRotations.u1(theta, qubit, *) Apply U1Gate. PiecewiseLinearPauliRotations.u2(phi, lam, …) Apply U2Gate. PiecewiseLinearPauliRotations.u3(theta, phi, …) Apply U3Gate. PiecewiseLinearPauliRotations.uc(gate_list, …) Attach a uniformly controlled gates (also called multiplexed gates) to a circuit. Deprecated version of uc. Attach a uniformly controlled (also called multiplexed) Rx rotation gate to a circuit. Attach a uniformly controlled (also called multiplexed) Ry rotation gate to a circuit. Attach a uniformly controlled (also called multiplexed gates) Rz rotation gate to a circuit. Deprecated version of ucrx. Deprecated version of ucry. Deprecated version of ucrz. Apply unitary gate to q. Return number of qubits plus clbits in circuit. PiecewiseLinearPauliRotations.x(qubit, *[, …]) Apply XGate. PiecewiseLinearPauliRotations.y(qubit, *[, q]) Apply YGate. PiecewiseLinearPauliRotations.z(qubit, *[, q]) Apply ZGate. Return indexed operation. Return number of operations in circuit.