Fix local Fourier transforms (conjugated) over non-binary fields - #579
Merged
Conversation
…njugate QuditCode.conjugated() transformed the chosen qudits with a plain X<->Z swap, which is symplectic only over GF(2). Over odd characteristic the missing sign negates each conjugated qudit's contribution to every symplectic product, so commutation relations were corrupted: the conjugated code was inconsistent (BaconShorCode(3, field=3).conjugated([0, 5, 7]) reported dimension 3 instead of 1) and its logical operators were not a valid basis. Apply the local Fourier map (x, z) -> (z, -x) via math.symplectic_conjugate, restricted to the chosen qudits, so the conjugation convention has a single source of truth. Over GF(2) this is unchanged, since -1 == 1. 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.
AI-assisted summary
QuditCode.conjugated()previously transformed the chosen qudits by swapping their X-type and Z-type components. That swap is symplectic only over GF(2); over a field of odd characteristic it drops a sign and flips the commutation relations of the conjugated qudits.QuditCode.conjugated()now applies the local Fourier map (x, z) -> (z, -x) throughmath.symplectic_conjugate, restricted to the chosen qudits, so the conjugation convention lives in one place.A regression test checks that conjugating a code over GF(3) and GF(4) preserves its commutation relations, dimension, and logical operator basis.