mindquantum.algorithm.mapping.MQSABRE

View Source On Gitee
class mindquantum.algorithm.mapping.MQSABRE(circuit: Circuit, topology: QubitsTopology, cnoterrorandlength: List[Tuple[Tuple[int, int], List[float]]])[source]

MQSABRE algorithm to implement qubit mapping.

This mapping alrogrthm considered the cnot error and executing time in quantum chip.

Parameters
  • circuit (Circuit) – The quantum circuit you need to do qubit mapping. Currently we only support circuit constructed by one or two qubits gate, control qubit included.

  • topology (QubitsTopology) – The hardware qubit topology. Currently we only support connected coupling graph.

  • cnoterrorandlength (List[Tuple[Tuple[int, int], List[float]]]) – The error and gate length of a cnot gate. The first two integers are qubit node id in topology. The list of float has two element, with first one be the error of cnot and second one be the gate length.

Examples

>>> from mindquantum.algorithm.mapping import MQSABRE
>>> cnot=[((5, 6), [8.136e-4, 248.88]), ((6, 10), [9.136e-4, 248.88]), ((8, 9), [9.136e-4, 248.88])]
>>> topology = GridQubits(6,6)
>>> mqsaber = MQSABRE(circuit, topology, cnot)
>>> new_circ, init_mapping, final_mapping = masaber.solve(1, 0.3, 0.2, 0.1)
solve(w: float, alpha1: float, alpha2: float, alpha3: float)[source]

Solve qubit mapping problem with MQSABRE algorithm.

Parameters
  • w (float) – The w parameter. For more detail, please refers to the paper.

  • alpha1 (float) – The alpha1 parameter. For more detail, please refers to the paper.

  • alpha2 (float) – The alpha2 parameter. For more detail, please refers to the paper.

  • alpha3 (float) – The alpha3 parameter. For more detail, please refers to the paper.

Returns

Tuple[Circuit, List[int], List[int]], a quantum

circuit that can execute on given device, the initial mapping order, and the final mapping order.