Repository navigation
Conversation
…y/paste MAGMA computations of permutation groups, requested with with_magma=True or Group.from_name(..., from_magma=True), now run a magma executable on PATH when a test run of it succeeds, and otherwise use the manual copy/paste workflow as before. MAGMA runs a script with a fixed random seed and without the user's startup file, and markers around the output of the command. An error that MAGMA reports in the command is raised; any other failure warns and falls back to the manual workflow. Calls without these arguments never run MAGMA, but the warning before a GAP computation of a permutation automorphism group notes when GAP needs copy/paste and a magma executable is on PATH. Closes #389. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…and warn when a magma on PATH fails its test run Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…GAP warning before GAP's availability prompt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…at they return the same generators Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e both MAGMA workflows in the docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # docs/source/installation.rst
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.
Motivation
Closes #389. qLDPC could use MAGMA only through a manual workflow, in which it printed a command and the user pasted MAGMA's output back. This pull request runs a local MAGMA automatically when one is available, and lets users make MAGMA the default for permutation automorphism groups.
Changes
with_magma=True(inget_permutation_automorphism_groupand the transversal-gate functions) andGroup.from_name(..., from_magma=True)try the disk cache, then amagmaonPATHthat passes a test run, then the manual workflow. They never fall back to GAP. The new private moduleqldpc/external/_magma.pyrunsmagma -b -n <script>with standard input closed. The script turns off echoing, wrapping, and paging, stops at the first error, and prints markers around the output, which qLDPC checks instead of the exit status. An error that MAGMA reports raises aValueError. Any other failure warns and falls back to the manual workflow.with_magmanow defaults toNone, which follows the environment variableQLDPC_AUTOMORPHISM_BACKEND:magmaselects MAGMA, unset orgapselects GAP, and any other value raises. An explicitwith_magmaalways wins. With the variable unset, behavior is unchanged. The variable does not affectGroup.from_name, whosefrom_magmasays which language the caller's command is in: GAP'sDihedralGroup(4)has order 4, but MAGMA's has order 8.SetSeed(1);. The disk-cache key includes this prefix, so MAGMA results cached before this change are not reused.GL(2, GF(3))became a wrong group that was then cached.QLDPC_AUTOMORPHISM_BACKEND, and says when amagmais onPATHbut GAP needs copy/paste. It is now raised before GAP's availability prompt.Validation
CI has no MAGMA, so tests mock it. The MAGMA output that the tests use was recorded by running qLDPC's exact scripts on MAGMA's online calculator (V2.29-10), and the tests pin those scripts and the command-line options. On the calculator, generators of a 48-point code's group differed between runs without
SetSeed(1), and agreed with it. Long output wrapped only after commas, at every width from 16 to 100 columns.Before merging: check with a local MAGMA
The calculator cannot show what only a local
magmadoes: its exit status, banner, echoing, and behavior without a licence. Someone with a licensed MAGMA should check out this branch, mergemaininto it, and install it withpython -m pip install -e '.[dev]'. They should then save the script below ascheck_local_magma.pyin the repository root, runPYTHONPATH=src python check_local_magma.py, and paste the output here. Every check should printPASS. The script bypasses qLDPC's disk cache. If a merge renames a private name that the script uses, update the script.check_local_magma.pyIf a check fails, look here:
_get_arguments, or a statement in_get_script, both inqldpc/external/_magma.py. Text outside the markers, such as a banner, is harmless._parse_magma_generatorsinqldpc/external/_groups.py._ERROR_PATTERNorSetQuitOnErrorin_magma.py._get_script._MAGMA_SEEDin_groups.py.After a fix, update the recorded scripts and outputs in
qldpc/external/_magma_test.py.