InnerProduct

class InnerProduct(num_qubits)[source]

An n_qubit circuit that computes the inner product of two registers.

Return a circuit to compute the inner product of 2 n-qubit registers.

This implementation uses CZ gates.

Parameters

num_qubits (int) – width of top and bottom registers (half total circuit width)

Reference Circuit:

Attributes

InnerProduct.ancillas

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

InnerProduct.clbits

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

InnerProduct.data

Return the circuit data (instructions and context).

InnerProduct.extension_lib

InnerProduct.global_phase

Return the global phase of the circuit in radians.

InnerProduct.header

InnerProduct.instances

InnerProduct.n_qubits

Deprecated, use num_qubits instead.

InnerProduct.num_ancillas

Return the number of ancilla qubits.

InnerProduct.num_clbits

Return number of classical bits.

InnerProduct.num_parameters

Convenience function to get the number of parameter objects in the circuit.

InnerProduct.num_qubits

Return number of qubits.

InnerProduct.parameters

Convenience function to get the parameters defined in the parameter table.

InnerProduct.prefix

InnerProduct.qubits

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

Methods

InnerProduct.AND(qr_variables, qb_target, …)

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

InnerProduct.OR(qr_variables, qb_target, …)

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

InnerProduct.__getitem__(item)

Return indexed operation.

InnerProduct.__len__()

Return number of operations in circuit.

InnerProduct.add_register(*regs)

Add registers.

InnerProduct.append(instruction[, qargs, cargs])

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

InnerProduct.assign_parameters(param_dict[, …])

Assign parameters to new parameters or values.

InnerProduct.barrier(*qargs)

Apply Barrier.

InnerProduct.bind_parameters(value_dict)

Assign numeric parameters to values yielding a new circuit.

InnerProduct.cast(value, _type)

Best effort to cast value to type.

InnerProduct.cbit_argument_conversion(…)

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

InnerProduct.ccx(control_qubit1, …[, …])

Apply CCXGate.

InnerProduct.ch(control_qubit, target_qubit, *)

Apply CHGate.

InnerProduct.cls_instances()

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

InnerProduct.cls_prefix()

Return the prefix to use for auto naming.

InnerProduct.cnot(control_qubit, target_qubit, *)

Apply CXGate.

InnerProduct.combine(rhs)

Append rhs to self if self contains compatible registers.

InnerProduct.compose(other[, qubits, …])

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

InnerProduct.control([num_ctrl_qubits, …])

Control this circuit on num_ctrl_qubits qubits.

InnerProduct.copy([name])

Copy the circuit.

InnerProduct.count_ops()

Count each operation kind in the circuit.

InnerProduct.cp(theta, control_qubit, …[, …])

Apply CPhaseGate.

InnerProduct.crx(theta, control_qubit, …)

Apply CRXGate.

InnerProduct.cry(theta, control_qubit, …)

Apply CRYGate.

InnerProduct.crz(theta, control_qubit, …)

Apply CRZGate.

InnerProduct.cswap(control_qubit, …[, …])

Apply CSwapGate.

InnerProduct.csx(control_qubit, target_qubit)

Apply CSXGate.

InnerProduct.cu(theta, phi, lam, gamma, …)

Apply CUGate.

InnerProduct.cu1(theta, control_qubit, …)

Apply CU1Gate.

InnerProduct.cu3(theta, phi, lam, …[, …])

Apply CU3Gate.

InnerProduct.cx(control_qubit, target_qubit, *)

Apply CXGate.

InnerProduct.cy(control_qubit, target_qubit, *)

Apply CYGate.

InnerProduct.cz(control_qubit, target_qubit, *)

Apply CZGate.

InnerProduct.dcx(qubit1, qubit2)

Apply DCXGate.

InnerProduct.decompose()

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

InnerProduct.depth()

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

InnerProduct.diag_gate(diag, qubit)

Deprecated version of QuantumCircuit.diagonal.

InnerProduct.diagonal(diag, qubit)

Attach a diagonal gate to a circuit.

InnerProduct.draw([output, scale, filename, …])

Draw the quantum circuit.

InnerProduct.extend(rhs)

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

InnerProduct.fredkin(control_qubit, …[, …])

Apply CSwapGate.

InnerProduct.from_qasm_file(path)

Take in a QASM file and generate a QuantumCircuit object.

InnerProduct.from_qasm_str(qasm_str)

Take in a QASM string and generate a QuantumCircuit object.

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

Apply HGate.

InnerProduct.hamiltonian(operator, time, qubits)

Apply hamiltonian evolution to to qubits.

InnerProduct.has_register(register)

Test if this circuit has the register r.

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

Apply IGate.

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

Apply IGate.

InnerProduct.iden(qubit, *[, q])

Deprecated identity gate.

InnerProduct.initialize(params, qubits)

Apply initialize to circuit.

InnerProduct.inverse()

Invert (take adjoint of) this circuit.

InnerProduct.iso(isometry, q_input, …[, …])

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

InnerProduct.isometry(isometry, q_input, …)

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

InnerProduct.iswap(qubit1, qubit2)

Apply iSwapGate.

InnerProduct.mcmt(gate, control_qubits, …)

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

InnerProduct.mcrx(theta, q_controls, q_target)

Apply Multiple-Controlled X rotation gate

InnerProduct.mcry(theta, q_controls, …[, …])

Apply Multiple-Controlled Y rotation gate

InnerProduct.mcrz(lam, q_controls, q_target)

Apply Multiple-Controlled Z rotation gate

InnerProduct.mct(control_qubits, target_qubit)

Apply MCXGate.

InnerProduct.mcu1(lam, control_qubits, …)

Apply MCU1Gate.

InnerProduct.mcx(control_qubits, target_qubit)

Apply MCXGate.

InnerProduct.measure(qubit, cbit)

Measure quantum bit into classical bit (tuples).

InnerProduct.measure_active([inplace])

Adds measurement to all non-idle qubits.

InnerProduct.measure_all([inplace])

Adds measurement to all qubits.

InnerProduct.mirror()

DEPRECATED: use circuit.reverse_ops().

InnerProduct.ms(theta, qubits)

Apply MSGate.

InnerProduct.num_connected_components([…])

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

InnerProduct.num_nonlocal_gates()

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

InnerProduct.num_tensor_factors()

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

InnerProduct.num_unitary_factors()

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

InnerProduct.p(theta, qubit)

Apply PhaseGate.

InnerProduct.power(power[, matrix_power])

Raise this circuit to the power of power.

InnerProduct.qasm([formatted, filename])

Return OpenQASM string.

InnerProduct.qbit_argument_conversion(…)

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

InnerProduct.r(theta, phi, qubit, *[, q])

Apply RGate.

InnerProduct.rcccx(control_qubit1, …)

Apply RC3XGate.

InnerProduct.rccx(control_qubit1, …)

Apply RCCXGate.

InnerProduct.remove_final_measurements([inplace])

Removes final measurement on all qubits if they are present.

InnerProduct.repeat(reps)

Repeat this circuit reps times.

InnerProduct.reset(qubit)

Reset q.

InnerProduct.reverse_bits()

Return a circuit with the opposite order of wires.

InnerProduct.reverse_ops()

Reverse the circuit by reversing the order of instructions.

InnerProduct.rx(theta, qubit, *[, label, q])

Apply RXGate.

InnerProduct.rxx(theta, qubit1, qubit2)

Apply RXXGate.

InnerProduct.ry(theta, qubit, *[, label, q])

Apply RYGate.

InnerProduct.ryy(theta, qubit1, qubit2)

Apply RYYGate.

InnerProduct.rz(phi, qubit, *[, q])

Apply RZGate.

InnerProduct.rzx(theta, qubit1, qubit2)

Apply RZXGate.

InnerProduct.rzz(theta, qubit1, qubit2)

Apply RZZGate.

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

Apply SGate.

InnerProduct.sdg(qubit, *[, q])

Apply SdgGate.

InnerProduct.size()

Returns total number of gate operations in circuit.

InnerProduct.snapshot(label[, …])

Take a statevector snapshot of the internal simulator representation.

InnerProduct.snapshot_density_matrix(label)

Take a density matrix snapshot of simulator state.

InnerProduct.snapshot_expectation_value(…)

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

InnerProduct.snapshot_probabilities(label, …)

Take a probability snapshot of the simulator state.

InnerProduct.snapshot_stabilizer(label)

Take a stabilizer snapshot of the simulator state.

InnerProduct.snapshot_statevector(label)

Take a statevector snapshot of the simulator state.

InnerProduct.squ(unitary_matrix, qubit[, …])

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

InnerProduct.swap(qubit1, qubit2)

Apply SwapGate.

InnerProduct.sx(qubit)

Apply SXGate.

InnerProduct.sxdg(qubit)

Apply SXdgGate.

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

Apply TGate.

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

Apply TdgGate.

InnerProduct.to_gate([parameter_map, label])

Create a Gate out of this circuit.

InnerProduct.to_instruction([parameter_map])

Create an Instruction out of this circuit.

InnerProduct.toffoli(control_qubit1, …[, …])

Apply CCXGate.

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

Apply UGate.

InnerProduct.u1(theta, qubit, *[, q])

Apply U1Gate.

InnerProduct.u2(phi, lam, qubit, *[, q])

Apply U2Gate.

InnerProduct.u3(theta, phi, lam, qubit, *[, q])

Apply U3Gate.

InnerProduct.uc(gate_list, q_controls, q_target)

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

InnerProduct.ucg(angle_list, q_controls, …)

Deprecated version of uc.

InnerProduct.ucrx(angle_list, q_controls, …)

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

InnerProduct.ucry(angle_list, q_controls, …)

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

InnerProduct.ucrz(angle_list, q_controls, …)

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

InnerProduct.ucx(angle_list, q_controls, …)

Deprecated version of ucrx.

InnerProduct.ucy(angle_list, q_controls, …)

Deprecated version of ucry.

InnerProduct.ucz(angle_list, q_controls, …)

Deprecated version of ucrz.

InnerProduct.unitary(obj, qubits[, label])

Apply unitary gate to q.

InnerProduct.width()

Return number of qubits plus clbits in circuit.

InnerProduct.x(qubit, *[, label, ctrl_state, q])

Apply XGate.

InnerProduct.y(qubit, *[, q])

Apply YGate.

InnerProduct.z(qubit, *[, q])

Apply ZGate.

InnerProduct.__getitem__(item)

Return indexed operation.

InnerProduct.__len__()

Return number of operations in circuit.