# PolynomialPauliRotations¶

class PolynomialPauliRotations(num_state_qubits=None, coeffs=None, basis='Y', reverse=False, name='poly')[source]

A circuit implementing polynomial Pauli rotations.

For a polynomial :mathp(x), a basis state $$|i\rangle$$ and a target qubit $$|0\rangle$$ this operator acts as:

$|i\rangle |0\rangle \mapsto \cos(p(i)) |i\rangle |0\rangle + \sin(p(i)) |i\rangle |1\rangle$

Let n be the number of qubits representing the state, d the degree of p(x) and q_i the qubits, where q_0 is the least significant qubit. Then for

$x = \sum_{i=0}^{n-1} 2^i q_i,$

we can write

$p(x) = \sum_{j=0}^{j=d} c_j x_j$

where $$c$$ are the input coefficients, coeffs.

Prepare an approximation to a state with amplitudes specified by a polynomial.

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

• coeffs (Optional[List[float]]) – The coefficients of the polynomial. coeffs[i] is the coefficient of the i-th power of x. Defaults to linear: [0, 1].

• basis (str) – The type of Pauli rotation (‘X’, ‘Y’, ‘Z’).

• reverse (bool) – If True, apply the polynomial with the reversed list of qubits (i.e. q_n as q_0, q_n-1 as q_1, etc).

• name (str) – The name of the circuit.

Attributes

 PolynomialPauliRotations.ancillas Returns a list of ancilla bits in the order that the registers were added. PolynomialPauliRotations.basis The kind of Pauli rotation to be used. PolynomialPauliRotations.clbits Returns a list of classical bits in the order that the registers were added. PolynomialPauliRotations.coeffs The multiplicative factor in the rotation angle of the controlled rotations. PolynomialPauliRotations.data Return the circuit data (instructions and context). PolynomialPauliRotations.degree Return the degree of the polynomial, equals to the number of coefficients minus 1. PolynomialPauliRotations.extension_lib PolynomialPauliRotations.global_phase Return the global phase of the circuit in radians. PolynomialPauliRotations.header PolynomialPauliRotations.instances PolynomialPauliRotations.n_qubits Deprecated, use num_qubits instead. PolynomialPauliRotations.num_ancilla_qubits The number of ancilla qubits in this circuit. PolynomialPauliRotations.num_ancillas Return the number of ancilla qubits. PolynomialPauliRotations.num_clbits Return number of classical bits. PolynomialPauliRotations.num_parameters Convenience function to get the number of parameter objects in the circuit. PolynomialPauliRotations.num_qubits Return number of qubits. PolynomialPauliRotations.num_state_qubits The number of state qubits representing the state $$|x\rangle$$. PolynomialPauliRotations.parameters Convenience function to get the parameters defined in the parameter table. PolynomialPauliRotations.prefix PolynomialPauliRotations.qregs A list of the quantum registers associated with the circuit. PolynomialPauliRotations.qubits Returns a list of quantum bits in the order that the registers were added. PolynomialPauliRotations.reverse Whether to apply the rotations on the reversed list of qubits.

Methods

 PolynomialPauliRotations.AND(qr_variables, …) Build a collective conjunction (AND) circuit in place using mct. PolynomialPauliRotations.OR(qr_variables, …) Build a collective disjunction (OR) circuit in place using mct. Return indexed operation. Return number of operations in circuit. Add registers. PolynomialPauliRotations.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. PolynomialPauliRotations.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. PolynomialPauliRotations.ccx(control_qubit1, …) Apply CCXGate. PolynomialPauliRotations.ch(control_qubit, …) Apply CHGate. Return the current number of instances of this class, useful for auto naming. Return the prefix to use for auto naming. PolynomialPauliRotations.cnot(control_qubit, …) Apply CXGate. Append rhs to self if self contains compatible registers. PolynomialPauliRotations.compose(other[, …]) Compose circuit with other circuit or instruction, optionally permuting wires. Control this circuit on num_ctrl_qubits qubits. Copy the circuit. Count each operation kind in the circuit. PolynomialPauliRotations.cp(theta, …[, …]) Apply CPhaseGate. PolynomialPauliRotations.crx(theta, …[, …]) Apply CRXGate. PolynomialPauliRotations.cry(theta, …[, …]) Apply CRYGate. PolynomialPauliRotations.crz(theta, …[, …]) Apply CRZGate. PolynomialPauliRotations.cswap(…[, label, …]) Apply CSwapGate. PolynomialPauliRotations.csx(control_qubit, …) Apply CSXGate. PolynomialPauliRotations.cu(theta, phi, lam, …) Apply CUGate. PolynomialPauliRotations.cu1(theta, …[, …]) Apply CU1Gate. PolynomialPauliRotations.cu3(theta, phi, …) Apply CU3Gate. PolynomialPauliRotations.cx(control_qubit, …) Apply CXGate. PolynomialPauliRotations.cy(control_qubit, …) Apply CYGate. PolynomialPauliRotations.cz(control_qubit, …) Apply CZGate. PolynomialPauliRotations.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). PolynomialPauliRotations.diag_gate(diag, qubit) Deprecated version of QuantumCircuit.diagonal. PolynomialPauliRotations.diagonal(diag, qubit) Attach a diagonal gate to a circuit. PolynomialPauliRotations.draw([output, …]) Draw the quantum circuit. Append QuantumCircuit to the right hand side if it contains compatible registers. PolynomialPauliRotations.fredkin(…[, ctl, …]) Apply CSwapGate. Take in a QASM file and generate a QuantumCircuit object. Take in a QASM string and generate a QuantumCircuit object. PolynomialPauliRotations.h(qubit, *[, q]) Apply HGate. Apply hamiltonian evolution to to qubits. Test if this circuit has the register r. PolynomialPauliRotations.i(qubit, *[, q]) Apply IGate. PolynomialPauliRotations.id(qubit, *[, q]) Apply IGate. PolynomialPauliRotations.iden(qubit, *[, q]) Deprecated identity gate. Apply initialize to circuit. Invert (take adjoint of) this circuit. PolynomialPauliRotations.iso(isometry, …) Attach an arbitrary isometry from m to n qubits to a circuit. PolynomialPauliRotations.isometry(isometry, …) Attach an arbitrary isometry from m to n qubits to a circuit. PolynomialPauliRotations.iswap(qubit1, qubit2) Apply iSwapGate. PolynomialPauliRotations.mcmt(gate, …[, …]) Apply a multi-control, multi-target using a generic gate. PolynomialPauliRotations.mcrx(theta, …[, …]) Apply Multiple-Controlled X rotation gate PolynomialPauliRotations.mcry(theta, …[, …]) Apply Multiple-Controlled Y rotation gate PolynomialPauliRotations.mcrz(lam, …[, …]) Apply Multiple-Controlled Z rotation gate PolynomialPauliRotations.mct(control_qubits, …) Apply MCXGate. Apply MCU1Gate. PolynomialPauliRotations.mcx(control_qubits, …) Apply MCXGate. PolynomialPauliRotations.measure(qubit, cbit) Measure quantum bit into classical bit (tuples). Adds measurement to all non-idle qubits. Adds measurement to all qubits. DEPRECATED: use circuit.reverse_ops(). PolynomialPauliRotations.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. PolynomialPauliRotations.p(theta, qubit) Apply PhaseGate. PolynomialPauliRotations.power(power[, …]) Raise this circuit to the power of power. PolynomialPauliRotations.qasm([formatted, …]) Return OpenQASM string. Converts several qubit representations (such as indexes, range, etc.) into a list of qubits. PolynomialPauliRotations.r(theta, phi, qubit, *) Apply RGate. Apply RC3XGate. Apply RCCXGate. Removes final measurement on all qubits if they are present. Repeat this circuit reps times. Reset q. Return a circuit with the opposite order of wires. Reverse the circuit by reversing the order of instructions. PolynomialPauliRotations.rx(theta, qubit, *) Apply RXGate. PolynomialPauliRotations.rxx(theta, qubit1, …) Apply RXXGate. PolynomialPauliRotations.ry(theta, qubit, *) Apply RYGate. PolynomialPauliRotations.ryy(theta, qubit1, …) Apply RYYGate. PolynomialPauliRotations.rz(phi, qubit, *[, q]) Apply RZGate. PolynomialPauliRotations.rzx(theta, qubit1, …) Apply RZXGate. PolynomialPauliRotations.rzz(theta, qubit1, …) Apply RZZGate. PolynomialPauliRotations.s(qubit, *[, q]) Apply SGate. PolynomialPauliRotations.sdg(qubit, *[, q]) Apply SdgGate. Returns total number of gate operations in circuit. PolynomialPauliRotations.snapshot(label[, …]) 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. PolynomialPauliRotations.squ(unitary_matrix, …) Decompose an arbitrary 2*2 unitary into three rotation gates. PolynomialPauliRotations.swap(qubit1, qubit2) Apply SwapGate. Apply SXGate. Apply SXdgGate. PolynomialPauliRotations.t(qubit, *[, q]) Apply TGate. PolynomialPauliRotations.tdg(qubit, *[, q]) Apply TdgGate. Create a Gate out of this circuit. Create an Instruction out of this circuit. Apply CCXGate. PolynomialPauliRotations.u(theta, phi, lam, …) Apply UGate. PolynomialPauliRotations.u1(theta, qubit, *) Apply U1Gate. PolynomialPauliRotations.u2(phi, lam, qubit, *) Apply U2Gate. PolynomialPauliRotations.u3(theta, phi, lam, …) Apply U3Gate. PolynomialPauliRotations.uc(gate_list, …) Attach a uniformly controlled gates (also called multiplexed gates) to a circuit. PolynomialPauliRotations.ucg(angle_list, …) Deprecated version of uc. PolynomialPauliRotations.ucrx(angle_list, …) Attach a uniformly controlled (also called multiplexed) Rx rotation gate to a circuit. PolynomialPauliRotations.ucry(angle_list, …) Attach a uniformly controlled (also called multiplexed) Ry rotation gate to a circuit. PolynomialPauliRotations.ucrz(angle_list, …) Attach a uniformly controlled (also called multiplexed gates) Rz rotation gate to a circuit. PolynomialPauliRotations.ucx(angle_list, …) Deprecated version of ucrx. PolynomialPauliRotations.ucy(angle_list, …) Deprecated version of ucry. PolynomialPauliRotations.ucz(angle_list, …) Deprecated version of ucrz. PolynomialPauliRotations.unitary(obj, qubits) Apply unitary gate to q. Return number of qubits plus clbits in circuit. PolynomialPauliRotations.x(qubit, *[, …]) Apply XGate. PolynomialPauliRotations.y(qubit, *[, q]) Apply YGate. PolynomialPauliRotations.z(qubit, *[, q]) Apply ZGate. Return indexed operation. Return number of operations in circuit.