mimiqcircuits.operations.gates.standard.cnp

Controlled-Controlled-Phase (CCP) gate.

Classes

GateCCP([num_controls, operation])

Three qubit Controlled-Controlled-Phase gate.

class mimiqcircuits.operations.gates.standard.cnp.GateCCP(num_controls=None, operation=None, *args, **kwargs)[source]

Bases: Control

Three qubit Controlled-Controlled-Phase gate.

By convention, the first two qubits are the controls and the third is the target

Parameters:

lmbda – Phase angle.

Examples

>>> from mimiqcircuits import *
>>> from symengine import *
>>> lmbda = Symbol('lmbda')
>>> GateCCP(lmbda), GateCCP(lmbda).num_controls, GateCCP(lmbda).num_targets, GateCCP(lmbda).num_qubits
(C₂P(lmbda), 2, 1, 3)
>>> GateCCP(lmbda).matrix()
[1.0, 0, 0, 0, 0, 0, 0, 0]
[0, 1.0, 0, 0, 0, 0, 0, 0]
[0, 0, 1.0, 0, 0, 0, 0, 0]
[0, 0, 0, 1.0, 0, 0, 0, 0]
[0, 0, 0, 0, 1.0, 0, 0, 0]
[0, 0, 0, 0, 0, 1.0, 0, 0]
[0, 0, 0, 0, 0, 0, 1.0, 0]
[0, 0, 0, 0, 0, 0, 0, exp(I*lmbda)]

>>> c = Circuit().push(GateCCP(lmbda), 0, 1, 2)
>>> c
3-qubit circuit with 1 instruction:
└── C₂P(lmbda) @ q[0:1], q[2]

>>> GateCCP(lmbda).power(2), GateCCP(lmbda).inverse()
(C₂P(2*lmbda), C₂P(-lmbda))
>>> GateCCP(lmbda).decompose()
3-qubit circuit with 5 instructions:
├── CP((1/2)*lmbda) @ q[1], q[2]
├── CX @ q[0], q[1]
├── CP((-1/2)*lmbda) @ q[1], q[2]
├── CX @ q[0], q[1]
└── CP((1/2)*lmbda) @ q[0], q[2]
__init__(lmbda_or_num_controls, num_controls_or_operation=None, operation=None)[source]

Initialize a CCP gate.

Parameters:
  • lmbda_or_num_controls – Phase angle in radians when called directly, or num_controls when called from Control’s canonical creation.

  • num_controls_or_operation – Ignored when called directly, or the GateP operation when called from Control’s canonical creation.

  • operation – Ignored (for compatibility).