Singular measurements

Singular measurements, i.e. a single measurement for a single qubit, are represented through meas handles.

Constructing measurement objects

Measurement objects are constructed using dqcs_meas_new().

dqcs_meas_new()

Constructs a new measurement object.

dqcs_handle_t dqcs_meas_new(
    dqcs_qubit_t qubit,
    dqcs_measurement_t value
)

qubit must be set to the qubit that was measured, value must be set to its value. The return value is the handle to the measurement object, or 0 if something went wrong.

Note that measurement objects implement the arb interface, so additional data can be attached to the object.

They are also mutable after construction.

dqcs_meas_qubit_set()

Sets the qubit reference associated with a measurement object.

dqcs_return_t dqcs_meas_qubit_set(
    dqcs_handle_t meas,
    dqcs_qubit_t qubit
)
dqcs_meas_value_set()

Sets the measurement value associated with a measurement object.

dqcs_return_t dqcs_meas_value_set(
    dqcs_handle_t meas,
    dqcs_measurement_t value
)

Attaching custom data

Measurement objects support the ArbData protocol for attaching custom data. That is, all dqcs_arb_*() API calls can be applied to measurement handles.

Querying measurement objects

The measurement value and qubit reference can be queried from a measurement object as follows.

dqcs_meas_qubit_get()

Returns the qubit reference associated with a measurement object.

dqcs_qubit_t dqcs_meas_qubit_get(dqcs_handle_t meas)
dqcs_meas_value_get()

Returns the measurement value associated with a measurement object.

dqcs_measurement_t dqcs_meas_value_get(dqcs_handle_t meas)