Skip to content

fix: correct circuit and simulation semantics for beta6 - #68

Merged
jianjian01 merged 16 commits into
cq-lib:release/2.0from
jianjian01:release/2.0
Oct 18, 2026
Merged

jianjian01 merged 16 commits into
cq-lib:release/2.0from
jianjian01:release/2.0

Conversation

@jianjian01

Copy link
Copy Markdown
Collaborator
  • Fix composite-gate parameter binding, qubit ordering, and global phase preservation.
  • Correct symbolic substitution, NumPy complex coefficients, density-matrix validation, readout noise, and Pauli-vector labels.
  • Bump versions to beta6 and document compatibility changes.

Return scalar numeric and symbolic matrices for zero-qubit GPhase gates so
controlled matrices match their declared qubit counts.

Dispatch controlled gates only after recognizing supported specializations,
and route zero-control GPhase through the ordinary phase execution path in
the three numerical simulators. Return an unsupported-operation error for
controlled GPhase in StabilizerState without indexing a nonexistent target.

Add Rust and Python regressions for matrix metadata, symbolic parameters,
controlled evolution, noise behavior, zero controls, and stabilizer errors.
Emit each defining circuit's global phase inside CircuitGate and
circuit-backed UnitaryGate definitions so round trips preserve the full
unitary, including phase.

Add Rust and Python regressions for fixed and symbolic phases, nested and
repeated calls, local parameters, and explicit GPhase operations alongside
phase metadata.
Validate distinct targets in the shared two-qubit and multi-qubit checks before
running gate kernels, clearing Kraus output, or applying noise. Reuse the existing
invalid-parameter error and include the duplicate index in the diagnostic.

Add Rust regressions for gate, custom-matrix, Kraus, and noisy paths that verify
rejection leaves the full density matrix unchanged, including middle-qubit targets.

Validation: 134 density-matrix-related Rust tests passed. The preceding full
workspace run passed 4080 tests; the production fix is unchanged since that run.
Verify Python raises ValueError and the C ABI returns -8 for duplicate targets,
with the complete density matrix unchanged. Compare valid ordered-target results
against independently constructed full-matrix expectations.

Include the standalone C host test in staged SDKs and register static and shared
CTest suites. Update the SDK documentation to describe the additional coverage.

Validation: 103 Python regressions passed; development and release SDK workflows
each passed all 6 CTests. Workspace Clippy and formatting checks passed.
…order

Share matrix evaluation between instruction and full-circuit paths, preserving global phase and gate-local argument ordering. Validate parameter arity and finite values without mutating frozen definitions.

Add Rust, Python, and C regression coverage for parameter binding, sparse and permuted qubits, nested and inverse gates, and commutation classification.
Generate MSB-first matrices at the instruction boundary while preserving the public definition matrix convention. Cover commutation, positional qubit order, parameter binding, global phase, and explicit matrix precedence.
@jianjian01
jianjian01 merged commit 6067823 into cq-lib:release/2.0 Oct 18, 2026
4 checks passed
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.

1 participant