Module qip::measurement_ops [−][src]
Expand description
Functions for measuring states.
Structs
A set of measured results we want to receive (used to avoid the randomness of measurement if a given result is desired).
Functions
Selects a measured state from input
, then calls measure_state
to manipulate the output.
Returns the measured state and probability.
Calculate the probability of a given measurement. measured
gives the bits (as a u64) which has
been measured from the qubits at indices
in the order supplied by indices
. input
gives the
state from which to measure, representing a total of n
qubits. And input_offset
gives the
actual index of the lowest indexed entry in input
in case it’s split across multiple vectors
(as for distributed computation)
Calculate the probability of a given measurement. measured
gives the bits (as a u64) which has
been measured from the qubits at indices
in the order supplied by indices
.
input_offset
gives the actual index of the lowest indexed entry in input
in case it’s split
across multiple vectors (as for distributed computation). input_length
is the length of the
number of allowed indexible
Get probability for each possible measurement of indices
on input
.
Normalize the output state such that it matches only states which produce the measured
result and has the same magnitude.
This is done by zeroing out the states which cannot give measured
, and dividing the remaining
by the sqrt(1/p)
for p=measured_prob
. See measure_prob
for details.
Get total magnitude of state.
Sample a measurement from a state input
. b
Sample from qubits at indices
and return bits as u64 in order given by indices
. See
measure_prob
for details.