Skip to content

Add qubit_map parameter to TrialResult #5270

@daxfohl

Description

@daxfohl

Summarize the task

SimulationTrialResult has the following line:

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

No one assigned

    Labels

    area/simulationkind/taskA task that's part of a larger efforttriage/discussNeeds decision / discussion, bring these up during Cirq Cynque

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions