Skip to content

feat(backends): allow statevector simulation via use_statevector flag#56

Open
dlyongemallo wants to merge 20 commits into
moth-quantum:mainfrom
dlyongemallo:allow_statevector_simulation
Open

feat(backends): allow statevector simulation via use_statevector flag#56
dlyongemallo wants to merge 20 commits into
moth-quantum:mainfrom
dlyongemallo:allow_statevector_simulation

Conversation

@dlyongemallo
Copy link
Copy Markdown

Depends on #55.

Closes #40.

Introduce a framework-agnostic backend abstraction layer:
- `GateType` enum covering all gates used by quantumaudio schemes
- `GateOp` frozen dataclass for a single gate operation
- `CircuitSpec` with fluent builder API and Mottonen state-prep
  decomposition for non-negative real state vectors into RY + CX gates
- `UnifiedResult` normalising execution output across backends,
  with `to_qiskit_result()` bridge for backward compatibility
- Backend `ABC` and `BackendRegistry` singleton for provider discovery
- `is_available()` and `require()` helpers for optional dependencies
- Tests covering the above
Implement the `Backend` interface for Qiskit/AerSimulator, translating
`CircuitSpec` to `QuantumCircuit` with named register reconstruction from
metadata. Wire up the public API with `get_backend()` and
`available_backends()` functions, and auto-register the Qiskit provider
on import.
Implement the `Backend` interface for Google Cirq with automatic
registration when `cirq` is installed. Cirq is added as an optional
dependency under the `[cirq]` extras group.
…Qiskit types

Add `CircuitSpec` and `UnifiedResult` branches to `get_counts()`,
`get_metadata()`, and `pick_key_from_instance()` in `results.py`. Update
`draw_circuit()` in preview.py to convert `CircuitSpec` to `QuantumCircuit`
for visualisation. All existing Qiskit-only code paths are preserved.
… compat

BREAKING CHANGE: `encode()` now returns `CircuitSpec` instead of
`QuantumCircuit`.
BREAKING CHANGE: The `execute_function` parameter is removed from all
scheme `decode()` methods, as it is redundant with the backend
system. The `ExecuteFunction` protocol is removed from
`quantumaudio.utils.execute`.

The backend parameter and the lower-level `decode_counts()`/`decode_result()`
methods cover all use cases.
Runs `ruff check` plus `pytest` across Python 3.9-3.12 with the
`cirq`, `pennylane`, and `cudaq` extras installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow statevector simulation

1 participant