Skip to content

Feature/commutation check#12

Open
Bloooman wants to merge 7 commits intoQuantumSavory:masterfrom
Bloooman:feature/commutation_check
Open

Feature/commutation check#12
Bloooman wants to merge 7 commits intoQuantumSavory:masterfrom
Bloooman:feature/commutation_check

Conversation

@Bloooman
Copy link

@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

github-actions bot commented Feb 23, 2026

Benchmark Results (Julia v1)

Time benchmarks
master 00f7e90... master / 00f7e90...
traversal/combine/10 3.05 ± 0.21 μs 3.02 ± 0.19 μs 1.01 ± 0.095
traversal/combine/100 0.0335 ± 0.0022 ms 0.0331 ± 0.0024 ms 1.01 ± 0.099
traversal/combine/1000 0.327 ± 0.022 ms 0.321 ± 0.026 ms 1.02 ± 0.11
traversal/direction/left_100 0.191 ± 0.011 μs 0.191 ± 0.011 μs 1 ± 0.081
traversal/direction/right_100 0.211 ± 0.011 μs 0.21 ± 0.019 μs 1 ± 0.1
traversal/mixed/noop_100 0.16 ± 0.001 μs 0.16 ± 0.001 μs 1 ± 0.0088
traversal/mixed/swap_100 0.22 ± 0.01 μs 0.211 ± 0.011 μs 1.04 ± 0.072
traversal/noop/10 0.07 ± 0 μs 0.07 ± 0.01 μs 1 ± 0.14
traversal/noop/100 0.17 ± 0.01 μs 0.16 ± 0.011 μs 1.06 ± 0.096
traversal/noop/1000 1.19 ± 0.011 μs 1.18 ± 0.08 μs 1.01 ± 0.069
traversal/swap/10 0.08 ± 0.01 μs 0.071 ± 0.01 μs 1.13 ± 0.21
traversal/swap/100 0.22 ± 0.011 μs 0.21 ± 0.019 μs 1.05 ± 0.11
traversal/swap/1000 1.49 ± 0.02 μs 1.48 ± 0.03 μs 1.01 ± 0.024
time_to_load 1.46 ± 0.043 s 1.45 ± 0.0037 s 1.01 ± 0.03
Memory benchmarks
master 00f7e90... master / 00f7e90...
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

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.46%. Comparing base (ee5c4cc) to head (00f7e90).

Files with missing lines Patch % Lines
src/MainIteration.jl 93.75% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #12      +/-   ##
==========================================
+ Coverage   78.26%   81.46%   +3.20%     
==========================================
  Files           4        5       +1     
  Lines         184      232      +48     
==========================================
+ Hits          144      189      +45     
- 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
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!

@@ -1,5 +1,9 @@
# News

## underdevelop
Copy link
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.

using Moshi.Match: @match


function affectedpaulis(op::CircuitOp.Type)
Copy link
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.

function complete_paulis(op1::CircuitOp.Type, op2::CircuitOp.Type)
pu1=affectedpaulis(op1)
pu2=affectedpaulis(op2)
println("Affected Paulis of op1: ", pu1)
Copy link
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.

end
end

function complete_paulis(op1::CircuitOp.Type, op2::CircuitOp.Type)
Copy link
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.


end

end No newline at end of file
Copy link
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.

@@ -1,5 +1,4 @@
module PBCCompiler

Copy link
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

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