qstate {qsimulatR} | R Documentation |
The qstate class
Description
This class represents a quantum state
Details
The qubits are counted from 1 to nbits
starting with the least
significant bit.
Slots
nbits
The number of qubits
coefs
The 2^nbits complex valued vector of coefficients
basis
String or vector of strings. A single string will be interpreted as the
collapse
-parameter ingenComputationalBasis
. A vector of length 2^nbits yields the basis directly.noise
List containing the probability
p
some noise is applied to one of thebits
after a gate application, the modelerror
of this noise and further argumentsargs
to be passed to the functionnoise
. See functionnoise
for details. The listnoise
can be generated withgenNoise
.circuit
List containing the number of non-quantum bits
ncbits
and a list of gatesgatelist
applied to the original state. Filled automatically as gates are applied, required for plotting.
Examples
x <- qstate(nbits=2)
x
x <- qstate(nbits=2, coefs=as.complex(sqrt(rep(0.25, 4))), basis=",")
x
x <- qstate(nbits=1, coefs=as.complex(sqrt(rep(0.5, 2))), basis=c("|dead>", "|alive>"))
x
x <- qstate(nbits=2, noise=genNoise(nbits=2, p=1))
Id(2) * x
x <- qstate(nbits=3, noise=genNoise(p=1, bits=1:2, error="small", sigma=0.1))
Id(2) * x