Learn R Programming

qsimulatR (version 1.1.1)

cnotgate: The CNOT gate

Description

This class represents a generic CNOT gate

Arguments

Slots

bits

Integer vector of length 2. First bit is the control bit, second the target bit.

Examples

Run this code
x <- qstate(nbits=2)
## A Bell state
z <- CNOT(c(1,2)) * (H(1) * x)

Run the code above in your browser using DataLab