cqgate: A controlled single qubit gate

View source: R/cqgate.R

cqgateR Documentation

A controlled single qubit gate

Description

This class represents a generic controlled gate

Details

The qubits are counted from 1 to nbits starting with the least significant bit.

Slots

bits

Integer. Integer vector of bits. The first is the control bit, the second the target bit.

gate

sqgate. The single qubit gate.

Examples

x <- H(1) * qstate(nbits=2)
## application of the CX (CNOT) gate to bit 1,2
z <- cqgate(bits=c(1L, 2L), gate=X(2L)) * x
z
## the same as, but differently implemented
z <- CNOT(c(1,2)) * x
z


qsimulatR documentation built on Oct. 16, 2023, 5:06 p.m.