跳转至

UniformlyRyRevision

QuICT.qcda.synthesis.unitary_decomposition.uniformly_ry_revision.UniformlyRyRevision

UniformlyRyRevision(is_cz_left: bool = False)

Bases: object

This part is mainly copied from uniformly_rotation.py Here we demand a CZ gate at the edge of the decomposition, therefore the recursion process is slightly revised.

If qubit_num > 2, synthesized gates would have 2 cz gates at rightmost place. If qubit_num == 2, there would be only 1 cz gate.

References

Decompositions of general quantum gates http://arxiv.org/abs/quant-ph/0504100v1 Fig4 a)

Source code in QuICT/qcda/synthesis/unitary_decomposition/uniformly_ry_revision.py
def __init__(self, is_cz_left: bool = False):
    self.is_cz_left = is_cz_left

execute

execute(angle_list: List[float]) -> CompositeGate

uniformlyRyGate

Parameters:

  • angle_list (List[float]) –

    the angles of Ry Gates

Returns:

Source code in QuICT/qcda/synthesis/unitary_decomposition/uniformly_ry_revision.py
def execute(self, angle_list: List[float]) -> CompositeGate:
    """ uniformlyRyGate

    Args:
        angle_list (List[float]): the angles of Ry Gates

    Returns:
        CompositeGate: the synthesis gate list
    """
    angle_list = list(angle_list)
    n = int(np.round(np.log2(len(angle_list)))) + 1
    if 1 << (n - 1) != len(angle_list):
        raise Exception("the number of parameters unmatched.")
    return self.uniformly_rotation_cz(0, n, angle_list, self.is_cz_left)

uniformly_rotation_cz

uniformly_rotation_cz(low: int, high: int, angles: List[float], is_cz_left: bool = False) -> CompositeGate

synthesis uniformlyRy gate, bits range [low, high)

Parameters:

  • low (int) –

    the left range low

  • high (int) –

    the right range high

  • angles (List[float]) –

    the list of angle y

  • is_cz_left (bool, default: False ) –

    is cx/cz left decomposition

Returns:

Source code in QuICT/qcda/synthesis/unitary_decomposition/uniformly_ry_revision.py
def uniformly_rotation_cz(
    self,
    low: int,
    high: int,
    angles: List[float],
    is_cz_left: bool = False
) -> CompositeGate:
    """
    synthesis uniformlyRy gate, bits range [low, high)

    Args:
        low (int): the left range low
        high (int): the right range high
        angles (List[float]): the list of angle y
        is_cz_left (bool): is cx/cz left decomposition

    Returns:
        CompositeGate: the synthesis gate list
    """
    return self.inner_uniformly_rotation_cz(low, high, angles, True, is_cz_left)