cnqgate | R Documentation |
This class represents a generic n-fold controlled gate
The qubits are counted from 1 to nbits
starting with the least
significant bit.
cbits
Integer. Integer vector of control bits.
tbit
Integer. Target bit.
gate
sqgate. The single qubit gate.
inverse
Logical. Boolean vector of same length as cbits
. If
TRUE
, the corresponding control bit is negated.
x <- H(1) * qstate(nbits=3)
## application of the CCX (CCNOT) gate to bits 1,2 and 3
z <- cnqgate(cbits=c(1L, 2L), tbit=3L, gate=X(3L)) * x
z
## the same, but differently implemented
z <- CCNOT(c(1,2,3)) * x
z
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.