MCMT

class MCMT(gate, num_ctrl_qubits, num_target_qubits)[source]

The multi-controlled multi-target gate, for an arbitrary singly controlled target gate.

This default implementations requires no ancilla qubits, by broadcasting the target gate to the number of target qubits and using Qiskit’s generic control routine to control the broadcasted target on the control qubits. If ancilla qubits are available, a more efficient variant using the so-called V-chain decomposition can be used. This is implemented in MCMTVChain.

Create a new multi-control multi-target gate.

Parameters
  • gate (Union[Gate, Callable[[QuantumCircuit, Qubit, Qubit], Instruction]]) – The gate to be applied controlled on the control qubits and applied to the target qubits. Can be either a Gate or a circuit method. If it is a callable, it will be casted to a Gate.

  • num_ctrl_qubits (int) – The number of control qubits.

  • num_target_qubits (int) – The number of target qubits.

Raises
  • AttributeError – If the gate cannot be casted to a controlled gate.

  • AttributeError – If the number of controls or targets is 0.

Attributes

MCMT.clbits

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

MCMT.data

Return the circuit data (instructions and context).

MCMT.extension_lib

MCMT.header

MCMT.instances

MCMT.n_qubits

Deprecated, use num_qubits instead.

MCMT.num_ancilla_qubits

Return the number of ancillas.

MCMT.num_clbits

Return number of classical bits.

MCMT.num_parameters

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

MCMT.num_qubits

Return number of qubits.

MCMT.parameters

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

MCMT.prefix

MCMT.qubits

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

Methods

MCMT.AND(qr_variables, qb_target, qr_ancillae)

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

MCMT.OR(qr_variables, qb_target, qr_ancillae)

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

MCMT.__getitem__(item)

Return indexed operation.

MCMT.__len__()

Return number of operations in circuit.

MCMT.add_register(*regs)

Add registers.

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

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

MCMT.assign_parameters(param_dict[, inplace])

Assign parameters to new parameters or values.

MCMT.barrier(*qargs)

Apply Barrier.

MCMT.bind_parameters(value_dict)

Assign numeric parameters to values yielding a new circuit.

MCMT.cast(value, _type)

Best effort to cast value to type.

MCMT.cbit_argument_conversion(…)

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

MCMT.ccx(control_qubit1, control_qubit2, …)

Apply CCXGate.

MCMT.ch(control_qubit, target_qubit, *[, …])

Apply CHGate.

MCMT.cls_instances()

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

MCMT.cls_prefix()

Return the prefix to use for auto naming.

MCMT.cnot(control_qubit, target_qubit, *[, …])

Apply CXGate.

MCMT.combine(rhs)

Append rhs to self if self contains compatible registers.

MCMT.compose(other[, qubits, clbits, front, …])

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

MCMT.control([num_ctrl_qubits])

Return the controlled version of the MCMT circuit.

MCMT.copy([name])

Copy the circuit.

MCMT.count_ops()

Count each operation kind in the circuit.

MCMT.crx(theta, control_qubit, target_qubit, *)

Apply CRXGate.

MCMT.cry(theta, control_qubit, target_qubit, *)

Apply CRYGate.

MCMT.crz(theta, control_qubit, target_qubit, *)

Apply CRZGate.

MCMT.cswap(control_qubit, target_qubit1, …)

Apply CSwapGate.

MCMT.cu1(theta, control_qubit, target_qubit, *)

Apply CU1Gate.

MCMT.cu3(theta, phi, lam, control_qubit, …)

Apply CU3Gate.

MCMT.cx(control_qubit, target_qubit, *[, …])

Apply CXGate.

MCMT.cy(control_qubit, target_qubit, *[, …])

Apply CYGate.

MCMT.cz(control_qubit, target_qubit, *[, …])

Apply CZGate.

MCMT.dcx(qubit1, qubit2)

Apply DCXGate.

MCMT.decompose()

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

MCMT.depth()

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

MCMT.diag_gate(diag, qubit)

Deprecated version of QuantumCircuit.diagonal.

MCMT.diagonal(diag, qubit)

Attach a diagonal gate to a circuit.

MCMT.draw([output, scale, filename, style, …])

Draw the quantum circuit.

MCMT.extend(rhs)

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

MCMT.fredkin(control_qubit, target_qubit1, …)

Apply CSwapGate.

MCMT.from_qasm_file(path)

Take in a QASM file and generate a QuantumCircuit object.

MCMT.from_qasm_str(qasm_str)

Take in a QASM string and generate a QuantumCircuit object.

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

Apply HGate.

MCMT.hamiltonian(operator, time, qubits[, label])

Apply hamiltonian evolution to to qubits.

MCMT.has_register(register)

Test if this circuit has the register r.

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

Apply IGate.

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

Apply IGate.

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

Deprecated identity gate.

MCMT.initialize(params, qubits)

Apply initialize to circuit.

MCMT.inverse()

Return the inverse MCMT circuit, which is itself.

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

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

MCMT.isometry(isometry, q_input, …[, …])

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

MCMT.iswap(qubit1, qubit2)

Apply iSwapGate.

MCMT.mcmt(gate, control_qubits, target_qubits)

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

MCMT.mcrx(theta, q_controls, q_target[, …])

Apply Multiple-Controlled X rotation gate

MCMT.mcry(theta, q_controls, q_target, …)

Apply Multiple-Controlled Y rotation gate

MCMT.mcrz(lam, q_controls, q_target[, …])

Apply Multiple-Controlled Z rotation gate

MCMT.mct(control_qubits, target_qubit[, …])

Apply MCXGate.

MCMT.mcu1(lam, control_qubits, target_qubit)

Apply MCU1Gate.

MCMT.mcx(control_qubits, target_qubit[, …])

Apply MCXGate.

MCMT.measure(qubit, cbit)

Measure quantum bit into classical bit (tuples).

MCMT.measure_active([inplace])

Adds measurement to all non-idle qubits.

MCMT.measure_all([inplace])

Adds measurement to all qubits.

MCMT.mirror()

Mirror the circuit by reversing the instructions.

MCMT.ms(theta, qubits)

Apply MSGate.

MCMT.num_connected_components([unitary_only])

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

MCMT.num_nonlocal_gates()

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

MCMT.num_tensor_factors()

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

MCMT.num_unitary_factors()

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

MCMT.qasm([formatted, filename])

Return OpenQASM string.

MCMT.qbit_argument_conversion(…)

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

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

Apply RGate.

MCMT.rcccx(control_qubit1, control_qubit2, …)

Apply RC3XGate.

MCMT.rccx(control_qubit1, control_qubit2, …)

Apply RCCXGate.

MCMT.remove_final_measurements([inplace])

Removes final measurement on all qubits if they are present.

MCMT.reset(qubit)

Reset q.

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

Apply RXGate.

MCMT.rxx(theta, qubit1, qubit2)

Apply RXXGate.

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

Apply RYGate.

MCMT.ryy(theta, qubit1, qubit2)

Apply RYYGate.

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

Apply RZGate.

MCMT.rzx(theta, qubit1, qubit2)

Apply RZXGate.

MCMT.rzz(theta, qubit1, qubit2)

Apply RZZGate.

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

Apply SGate.

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

Apply SdgGate.

MCMT.size()

Returns total number of gate operations in circuit.

MCMT.snapshot(label[, snapshot_type, …])

Take a statevector snapshot of the internal simulator representation.

MCMT.snapshot_density_matrix(label[, qubits])

Take a density matrix snapshot of simulator state.

MCMT.snapshot_expectation_value(label, op, …)

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

MCMT.snapshot_probabilities(label, qubits[, …])

Take a probability snapshot of the simulator state.

MCMT.snapshot_stabilizer(label)

Take a stabilizer snapshot of the simulator state.

MCMT.snapshot_statevector(label)

Take a statevector snapshot of the simulator state.

MCMT.squ(unitary_matrix, qubit[, mode, …])

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

MCMT.swap(qubit1, qubit2)

Apply SwapGate.

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

Apply TGate.

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

Apply TdgGate.

MCMT.to_gate([parameter_map])

Create a Gate out of this circuit.

MCMT.to_instruction([parameter_map])

Create an Instruction out of this circuit.

MCMT.toffoli(control_qubit1, control_qubit2, …)

Apply CCXGate.

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

Apply U1Gate.

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

Apply U2Gate.

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

Apply U3Gate.

MCMT.uc(gate_list, q_controls, q_target[, …])

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

MCMT.ucg(angle_list, q_controls, q_target[, …])

Deprecated version of uc.

MCMT.ucrx(angle_list, q_controls, q_target)

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

MCMT.ucry(angle_list, q_controls, q_target)

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

MCMT.ucrz(angle_list, q_controls, q_target)

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

MCMT.ucx(angle_list, q_controls, q_target)

Deprecated version of ucrx.

MCMT.ucy(angle_list, q_controls, q_target)

Deprecated version of ucry.

MCMT.ucz(angle_list, q_controls, q_target)

Deprecated version of ucrz.

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

Apply unitary gate to q.

MCMT.width()

Return number of qubits plus clbits in circuit.

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

Apply XGate.

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

Apply YGate.

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

Apply ZGate.

MCMT.__getitem__(item)

Return indexed operation.

MCMT.__len__()

Return number of operations in circuit.