Skip to content

Add qutrit state-vector and density-matrix simulators for noise verification #585

Description

@qciaran

Summary

Add production-quality qutrit state-vector and density-matrix simulators to PECOS, then use them as independent references for verifying leakage-aware noise models, including GeneralNoiseModel and its Selene plugin.

The initial physical basis is:

|0>, |1>, |L>

The implementation should remain device-neutral. A generic qudit core is preferable if it does not compromise a clear qutrit API or delay the initial leakage use case.

Motivation

PECOS currently has two complementary pieces, but no production qutrit simulator:

  • The Rust density-matrix simulator is qubit-specific. It represents an N-qubit density matrix using a 2N-qubit state vector and assumes a local dimension of two throughout its indexing, gate traits, measurement, and state-access APIs.
  • GeneralNoiseModel represents leakage efficiently as stochastic classical bookkeeping: leaked qubits are tracked separately, ordinary gates are suppressed, and seepage returns a qubit to the computational subspace.
  • PR feat(selene): add PECOS general noise error-model plugin #545 adds a small test-only NumPy qutrit density-matrix oracle to verify the device-neutral Selene general-noise plugin.

The existing stochastic model is appropriate for scalable QEC studies, but an independent physical qutrit simulation would let us verify that its ensemble behavior is correct and explore coherent leakage effects that classical leakage bookkeeping cannot represent.

Proposed simulators

Qutrit state vector

Store 3^N complex amplitudes and support shot-based quantum trajectories.

Required capabilities:

  • arbitrary one- and two-site qutrit unitaries;
  • computational-subspace qubit gates embedded as U + |L><L|;
  • native coherent coupling between computational and leakage levels;
  • computational and full {0, 1, L} measurements;
  • reset and preparation;
  • sampled Kraus channels with outcome probability, application, and renormalization;
  • deterministic seeding;
  • state/probability inspection suitable for tests.

This should be the more scalable physical-leakage backend: O(3^N) state storage, with mixed channels represented through trajectories across shots.

Qutrit density matrix

Store an exact 3^N x 3^N density operator.

Required capabilities:

  • the same unitary, measurement, reset, and preparation semantics as the state-vector simulator;
  • exact Kraus-channel application;
  • reduced density matrices and outcome distributions;
  • density-operator inspection;
  • validation helpers for trace preservation, Hermiticity, and positive semidefiniteness.

This is expected to be a small-system reference backend because storage scales as O(9^N).

Architecture

Investigate a shared local-dimension abstraction rather than copying the current qubit StateVec and DensityMatrix implementations. Possible public shapes include:

QuditStateVec::new(num_sites, local_dimension)
QuditDensityMatrix::new(num_sites, local_dimension)

type QutritStateVec = ...;
type QutritDensityMatrix = ...;

The design should not force qutrit operations into qubit-only traits such as CliffordGateable. Prefer explicit local-unitary, channel, and generalized-measurement capabilities, with convenience methods for embedded qubit gates.

State indexing, target ordering, endianness, and measurement conventions must be documented and shared by both simulators.

Noise-model verification

Use the exact density-matrix backend and state-vector trajectory backend to independently verify PECOS noise behavior.

The verification matrix should include:

  • noiseless computational-subspace circuits;
  • single- and two-qubit Pauli channels;
  • preparation leakage;
  • one- and two-qubit emission models;
  • leakage followed by gate suppression;
  • seepage back into the computational subspace;
  • reset of leaked states;
  • normal and leakage-aware measurement;
  • asymmetric readout;
  • idle noise and coherent rotations where applicable;
  • combined channels on deep, parallel, and entangling circuits;
  • multiple error and simulator seeds.

For stochastic comparisons:

  1. Compute the exact outcome distribution with the qutrit density matrix.
  2. Confirm qutrit state-vector trajectory averages converge to it.
  3. Confirm GeneralNoiseModel trajectories converge to the same distribution for the subset of qutrit channels represented by its current classical-leakage semantics.
  4. Run the same comparisons through the Selene plugin boundary so serialization and operation translation are also covered.

The test suite should detect vacuous circuits by comparing against a noiseless or intentionally different distribution, following the conformance approach introduced in PR #545.

Suggested phases

  • Define generalized local-state, operation, measurement, and state-access semantics.
  • Implement and test the qutrit/qudit state-vector core.
  • Add sampled Kraus trajectories and leakage/seepage channels.
  • Implement and test the exact qutrit/qudit density-matrix core.
  • Cross-validate unitary evolution between the two backends.
  • Cross-validate trajectory averages against exact Kraus evolution.
  • Add GeneralNoiseModel conformance tests.
  • Add Selene general-noise plugin conformance tests.
  • Decide whether either simulator should be exposed through PECOS engine and Python APIs.
  • Document scaling limits and intended use cases.

Acceptance criteria

  • Both simulators agree exactly, within numerical tolerance, for pure unitary circuits.
  • State-vector trajectory statistics agree with exact density-matrix results for mixed channels within a documented statistical tolerance.
  • Density matrices remain normalized, Hermitian, and positive semidefinite within numerical tolerance.
  • The supported subset of GeneralNoiseModel agrees with the independent qutrit reference across preparation, one-site, two-site, leakage, seepage, reset, and measurement channels.
  • Verification covers both direct PECOS execution and the Selene plugin boundary.
  • Tests and APIs contain no hardware- or vendor-specific parameters, gates, or assumptions.
  • Scaling and unsupported coherent-leakage semantics are documented clearly.

Non-goals

  • Replacing the efficient classical leakage bookkeeping used by large QEC simulations.
  • Claiming that an exact qutrit density matrix is scalable to large codes.
  • Changing GeneralNoiseModel semantics as part of the initial simulator implementation.
  • Introducing device-specific calibration presets.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexplorationrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions