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.ancillas

Returns a list of ancilla bits in the order that the registers were added.

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.global_phase

Return the global phase of the circuit in radians.

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_ancillas

Return 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

PiecewiseLinearPauliRotations.AND(…[, …])

Build a collective conjunction (AND) circuit in place using mct.

PiecewiseLinearPauliRotations.OR(…[, …])

Build a collective disjunction (OR) circuit in place using mct.

PiecewiseLinearPauliRotations.__getitem__(item)

Return indexed operation.

PiecewiseLinearPauliRotations.__len__()

Return number of operations in circuit.

PiecewiseLinearPauliRotations.add_register(*regs)

Add registers.

PiecewiseLinearPauliRotations.append(instruction)

Append one or more instructions to the end of the circuit, modifying the circuit in place.

PiecewiseLinearPauliRotations.assign_parameters(…)

Assign parameters to new parameters or values.

PiecewiseLinearPauliRotations.barrier(*qargs)

Apply Barrier.

PiecewiseLinearPauliRotations.bind_parameters(…)

Assign numeric parameters to values yielding a new circuit.

PiecewiseLinearPauliRotations.cast(value, _type)

Best effort to cast value to type.

PiecewiseLinearPauliRotations.cbit_argument_conversion(…)

Converts several classical bit representations (such as indexes, range, etc.) into a list of classical bits.

PiecewiseLinearPauliRotations.ccx(…[, …])

Apply CCXGate.

PiecewiseLinearPauliRotations.ch(…[, …])

Apply CHGate.

PiecewiseLinearPauliRotations.cls_instances()

Return the current number of instances of this class, useful for auto naming.

PiecewiseLinearPauliRotations.cls_prefix()

Return the prefix to use for auto naming.

PiecewiseLinearPauliRotations.cnot(…[, …])

Apply CXGate.

PiecewiseLinearPauliRotations.combine(rhs)

Append rhs to self if self contains compatible registers.

PiecewiseLinearPauliRotations.compose(other)

Compose circuit with other circuit or instruction, optionally permuting wires.

PiecewiseLinearPauliRotations.control([…])

Control this circuit on num_ctrl_qubits qubits.

PiecewiseLinearPauliRotations.copy([name])

Copy the circuit.

PiecewiseLinearPauliRotations.count_ops()

Count each operation kind in the circuit.

PiecewiseLinearPauliRotations.cp(theta, …)

Apply CPhaseGate.

PiecewiseLinearPauliRotations.crx(theta, …)

Apply CRXGate.

PiecewiseLinearPauliRotations.cry(theta, …)

Apply CRYGate.

PiecewiseLinearPauliRotations.crz(theta, …)

Apply CRZGate.

PiecewiseLinearPauliRotations.cswap(…[, …])

Apply CSwapGate.

PiecewiseLinearPauliRotations.csx(…[, …])

Apply CSXGate.

PiecewiseLinearPauliRotations.cu(theta, phi, …)

Apply CUGate.

PiecewiseLinearPauliRotations.cu1(theta, …)

Apply CU1Gate.

PiecewiseLinearPauliRotations.cu3(theta, …)

Apply CU3Gate.

PiecewiseLinearPauliRotations.cx(…[, …])

Apply CXGate.

PiecewiseLinearPauliRotations.cy(…[, …])

Apply CYGate.

PiecewiseLinearPauliRotations.cz(…[, …])

Apply CZGate.

PiecewiseLinearPauliRotations.dcx(qubit1, qubit2)

Apply DCXGate.

PiecewiseLinearPauliRotations.decompose()

Call a decomposition pass on this circuit, to decompose one level (shallow decompose).

PiecewiseLinearPauliRotations.depth()

Return circuit depth (i.e., length of critical path).

PiecewiseLinearPauliRotations.diag_gate(…)

Deprecated version of QuantumCircuit.diagonal.

PiecewiseLinearPauliRotations.diagonal(diag, …)

Attach a diagonal gate to a circuit.

PiecewiseLinearPauliRotations.draw([output, …])

Draw the quantum circuit.

PiecewiseLinearPauliRotations.evaluate(x)

Classically evaluate the piecewise linear rotation.

PiecewiseLinearPauliRotations.extend(rhs)

Append QuantumCircuit to the right hand side if it contains compatible registers.

PiecewiseLinearPauliRotations.fredkin(…[, …])

Apply CSwapGate.

PiecewiseLinearPauliRotations.from_qasm_file(path)

Take in a QASM file and generate a QuantumCircuit object.

PiecewiseLinearPauliRotations.from_qasm_str(…)

Take in a QASM string and generate a QuantumCircuit object.

PiecewiseLinearPauliRotations.h(qubit, *[, q])

Apply HGate.

PiecewiseLinearPauliRotations.hamiltonian(…)

Apply hamiltonian evolution to to qubits.

PiecewiseLinearPauliRotations.has_register(…)

Test if this circuit has the register r.

PiecewiseLinearPauliRotations.i(qubit, *[, q])

Apply IGate.

PiecewiseLinearPauliRotations.id(qubit, *[, q])

Apply IGate.

PiecewiseLinearPauliRotations.iden(qubit, *)

Deprecated identity gate.

PiecewiseLinearPauliRotations.initialize(…)

Apply initialize to circuit.

PiecewiseLinearPauliRotations.inverse()

Invert (take adjoint of) this circuit.

PiecewiseLinearPauliRotations.iso(isometry, …)

Attach an arbitrary isometry from m to n qubits to a circuit.

PiecewiseLinearPauliRotations.isometry(…)

Attach an arbitrary isometry from m to n qubits to a circuit.

PiecewiseLinearPauliRotations.iswap(qubit1, …)

Apply iSwapGate.

PiecewiseLinearPauliRotations.mcmt(gate, …)

Apply a multi-control, multi-target using a generic gate.

PiecewiseLinearPauliRotations.mcrx(theta, …)

Apply Multiple-Controlled X rotation gate

PiecewiseLinearPauliRotations.mcry(theta, …)

Apply Multiple-Controlled Y rotation gate

PiecewiseLinearPauliRotations.mcrz(lam, …)

Apply Multiple-Controlled Z rotation gate

PiecewiseLinearPauliRotations.mct(…[, …])

Apply MCXGate.

PiecewiseLinearPauliRotations.mcu1(lam, …)

Apply MCU1Gate.

PiecewiseLinearPauliRotations.mcx(…[, …])

Apply MCXGate.

PiecewiseLinearPauliRotations.measure(qubit, …)

Measure quantum bit into classical bit (tuples).

PiecewiseLinearPauliRotations.measure_active([…])

Adds measurement to all non-idle qubits.

PiecewiseLinearPauliRotations.measure_all([…])

Adds measurement to all qubits.

PiecewiseLinearPauliRotations.mirror()

DEPRECATED: use circuit.reverse_ops().

PiecewiseLinearPauliRotations.ms(theta, qubits)

Apply MSGate.

PiecewiseLinearPauliRotations.num_connected_components([…])

How many non-entangled subcircuits can the circuit be factored to.

PiecewiseLinearPauliRotations.num_nonlocal_gates()

Return number of non-local gates (i.e.

PiecewiseLinearPauliRotations.num_tensor_factors()

Computes the number of tensor factors in the unitary (quantum) part of the circuit only.

PiecewiseLinearPauliRotations.num_unitary_factors()

Computes the number of tensor factors in the unitary (quantum) part of the circuit only.

PiecewiseLinearPauliRotations.p(theta, qubit)

Apply PhaseGate.

PiecewiseLinearPauliRotations.power(power[, …])

Raise this circuit to the power of power.

PiecewiseLinearPauliRotations.qasm([…])

Return OpenQASM string.

PiecewiseLinearPauliRotations.qbit_argument_conversion(…)

Converts several qubit representations (such as indexes, range, etc.) into a list of qubits.

PiecewiseLinearPauliRotations.r(theta, phi, …)

Apply RGate.

PiecewiseLinearPauliRotations.rcccx(…)

Apply RC3XGate.

PiecewiseLinearPauliRotations.rccx(…)

Apply RCCXGate.

PiecewiseLinearPauliRotations.remove_final_measurements([…])

Removes final measurement on all qubits if they are present.

PiecewiseLinearPauliRotations.repeat(reps)

Repeat this circuit reps times.

PiecewiseLinearPauliRotations.reset(qubit)

Reset q.

PiecewiseLinearPauliRotations.reverse_bits()

Return a circuit with the opposite order of wires.

PiecewiseLinearPauliRotations.reverse_ops()

Reverse the circuit by reversing the order of instructions.

PiecewiseLinearPauliRotations.rx(theta, qubit, *)

Apply RXGate.

PiecewiseLinearPauliRotations.rxx(theta, …)

Apply RXXGate.

PiecewiseLinearPauliRotations.ry(theta, qubit, *)

Apply RYGate.

PiecewiseLinearPauliRotations.ryy(theta, …)

Apply RYYGate.

PiecewiseLinearPauliRotations.rz(phi, qubit, *)

Apply RZGate.

PiecewiseLinearPauliRotations.rzx(theta, …)

Apply RZXGate.

PiecewiseLinearPauliRotations.rzz(theta, …)

Apply RZZGate.

PiecewiseLinearPauliRotations.s(qubit, *[, q])

Apply SGate.

PiecewiseLinearPauliRotations.sdg(qubit, *)

Apply SdgGate.

PiecewiseLinearPauliRotations.size()

Returns total number of gate operations in circuit.

PiecewiseLinearPauliRotations.snapshot(label)

Take a statevector snapshot of the internal simulator representation.

PiecewiseLinearPauliRotations.snapshot_density_matrix(label)

Take a density matrix snapshot of simulator state.

PiecewiseLinearPauliRotations.snapshot_expectation_value(…)

Take a snapshot of expectation value <O> of an Operator.

PiecewiseLinearPauliRotations.snapshot_probabilities(…)

Take a probability snapshot of the simulator state.

PiecewiseLinearPauliRotations.snapshot_stabilizer(label)

Take a stabilizer snapshot of the simulator state.

PiecewiseLinearPauliRotations.snapshot_statevector(label)

Take a statevector snapshot of the simulator state.

PiecewiseLinearPauliRotations.squ(…[, …])

Decompose an arbitrary 2*2 unitary into three rotation gates.

PiecewiseLinearPauliRotations.swap(qubit1, …)

Apply SwapGate.

PiecewiseLinearPauliRotations.sx(qubit)

Apply SXGate.

PiecewiseLinearPauliRotations.sxdg(qubit)

Apply SXdgGate.

PiecewiseLinearPauliRotations.t(qubit, *[, q])

Apply TGate.

PiecewiseLinearPauliRotations.tdg(qubit, *)

Apply TdgGate.

PiecewiseLinearPauliRotations.to_gate([…])

Create a Gate out of this circuit.

PiecewiseLinearPauliRotations.to_instruction([…])

Create an Instruction out of this circuit.

PiecewiseLinearPauliRotations.toffoli(…[, …])

Apply CCXGate.

PiecewiseLinearPauliRotations.u(theta, phi, …)

Apply UGate.

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.

PiecewiseLinearPauliRotations.ucg(…[, …])

Deprecated version of uc.

PiecewiseLinearPauliRotations.ucrx(…)

Attach a uniformly controlled (also called multiplexed) Rx rotation gate to a circuit.

PiecewiseLinearPauliRotations.ucry(…)

Attach a uniformly controlled (also called multiplexed) Ry rotation gate to a circuit.

PiecewiseLinearPauliRotations.ucrz(…)

Attach a uniformly controlled (also called multiplexed gates) Rz rotation gate to a circuit.

PiecewiseLinearPauliRotations.ucx(…)

Deprecated version of ucrx.

PiecewiseLinearPauliRotations.ucy(…)

Deprecated version of ucry.

PiecewiseLinearPauliRotations.ucz(…)

Deprecated version of ucrz.

PiecewiseLinearPauliRotations.unitary(obj, …)

Apply unitary gate to q.

PiecewiseLinearPauliRotations.width()

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.

PiecewiseLinearPauliRotations.__getitem__(item)

Return indexed operation.

PiecewiseLinearPauliRotations.__len__()

Return number of operations in circuit.