| cnqgate {qsimulatR} | R Documentation |
n-fold controlled single qubit gate
Description
This class represents a generic n-fold controlled gate
Details
The qubits are counted from 1 to nbits starting with the least
significant bit.
Slots
cbitsInteger. Integer vector of control bits.
tbitInteger. Target bit.
gatesqgate. The single qubit gate.
inverseLogical. Boolean vector of same length as
cbits. IfTRUE, the corresponding control bit is negated.
Examples
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
[Package qsimulatR version 1.1.1 Index]