qat.core.Sample
- class qat.core.Sample(qregs=None, amplitude=None, state=None, **kwargs)
Simple higher-level wrapper for the serializable Sample class.
- Parameters
qregs (
QRegister
) – quantum register
- Instance attributes:
state (
State
): the measured stateprobability (float, optional): the probability of the state (infinite number of shots/samples, for simulators only), or frequency of the state (finite number of shots)
amplitude (complex, optional): optionally (for simulators), the amplitude of the state
intermediate_measurements (
IntermediateMeasurement
): list of intermediate measurementserr (float, optional): optionally, the sampling error: if the number of samples is finite, it is the estimate of the standard error on the mean \(\varepsilon_{k}\equiv\sqrt{\langle\left(p_{k}-f_{k}\right)^{2}\rangle}\), where \(p_k\) is the true probability of obtaining state \(|k\rangle\) and \(f_k\) its estimate. if the number samples is infinite (simulator only), it is the error bar on the computed probability (for approximate simulators only, like stochastic simulators)
- property amplitude
Returns the amplitude of the Sample (wrapped in a Python complex number)
- classmethod from_bytes(data: bytes)
Builds a sample from raw bytes object
- classmethod from_thrift(tobject)
Builds a Sample object from a thrift object
- set_qreg(qregs)
Sets the quantum register information for pretty display and cast of states
- property state
Gets the state of the sample. The state may be wrapped in a State object