跳转至

UniformlyControlGate

QuICT.core.gate.UniformlyControlGate

UniformlyControlGate(target_gate: GateType = GateType.unitary)

Bases: object

Uniformly Ry, Rz or one-qubit Unitary gate

Detailed description of each synthesis algorithm could be found in the backend.

Parameters:

  • target_gate (GateType, default: unitary ) –

    type of target gate, could be Ry, Rz or Unitary

Source code in QuICT/core/gate/uniformly_control_gate.py
def __init__(self, target_gate: GateType = GateType.unitary):
    """
    Args:
        target_gate (GateType): type of target gate, could be Ry, Rz or Unitary
    """
    assert target_gate in [GateType.ry, GateType.rz, GateType.unitary], \
        TypeError("UniformlyControlGate.target_gate", [GateType.ry, GateType.rz, GateType.unitary], target_gate)
    self.target_gate = target_gate

__call__

__call__(arg_list) -> CompositeGate

Parameters:

  • arg_list (list) –

    a list of angles for Ry and Rz or a list of 2*2 unitaries for Unitary

Returns:

  • CompositeGate ( CompositeGate ) –

    uniformly control target gate

Source code in QuICT/core/gate/uniformly_control_gate.py
def __call__(self, arg_list) -> CompositeGate:
    """
    Args:
        arg_list (list): a list of angles for Ry and Rz or a list of 2*2 unitaries for Unitary

    Returns:
        CompositeGate: uniformly control target gate
    """
    if self.target_gate in [GateType.ry, GateType.rz]:
        return UniformlyRotation(self.target_gate).execute(arg_list)
    else:
        return UniformlyUnitary().execute(arg_list)