Skip to content

Feature/commutation check#12

Open
Bloooman wants to merge 10 commits into
QuantumSavory:masterfrom
Bloooman:feature/commutation_check
Open

Feature/commutation check#12
Bloooman wants to merge 10 commits into
QuantumSavory:masterfrom
Bloooman:feature/commutation_check

Conversation

@Bloooman
Copy link
Copy Markdown

@Bloooman Bloooman commented Feb 23, 2026

@Krastanov

  • Functions to check commutation between 2 Circuit Operations

  • Corresponding Tests for commutation checks

  • The code is properly formatted and commented.

  • Substantial new functionality is documented within the docs.

  • All new functionality is tested.

  • All of the automated tests on github pass.

  • We recently started enforcing formatting checks. If formatting issues are reported in the new code you have written, please correct them. There will be plenty of old code that is flagged as we are slowly transitioning to enforced formatting. Please do not worry about or address older formatting issues -- keep your PR just focused on your planned contribution.

If you are submitting for a bug bounty:

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 23, 2026

Benchmark Results (Julia v1)

Time benchmarks
master 0ee9ab8... master / 0ee9ab8...
traversal/combine/10 2.87 ± 0.16 μs 2.87 ± 0.21 μs 1 ± 0.092
traversal/combine/100 31.4 ± 1.4 μs 31.4 ± 1.9 μs 1 ± 0.074
traversal/combine/1000 0.314 ± 0.014 ms 0.308 ± 0.017 ms 1.02 ± 0.073
traversal/direction/left_100 0.2 ± 0.02 μs 0.191 ± 0.011 μs 1.05 ± 0.12
traversal/direction/right_100 0.211 ± 0.011 μs 0.211 ± 0.011 μs 1 ± 0.074
traversal/mixed/noop_100 0.16 ± 0.01 μs 0.16 ± 0.001 μs 1 ± 0.063
traversal/mixed/swap_100 0.22 ± 0.02 μs 0.22 ± 0.011 μs 1 ± 0.1
traversal/noop/10 0.07 ± 0.01 μs 0.07 ± 0.01 μs 1 ± 0.2
traversal/noop/100 0.16 ± 0.01 μs 0.161 ± 0.01 μs 0.994 ± 0.088
traversal/noop/1000 1.19 ± 0.021 μs 1.19 ± 0.031 μs 0.999 ± 0.031
traversal/swap/10 0.07 ± 0.01 μs 0.071 ± 0.01 μs 0.986 ± 0.2
traversal/swap/100 0.211 ± 0.01 μs 0.211 ± 0.011 μs 1 ± 0.07
traversal/swap/1000 1.49 ± 0.02 μs 1.49 ± 0.02 μs 0.999 ± 0.019
time_to_load 1.54 ± 0.0065 s 1.53 ± 0.016 s 1 ± 0.011
Memory benchmarks
master 0ee9ab8... master / 0ee9ab8...
traversal/combine/10 0.207 k allocs: 6.75 kB 0.207 k allocs: 6.75 kB 1
traversal/combine/100 2.28 k allocs: 0.0725 MB 2.28 k allocs: 0.0725 MB 1
traversal/combine/1000 23 k allocs: 0.732 MB 23 k allocs: 0.732 MB 1
traversal/direction/left_100 0 allocs: 0 B 0 allocs: 0 B
traversal/direction/right_100 0 allocs: 0 B 0 allocs: 0 B
traversal/mixed/noop_100 0 allocs: 0 B 0 allocs: 0 B
traversal/mixed/swap_100 0 allocs: 0 B 0 allocs: 0 B
traversal/noop/10 0 allocs: 0 B 0 allocs: 0 B
traversal/noop/100 0 allocs: 0 B 0 allocs: 0 B
traversal/noop/1000 1 allocs: 16 B 1 allocs: 16 B 1
traversal/swap/10 0 allocs: 0 B 0 allocs: 0 B
traversal/swap/100 0 allocs: 0 B 0 allocs: 0 B
traversal/swap/1000 1 allocs: 16 B 1 allocs: 16 B 1
time_to_load 0.149 k allocs: 11.1 kB 0.149 k allocs: 11.1 kB 1

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.54%. Comparing base (ee5c4cc) to head (0ee9ab8).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/MainIteration.jl 93.87% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #12      +/-   ##
==========================================
+ Coverage   78.26%   81.54%   +3.28%     
==========================================
  Files           4        5       +1     
  Lines         184      233      +49     
==========================================
+ Hits          144      190      +46     
- Misses         40       43       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

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

forgot to submit these comments originally, my bad. These are just preliminary discussion on style. Thanks for starting this!

Comment thread CHANGELOG.md Outdated
@@ -1,5 +1,9 @@
# News

## underdevelop
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does "underdeveloped" mean? Unfinished or unreleased?

If it is "unfinished", let's just make sure we finish them in a well structured PR. If it is "unreleased", then put them with the rest in v0.1.0-dev which is also unreleased.

Comment thread src/MainIteration.jl
using Moshi.Match: @match


function affectedpaulis(op::CircuitOp.Type)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a docstring to the function that explains what it is and what it is for. Use jldoctest to put in examples of how to use it.

Comment thread src/MainIteration.jl Outdated
function complete_paulis(op1::CircuitOp.Type, op2::CircuitOp.Type)
pu1=affectedpaulis(op1)
pu2=affectedpaulis(op2)
println("Affected Paulis of op1: ", pu1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do not have your functions uncontrollably print things out -- that would make the library very very noisy and difficult to use without polluting the stdout. If these messages are valuable for you as you are working on the library, use @debug logging statements -- they can be controlled more easily and by default are quiet.

Comment thread src/MainIteration.jl
end
end

function complete_paulis(op1::CircuitOp.Type, op2::CircuitOp.Type)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Docstring, as mentioned for the previous one. Check the julia documentation on how to structure docstrings.

Comment thread test/test_commutation.jl

end

end No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Notice the warning about a missing new line at the end of this file. Set your editor to clean these things automatically. Here is the settings I have added to vscode for instance:

        "editor.detectIndentation": false,
        "editor.insertSpaces": true,
        "editor.tabSize": 4,
        "files.insertFinalNewline": true,
        "files.trimFinalNewlines": true,
        "files.trimTrailingWhitespace": true,
        "editor.rulers": [92],
        "files.eol": "\n",

Some of these might be redundant -- they have grown organically.

Comment thread src/PBCCompiler.jl
@@ -1,5 +1,4 @@
module PBCCompiler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do not edit unrelated parts of the files, it makes the diffs noisy and more difficult to review

Comment thread CHANGELOG.md Outdated
@Bloooman Bloooman requested a review from Krastanov March 3, 2026 20:50
@Bloooman Bloooman force-pushed the feature/commutation_check branch from 0c58ab2 to 0ee9ab8 Compare March 11, 2026 22:14
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