# LinearPauliRotations¶

class LinearPauliRotations(num_state_qubits=None, slope=1, offset=0, basis='Y', name='LinRot')[source]

Linearly-controlled X, Y or Z rotation.

For a register of state qubits $$|x\rangle$$, a target qubit $$|0\rangle$$ and the basis 'Y' this circuit acts as:

    q_0: ─────────────────────────■───────── ... ──────────────────────
│
.
│
q_(n-1): ─────────────────────────┼───────── ... ───────────■──────────
┌────────────┐  ┌───────┴───────┐       ┌─────────┴─────────┐
q_n: ─┤ RY(offset) ├──┤ RY(2^0 slope) ├  ...  ┤ RY(2^(n-1) slope) ├
└────────────┘  └───────────────┘       └───────────────────┘


This can for example be used to approximate linear functions, with $$a/2 =$$ slope and $$b/2 =$$ offset and the basis 'Y':

$|x\rangle |0\rangle \mapsto \cos(ax + b)|x\rangle|0\rangle + \sin(ax + b)|x\rangle |1\rangle$

Since for small arguments $$\sin(x) \approx x$$ this operator can be used to approximate linear functions.

Create a new linear rotation circuit.

Parameters
• num_state_qubits (Optional[int]) – The number of qubits representing the state $$|x\rangle$$.

• slope (float) – The slope of the controlled rotation.

• offset (float) – The offset of the controlled rotation.

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

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

Attributes

 LinearPauliRotations.basis The kind of Pauli rotation to be used. LinearPauliRotations.clbits Returns a list of classical bits in the order that the registers were added. LinearPauliRotations.data Return the circuit data (instructions and context). LinearPauliRotations.extension_lib LinearPauliRotations.header LinearPauliRotations.instances LinearPauliRotations.n_qubits Deprecated, use num_qubits instead. LinearPauliRotations.num_ancilla_qubits The minimum number of ancilla qubits in the circuit. LinearPauliRotations.num_clbits Return number of classical bits. LinearPauliRotations.num_parameters Convenience function to get the number of parameter objects in the circuit. LinearPauliRotations.num_qubits Return number of qubits. LinearPauliRotations.num_state_qubits The number of state qubits representing the state $$|x\rangle$$. LinearPauliRotations.offset The angle of the single qubit offset rotation on the target qubit. LinearPauliRotations.parameters Convenience function to get the parameters defined in the parameter table. LinearPauliRotations.prefix LinearPauliRotations.qregs A list of the quantum registers associated with the circuit. LinearPauliRotations.qubits Returns a list of quantum bits in the order that the registers were added. LinearPauliRotations.slope The multiplicative factor in the rotation angle of the controlled rotations.

Methods

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