qat.pylinalg.simulator.measure
- qat.pylinalg.simulator.measure(state_vec, qubits, nb_samples=1)
Samples measurement results on the specified qubits.
No projection is carried out ! See “project” function. Thanks to the absence of projection, several samples can be asked.
- Parameters
state_vec (numpy.ndarray) – the
numpy.ndarray
containing full state vector.qubits (list) – list of integers specifying the subset of qubits to measure.
nb_samples (int, optional) – the number of samples to return. Set to 1 by default.
- Returns
intprob_list, a list (of length nb_samples) containing tuples of the form (integer, probability). The integer is the result of the measurement on the subset of qubits (when converted to binary representation, it needs to have a width of len(qubits)). The probability is the probability the measurement had to occur. It is useful for renormalizing afterwards. In short: it is a list of samples. One sample is a (int, prob) tuple.
- Return type
list