1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use EnumAsInner;
use Complex32;
use ;
use gen_stub_pyclass_complex_enum;
/// Data resulting from [`Executable::execute_on_qvm`](`crate::Executable::execute_on_qvm`)
///
/// This represents a single vector (or "register") of typed memory across some number of shots.
/// The register corresponds to the usage of a `DECLARE` instruction in Quil, and the name of that
/// register should be provided with [`Executable::read_from`](`crate::Executable::read_from`).
///
/// There is a variant of this enum for each type of data that a register could hold. The register
/// is represented as a 2-dimensional array `M` where the value `M[shot_number][memory_index]`
/// represents the value at `memory_index` for `shot_number`.
///
/// # Usage
///
/// Typically, you will be interacting with this data through the [`crate::ResultData`] of an
/// [`crate::ExecutionData`] returned after running a program. In those cases, you'll probably
/// want to convert it to a readout map using [`crate::ResultData.to_register_map()`]. This
/// will give you each register in the form of a [`crate::RegisterMatrix`] which is similar
/// but backed by an [`ndarray::Array2`] and more convenient for working with matrices.
///
/// If you are interacting with [`RegisterData`] directly, then you should already know what type of data it _should_
/// have, so you can use the [`mod@enum_as_inner`] methods (e.g. [`RegisterData::into_i8`]) in order to
/// convert any variant type to its inner data.