Skip to content

polish docs, minor compact fixes, and add makefile for automatic setup #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Fe-r-oz
Copy link
Contributor

@Fe-r-oz Fe-r-oz commented Jun 14, 2025

This PR addresses several minor improvements to documentation and testing:

  • Fixes existing documentation, test, doctest errors. Adds some minor documentation.

Adds a Makefile to:

  • Run tests with make test (without using the REPL).
    ̶-̶ ̶F̶o̶r̶m̶a̶t̶ ̶s̶o̶u̶r̶c̶e̶ ̶f̶i̶l̶e̶s̶ ̶u̶s̶i̶n̶g̶ ̶J̶u̶l̶i̶a̶F̶o̶r̶m̶a̶t̶t̶e̶r̶ ̶v̶i̶a̶ ̶̶m̶a̶k̶e̶ ̶f̶o̶r̶m̶a̶t̶̶.̶
  • Test documentation builds with make docs.

We can skip the build, manifest in the docs folder as well by adding a .gitignore in docs.

̶ ̶̶m̶a̶k̶e̶ ̶f̶o̶r̶m̶a̶t̶̶ ̶c̶a̶n̶ ̶h̶e̶l̶p̶ ̶c̶a̶t̶c̶h̶ ̶s̶y̶n̶t̶a̶x̶ ̶e̶r̶r̶o̶r̶s̶,̶ ̶s̶u̶c̶h̶ ̶a̶s̶ ̶i̶n̶ ̶t̶h̶i̶s̶ ̶l̶i̶n̶e̶:̶ ̶

degree(C.G[r, c]) == C.vi[r] && (G_h[r, c] 1;)

I have changed this to degree(C.G[r, c]) == C.vi[r] && (G_h[r, c] = 1)

Changed this

err = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

to

err = zeros(Int, 254)
err[81] = 1

Changed @warn to !!! note in product codes. The @warn was causing issues in doctests by warnings errors during test execution. Replaced with!!! notefor cleaner documentation output.

Error in PlanarSurfaceCode

I ran most of the misc quantum codes, it appears there is bug in planer surface code.

Edit: It occurs due to a metacheck in setlogicals! : _has_equivalent_row_spaces(vcat(S.logs_mat, S.stabs), vcat(L, S.stabs)) || error("The current logicals are not equivalent to the input."). In this case, the second output might be more revealing as it shows indexing error

julia> PlanarSurfaceCode(2,2)
ERROR: The current logicals are not equivalent to the input.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] set_logicals!(::HasLogicals, S::StabilizerCodeCSS, L::Nemo.fpMatrix)
   @ CodingTheory ~/Desktop/New Folder14/ct/2/CodingTheory/src/Quantum/subsystem_code.jl:1405                                                           
 [3] set_logicals!(S::StabilizerCodeCSS, L::Nemo.fpMatrix)


julia> PlanarSurfaceCode(5,3)
ERROR: BoundsError: attempt to access 11x23 fpMatrix at index [12, 18]
Stacktrace:
 [1] throw_boundserror(A::fpMatrix, I::Tuple{Int64, Int64})
   @ Base ./essentials.jl:14
 [2] _checkbounds
   @ ~/.julia/packages/AbstractAlgebra/5aJmh/src/Matrix.jl:69 [inlined]
 [3] setindex!
   @ ~/.julia/packages/Nemo/tYNqm/src/flint/gfp_mat.jl:33 [inlined]
 [4] PlanarSurfaceCode(d_x::Int64, d_z::Int64)

@Fe-r-oz Fe-r-oz changed the title 📝 polish documentation, and add makefile for automatic setup polish docs, minor compact fixes, and add makefile for automatic setup Jun 14, 2025
@Fe-r-oz Fe-r-oz marked this pull request as ready for review June 14, 2025 21:58
@Fe-r-oz
Copy link
Contributor Author

Fe-r-oz commented Jun 14, 2025

Hi @esabo, I hope you're doing well! Please help review this PR, Thank you!!

Summary of changes: I noticed some documentation build errors and test failures on master, so I fixed them. I also verified that most of the miscellaneous quantum code examples are running correctly. As a minor improvement, I’ve added a Makefile to simplify the build, debug and test process. Ran the JuliaFormatter via make format so that's why the changes. Removed build folder and manifest from docs by adding .gitigore. And some other minor changes.

Copy link
Owner

@esabo esabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc fixes cannot be pulled until the formatting throughout is returned to its previous state. The library is set to use a specific format that all code must conform to.

@Fe-r-oz
Copy link
Contributor Author

Fe-r-oz commented Jul 12, 2025

Thanks for your feedback. I will rebase and undo the formatting change that was inspired by QuantumToolbox.jl.

@Fe-r-oz Fe-r-oz marked this pull request as draft July 12, 2025 19:56
@Fe-r-oz Fe-r-oz mentioned this pull request Jul 23, 2025
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.

2 participants