Description Usage Arguments Value Examples
View source: R/reduceMeasure.R
Probabilistically measures the input ket and reduces the size of ket by removing the measured qubits. By default measures all qubits, but if a list of integers is supplied it will measure only those qubits. Returns a list containing the state of the ket after measurement along with integer value of the state that was measured. Additionally, returns a vector of the measured binary value if a list of qubits to measure was specified.
1 | reduceMeasure(...,l2r=FALSE)
|
... |
The input ket to measure. Optionally followed by integers specifying which qubits of the ket to measure. Qubits indexed from 0 from right to left |
l2r |
Boolean which specifices if indexing should be performed from left to right. Is FALSE by default to maintain backwards compatibility, however all other functions index from left to right. |
A list with the first item a column vector containing normalized amplitudes of the measured ket and the second item the integer value of the state which was measured. If a list of qubits to measure was specified as an argument, there is a 3rd item in the list which is a vector of the binary measured
1 2 3 4 5 | reduceMeasure(ket(1,0),l2r=TRUE)
reduceMeasure(ket(1,2,2,1),0,l2r=TRUE)
reduceMeasure(ket(1,2,3,4,5,6,7,8),0,l2r=TRUE)
reduceMeasure(ket(1,2,3,4,5,6,7,8),0,1,l2r=TRUE)
reduceMeasure(ket(1,2,3,4,5,6,7,8),0,1,2,l2r=TRUE)
|
Attaching package: ‘QuantumOps’
The following object is masked from ‘package:stats’:
dist
The following objects are masked from ‘package:base’:
I, norm, single
[[1]]
[,1]
[1,] 1+0i
[2,] 0+0i
[[2]]
[1] 0
[[1]]
[,1]
[1,] 0.8944272+0i
[2,] 0.4472136+0i
[[2]]
[1] 2
[[3]]
[1] 1
[[1]]
[,1]
[1,] 0.1825742+0i
[2,] 0.3651484+0i
[3,] 0.5477226+0i
[4,] 0.7302967+0i
[[2]]
[1] 1
[[3]]
[1] 0
[[1]]
[,1]
[1,] 0.6+0i
[2,] 0.8+0i
[[2]]
[1] 3
[[3]]
[1] 0 1
[[1]]
[,1]
[1,] 1+0i
[[2]]
[1] 7
[[3]]
[1] 1 1 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.