gates.CNOT

class zyglrox.core.gates.CNOT(wires: List[int], value: List[float] = None, conjugate=False, name=None, **kwargs)

Gate that implements the CNOT unitary operation. Order of wires is c, t

\[\begin{split}\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{pmatrix}\end{split}\]

The Gate class performs unitary quantum gates on the tensor subspace of a wave function

Args:
nparams (int):

Number of parameters of gate.

wires (list):

List of numbers on which the gate is acting.

value (None of ndarray):

Intial value of parameterized gate in 1D numpy array. When combined with setting trainable=False, this will create a static gate that cannot be altered during any optimization.

name (str):

Name of the gate.

Keyword Arguments
trainable (bool):

Boolean that indicates whether the paramaters of this gate are trainable.

Returns (inplace):

None

build(input_shape)

Called once from __call__, when we know the shapes of inputs and dtype. Should initialize the trainable variables, and call the super’s build().

Args:
input_shape (list):

Input shapes of the incoming tensor.

call(inputs: tensorflow.python.framework.ops.Tensor, **kwargs) → tensorflow.python.framework.ops.Tensor

Gate Logic