Conversation
The destabilizer construction moved into QuditCode.get_destabilizer_ops was only correct over GF(2): - The logical/gauge projection relied on a GF(2)-specific sign trick. Replace it with a field-general projection using the inverse of the symplectic form. - The commute-fixing loop subtracted a stabilizer with a hardcoded coefficient; scale by the symplectic overlap (and fix its sign) so it cancels over GF(q). Also fix a cache-rebinding inconsistency: evaluating self.dimension / self.gauge_dimension canonicalizes (and rebinds) the cached stabilizer operators, so both get_destabilizer_ops and get_encoding_tableau now compute the stabilizer count before grabbing stab_ops, keeping the destabilizers dual to the stabilizers actually reported by get_stabilizer_ops. Add destabilizer property assertions to test_qudit_ops (100% coverage of get_destabilizer_ops over GF(2)/GF(3)/GF(4)) and an encoding test exercising the overcomplete-stabilizer fallback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
QuditCode.dimension and .gauge_dimension counted stabilizer generators via get_stabilizer_ops(canonicalized=True), which rebinds the cached stabilizer operators as a side effect. Count the independent generators with get_stabilizer_ops().row_space() instead, which operates on a copy and leaves the cache intact. With the rebind gone, get_destabilizer_ops and get_encoding_tableau no longer need to evaluate the stabilizer count before grabbing stab_ops, so restore the natural inline condition in both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… form The logical and gauge operators are already in standard symplectic form, so their symplectic dual basis is just the operators reindexed as [Z; -X]. Use that directly instead of constructing ops @ symplectic_conjugate(ops).T and inverting it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Example usage: I have a syndrome vector
syndrome_bits = (s_0, s_1, ...)from stabilizer measurements. I want the destabilizer that zeros out that syndrome and commutes with all logical operators. Say the code is self-dual and defined by a minimal set of stabilizer generators. I can construct the desired stabilizer with some thing like: