[][src]Module qip::measurement_ops

Functions for measuring states.

Structs

MeasuredCondition

A set of measured results we want to receive (used to avoid the randomness of measurement if a given result is desired).

Functions

measure

Selects a measured state from input, then calls measure_state to manipulate the output. Returns the measured state and probability.

measure_prob

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)

measure_prob_fn

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

measure_probs

Get probability for each possible measurement of indices on input.

measure_state

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.

prob_magnitude

Get total magnitude of state.

soft_measure

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.