loom.cliffordsim.data_store

Copyright 2024 Entropica Labs Pte Ltd

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class loom.cliffordsim.data_store.DataStore[source]

Bases: object

An Object that records relevant information users might want recorded from a particular computation.

get_pframe_measurements(pauliframe_id)[source]

Helper function to aggregate all measurement results belonging to the same Pframe. The keys of returned dict are the uuids of meausurements in the circuit.

Returns:

A dictionary where keys are measurement ids and values are the PauliFrame flip results for the given Pframe id.

Return type:

dict

get_pframes(temporal_direction='forward')[source]

A helper function to return a tuple of all Pframes (dict)

temporal_direction can be either “forward” or “backward”.

Returns:

A tuple of dictionaries, where each dictionary corresponds to a PauliFrame that was created in the circuit, and the computed output — for frames propagated forwards.

Return type:

tuple

record_classical_register(input_classical_reg)[source]

Records the Snapshot of the Classical Register into the DataStore.

Return type:

None

record_measurement_from_pauliframes(measurement_id, results, init_pauliframes)[source]

Records measurement flips that result from the interaction of Pauli frames and measurement operations.

Measurement flips is passed as a list as there could be multiple Pframes.

Return type:

None

record_measurements(measurement_id, measurement_result, is_result_random)[source]

Records the measurement result in the DataStore. Raises a ValueError if no time step was found in the Moment.

Return type:

None

record_pauli_frame(init_pauliframe, recorded_pauliframe)[source]

Records the PauliFrame in the DataStore. Raises a ValueError if no time step was found in the Moment.

Return type:

None

set_time_step(time_step)[source]

Sets the time step of the current Moment being processed.

Return type:

None