Skip to content

Separate out the quantum part of ActOnArgs into own class #4827

@daxfohl

Description

@daxfohl

Describe your design idea/issue

Right now, the ActOnArgs hierarchy design is such that ActOnArgs (the base class) contains all the shared stuff like measurement logs, qid shape, etc., and the subclasses contain their quantum representations. This works, but I've always felt it was a little clunky.

A result of this approach is that ActOnArgs.kron(), etc., do the kronning of the qid shape, and then calls self._on_kron(), which delegates the subclasses to kron the quantum states. Again, this works but feels clunky.

It may be worth exploring a change where the quantum part is placed into its own class. So we'd have a StateVectorQuantumState, a DensityMatrixQuantumState, etc, that implement a SimulatorQuantumState interface specifying copy, kron, etc. Then instead of requiring ActOnArgs subclasses to implement _on_kron, the new kron routine is just target.quantum_state = self.quantum_state.kron(other.quantum_state).

Ultimately from there we may be able to kill off the subclasses and just make ActOnArgs generic like ActOnArgs[TSimulatorQuantumState].

xref #4582, perhaps these quantum classes should go into qis instead of sim?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/simulationkind/design-issueA conversation around designtriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions