sqgate: A single qubit gate

Description Details Slots Examples

View source: R/sqgate.R

Description

This class represents a generic single qubit gate

Details

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

Slots

bit

Integer. The single bit to act on.

M

complex valued array. The 2x2 matrix representing the gate

type

a character vector representing the type of gate

Examples

1
2
3
4
x <- qstate(nbits=2)
## application of the X (NOT) gate to bit 1
z <- sqgate(bit=1L, M=array(as.complex(c(0,1,1,0)), dim=c(2,2))) * x
z

qsimulatR documentation built on Jan. 13, 2021, 3:13 p.m.