-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
area/simulationkind/taskA task that's part of a larger effortA task that's part of a larger efforttriage/discussNeeds decision / discussion, bring these up during Cirq CynqueNeeds decision / discussion, bring these up during Cirq Cynque
Description
Summarize the task
SimulationTrialResult has the following line:
Cirq/cirq-core/cirq/sim/simulator.py
Line 1013 in 839ebb1
| return self._final_simulator_state.qubit_map |
However
_final_simulator_state is of type TSimulatorState, which is a template with no bound type. So this is a dynamic call, and is not reflected in the type system of SimulationTrialResult. Changes in #5260 made this apparent, and required TSimulatorState to be explicitly bound to Any.
To improve this, Initially I thought we should create an interface with qubit_map and bind TSimulatorState to that. However on second thought, I think it's best to add an explicit qubit_map parameter to the SimulationTrialResult initializer. This allows more flexibility in how users implement simulators: this way it doesn't necessarily require carrying qubit_map as part of the simulator state.
Acceptance criteria - when is the task considered done?
TSimulatorState should not be bound to Any anymore.
Related
Related issues: #5260
Metadata
Metadata
Assignees
Labels
area/simulationkind/taskA task that's part of a larger effortA task that's part of a larger efforttriage/discussNeeds decision / discussion, bring these up during Cirq CynqueNeeds decision / discussion, bring these up during Cirq Cynque