guppyalgos.primitives.gate_decompositions.cnx.ccu

CCU gates.

Functions

ccry_cx(control1, control2, target, theta)

CCRy gate implementation using cx gates.

ccry_toffoli(control1, control2, target, theta)

CCRy gate implementation using toffolis.

ccx(control1, control2, target)

CCX gate implementation.

ccy(control1, control2, target)

CCY gate implementation.

ccz(control1, control2, target)

CCZ gate implementation.

guppyalgos.primitives.gate_decompositions.cnx.ccu.ccry_cx(control1, control2, target, theta)

CCRy gate implementation using cx gates.

Requires 4 cx and 4 ry.

           ┌────────────────────────────────┐x2
control1: ─┼───────────────────────────■────┼───
           │                           │    │
           │                           │    │
control2: ─┼────────────■──────────────┼────┼───
           │            │              │    │
           │ ┌───────┐┌─┴─┐┌────────┐┌─┴─┐  │
target:   ─┼─┤ry(t/4)├┤ X ├┤ry(-t/4)├┤ X ├──┼───
           │ └───────┘└───┘└────────┘└───┘  │
           └────────────────────────────────┘
Parameters:
  • target – The target qubit.

  • control1 – The first control qubit.

  • control2 – The second control qubit.

  • theta – The rotation angle.

guppyalgos.primitives.gate_decompositions.cnx.ccu.ccry_toffoli(control1, control2, target, theta)

CCRy gate implementation using toffolis.

Requires 2 toffolis and 2 ry.

control1: ─────────────■───────────────■───
                       │               │
                       │               │
control2: ─────────────■───────────────■───
                       │               │
          ┌─────────┐┌─┴─┐┌─────────┐┌───┐
target:   ┤ ry(t/2) ├┤ X ├┤ ry(-t/2)├┤ X ├─
          └─────────┘└───┘└─────────┘└───┘
Parameters:
  • target – The target qubit.

  • control1 – The first control qubit.

  • control2 – The second control qubit.

  • theta – The rotation angle.

guppyalgos.primitives.gate_decompositions.cnx.ccu.ccx(control1, control2, target)

CCX gate implementation.

                                                            ┌───┐
control1: ───────────────────■─────────────────────■────■───┤ T ├───■──
                             │                     │    │   └───┘   │
                             │             ┌───┐   │  ┌─┴─┐┌─────┐┌─┴─┐
control2: ───────■───────────┼─────────■───┤ T ├───┼──┤ X ├┤ Tdg ├┤ X ├─
                 │           │         │   └───┘   │  └───┘└─────┘└───┘
          ┌───┐┌─┴─┐┌─────┐┌─┴─┐┌───┐┌─┴─┐┌─────┐┌─┴─┐┌───┐┌───┐
target:   ┤ H ├┤ X ├┤ Tdg ├┤ X ├┤ T ├┤ X ├┤ Tdg ├┤ X ├┤ T ├┤ H ├────────
          └───┘└───┘└─────┘└───┘└───┘└───┘└─────┘└───┘└───┘└───┘
Parameters:
  • target – The target qubit.

  • control1 – The first control qubit.

  • control2 – The second control qubit.

guppyalgos.primitives.gate_decompositions.cnx.ccu.ccy(control1, control2, target)

CCY gate implementation.

                                                                 ┌───┐
control1:  ——──────────────────────■─────—──────────────■────■───┤ T ├───■──
                                  │                     │    │   └───┘   │
                                  │             ┌───┐   │  ┌─┴─┐┌─────┐┌─┴─┐
control2:  ───────────■───────────┼─────────■───┤ T ├───┼──┤ X ├┤ Tdg ├┤ X ├─
                      │           │         │   └───┘   │  └───┘└─────┘└───┘
          ┌───┐┌───┐┌─┴─┐┌─────┐┌─┴─┐┌───┐┌─┴─┐┌─────┐┌─┴─┐┌───┐┌───┐┌─────┐
target:   ┤ S ├┤ H ├┤ X ├┤ Tdg ├┤ X ├┤ T ├┤ X ├┤ Tdg ├┤ X ├┤ T ├┤ H ├┤ Sdg ├
          └───┘└───┘└───┘└─────┘└───┘└───┘└───┘└─────┘└───┘└───┘└───┘└─────┘
Parameters:
  • target – The target qubit.

  • control1 – The first control qubit.

  • control2 – The second control qubit.

guppyalgos.primitives.gate_decompositions.cnx.ccu.ccz(control1, control2, target)

CCZ gate implementation.

                                                       ┌───┐
control1: ──────────────■─────────────────────■────■───┤ T ├───■──
                        │                     │    │   └───┘   │
                        │             ┌───┐   │  ┌─┴─┐┌─────┐┌─┴─┐
control2: ──■───────────┼─────────■───┤ T ├───┼──┤ X ├┤ Tdg ├┤ X ├─
            │           │         │   └───┘   │  └───┘└─────┘└───┘
          ┌─┴─┐┌─────┐┌─┴─┐┌───┐┌─┴─┐┌─────┐┌─┴─┐┌───┐
target:   ┤ X ├┤ Tdg ├┤ X ├┤ T ├┤ X ├┤ Tdg ├┤ X ├┤ T ├────────────
          └───┘└─────┘└───┘└───┘└───┘└─────┘└───┘└───┘
Parameters:
  • target – The target qubit.

  • control1 – The first control qubit.

  • control2 – The second control qubit.