mindquantum.algorithm.compiler.try_merge

Contents

mindquantum.algorithm.compiler.try_merge#

mindquantum.algorithm.compiler.try_merge(father_node: GateNode, child_node: GateNode) Tuple[bool, List[GateNode], GlobalPhase]#

Try to merge two gate nodes.

Following this method, we merge two hermitian conjugated into identity, and also merge two same kind parameterized gate into single parameterized gate.

Parameters:
  • father_node (GateNode) – the father node want to merge.

  • child_node (GateNode) – the child node want to merge.

Returns:

  • bool, whether successfully merged.

  • List[GateNode], the father node after merged.

  • GlobalPhase, the global phase gate after merge two given gate node.