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

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

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

Return the global phase of the circuit in radians.

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_ancillas

Return the number of ancilla qubits.

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.

LinearPauliRotations.__getitem__(item)

Return indexed operation.

LinearPauliRotations.__len__()

Return number of operations in circuit.

LinearPauliRotations.add_register(*regs)

Add registers.

LinearPauliRotations.append(instruction[, …])

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

LinearPauliRotations.assign_parameters(…)

Assign parameters to new parameters or values.

LinearPauliRotations.barrier(*qargs)

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.

LinearPauliRotations.cbit_argument_conversion(…)

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.

LinearPauliRotations.cls_instances()

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

LinearPauliRotations.cls_prefix()

Return the prefix to use for auto naming.

LinearPauliRotations.cnot(control_qubit, …)

Apply CXGate.

LinearPauliRotations.combine(rhs)

Append rhs to self if self contains compatible registers.

LinearPauliRotations.compose(other[, …])

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

LinearPauliRotations.control([…])

Control this circuit on num_ctrl_qubits qubits.

LinearPauliRotations.copy([name])

Copy the circuit.

LinearPauliRotations.count_ops()

Count each operation kind in the circuit.

LinearPauliRotations.cp(theta, …[, label, …])

Apply CPhaseGate.

LinearPauliRotations.crx(theta, …[, …])

Apply CRXGate.

LinearPauliRotations.cry(theta, …[, …])

Apply CRYGate.

LinearPauliRotations.crz(theta, …[, …])

Apply CRZGate.

LinearPauliRotations.cswap(control_qubit, …)

Apply CSwapGate.

LinearPauliRotations.csx(control_qubit, …)

Apply CSXGate.

LinearPauliRotations.cu(theta, phi, lam, …)

Apply CUGate.

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.

LinearPauliRotations.decompose()

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

LinearPauliRotations.depth()

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.

LinearPauliRotations.extend(rhs)

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

LinearPauliRotations.fredkin(control_qubit, …)

Apply CSwapGate.

LinearPauliRotations.from_qasm_file(path)

Take in a QASM file and generate a QuantumCircuit object.

LinearPauliRotations.from_qasm_str(qasm_str)

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.

LinearPauliRotations.has_register(register)

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.

LinearPauliRotations.inverse()

Invert (take adjoint of) 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.

LinearPauliRotations.mcu1(lam, …)

Apply MCU1Gate.

LinearPauliRotations.mcx(control_qubits, …)

Apply MCXGate.

LinearPauliRotations.measure(qubit, cbit)

Measure quantum bit into classical bit (tuples).

LinearPauliRotations.measure_active([inplace])

Adds measurement to all non-idle qubits.

LinearPauliRotations.measure_all([inplace])

Adds measurement to all qubits.

LinearPauliRotations.mirror()

DEPRECATED: use circuit.reverse_ops().

LinearPauliRotations.ms(theta, qubits)

Apply MSGate.

LinearPauliRotations.num_connected_components([…])

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

LinearPauliRotations.num_nonlocal_gates()

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

LinearPauliRotations.num_tensor_factors()

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

LinearPauliRotations.num_unitary_factors()

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

LinearPauliRotations.p(theta, qubit)

Apply PhaseGate.

LinearPauliRotations.power(power[, matrix_power])

Raise this circuit to the power of power.

LinearPauliRotations.qasm([formatted, filename])

Return OpenQASM string.

LinearPauliRotations.qbit_argument_conversion(…)

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.

LinearPauliRotations.remove_final_measurements([…])

Removes final measurement on all qubits if they are present.

LinearPauliRotations.repeat(reps)

Repeat this circuit reps times.

LinearPauliRotations.reset(qubit)

Reset q.

LinearPauliRotations.reverse_bits()

Return a circuit with the opposite order of wires.

LinearPauliRotations.reverse_ops()

Reverse the circuit by reversing the order of instructions.

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.

LinearPauliRotations.size()

Returns total number of gate operations in circuit.

LinearPauliRotations.snapshot(label[, …])

Take a statevector snapshot of the internal simulator representation.

LinearPauliRotations.snapshot_density_matrix(label)

Take a density matrix snapshot of simulator state.

LinearPauliRotations.snapshot_expectation_value(…)

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

LinearPauliRotations.snapshot_probabilities(…)

Take a probability snapshot of the simulator state.

LinearPauliRotations.snapshot_stabilizer(label)

Take a stabilizer snapshot of the simulator state.

LinearPauliRotations.snapshot_statevector(label)

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.sx(qubit)

Apply SXGate.

LinearPauliRotations.sxdg(qubit)

Apply SXdgGate.

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

Apply TGate.

LinearPauliRotations.tdg(qubit, *[, q])

Apply TdgGate.

LinearPauliRotations.to_gate([…])

Create a Gate out of this circuit.

LinearPauliRotations.to_instruction([…])

Create an Instruction out of this circuit.

LinearPauliRotations.toffoli(control_qubit1, …)

Apply CCXGate.

LinearPauliRotations.u(theta, phi, lam, qubit)

Apply UGate.

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.

LinearPauliRotations.width()

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.

LinearPauliRotations.__getitem__(item)

Return indexed operation.

LinearPauliRotations.__len__()

Return number of operations in circuit.