Skip to content

Allow single-mode homodyne and generaldyne measurements#106

Merged
Krastanov merged 5 commits intoQuantumSavory:mainfrom
Krastanov-agent:fix-all-mode-homodyne-ptrace-codex
Mar 19, 2026
Merged

Allow single-mode homodyne and generaldyne measurements#106
Krastanov merged 5 commits intoQuantumSavory:mainfrom
Krastanov-agent:fix-all-mode-homodyne-ptrace-codex

Conversation

@Krastanov-agent
Copy link
Copy Markdown
Contributor

@Krastanov-agent Krastanov-agent commented Mar 19, 2026

Summary

  • allow homodyne, generaldyne, and their corresponding rand(...) interfaces to measure all modes of a Gaussian state, including the 1-mode case
  • add regression tests for the single-mode homodyne and generaldyne edge cases
  • keep ptrace(all_modes) throwing and assert that behavior explicitly in tests

Verification

  • julia -tauto --project=/workdir/dev/QuantumSavory/Gabs.jl -e 'using Pkg; Pkg.test()'

Companion QuantumSavory change

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@df80d55). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #106   +/-   ##
=======================================
  Coverage        ?   97.24%           
=======================================
  Files           ?       20           
  Lines           ?     2686           
  Branches        ?        0           
=======================================
  Hits            ?     2612           
  Misses          ?       74           
  Partials        ?        0           

☔ 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 19, 2026

Benchmark Results (Julia v1)

Time benchmarks
main 5f30014... main / 5f30014...
operations/channel product/10 4.33 ± 0.5 μs 4.37 ± 0.46 μs 0.991 ± 0.16
operations/channel product/100 0.678 ± 0.14 ms 0.671 ± 0.025 ms 1.01 ± 0.22
operations/channel product/2 1.26 ± 0.09 μs 1.24 ± 0.091 μs 1.02 ± 0.1
operations/channel product/200 3.48 ± 0.54 ms 3.46 ± 0.15 ms 1.01 ± 0.16
operations/channel product/50 0.232 ± 0.012 ms 0.232 ± 0.013 ms 0.998 ± 0.075
operations/partial trace/10 1.19 ± 0.13 μs 1.23 ± 0.13 μs 0.968 ± 0.15
operations/partial trace/100 8.21 ± 0.84 μs 8.12 ± 0.7 μs 1.01 ± 0.14
operations/partial trace/2 0.841 ± 0.06 μs 0.841 ± 0.069 μs 1 ± 0.11
operations/partial trace/200 16.6 ± 2.8 μs 16.4 ± 2.6 μs 1.01 ± 0.23
operations/partial trace/50 4.91 ± 0.51 μs 4.69 ± 0.76 μs 1.05 ± 0.2
operations/tensor product/10 1.87 ± 0.3 μs 1.88 ± 0.31 μs 0.995 ± 0.23
operations/tensor product/100 0.143 ± 0.024 ms 0.14 ± 0.021 ms 1.02 ± 0.23
operations/tensor product/2 0.781 ± 0.05 μs 0.772 ± 0.04 μs 1.01 ± 0.083
operations/tensor product/200 0.792 ± 0.28 ms 0.781 ± 0.21 ms 1.01 ± 0.45
operations/tensor product/50 27.4 ± 11 μs 26.2 ± 11 μs 1.05 ± 0.62
operations/unitary product/10 3.4 ± 0.26 μs 3.46 ± 0.25 μs 0.982 ± 0.1
operations/unitary product/100 0.637 ± 0.028 ms 0.631 ± 0.033 ms 1.01 ± 0.069
operations/unitary product/2 1.08 ± 0.06 μs 1.07 ± 0.09 μs 1.01 ± 0.1
operations/unitary product/200 3.36 ± 0.17 ms 3.38 ± 0.21 ms 0.996 ± 0.079
operations/unitary product/50 0.217 ± 0.0082 ms 0.215 ± 0.013 ms 1.01 ± 0.072
time_to_load 0.215 ± 0.0029 s 0.213 ± 0.0056 s 1.01 ± 0.03
Memory benchmarks
main 5f30014... main / 5f30014...
operations/channel product/10 17 allocs: 10.2 kB 17 allocs: 10.2 kB 1
operations/channel product/100 17 allocs: 0.919 MB 17 allocs: 0.919 MB 1
operations/channel product/2 14 allocs: 0.891 kB 14 allocs: 0.891 kB 1
operations/channel product/200 19 allocs: 3.67 MB 19 allocs: 3.67 MB 1
operations/channel product/50 17 allocs: 0.231 MB 17 allocs: 0.231 MB 1
operations/partial trace/10 14 allocs: 0.672 kB 14 allocs: 0.672 kB 1
operations/partial trace/100 15 allocs: 2.79 kB 15 allocs: 2.79 kB 1
operations/partial trace/2 14 allocs: 0.672 kB 14 allocs: 0.672 kB 1
operations/partial trace/200 15 allocs: 5.04 kB 15 allocs: 5.04 kB 1
operations/partial trace/50 14 allocs: 1.69 kB 14 allocs: 1.69 kB 1
operations/tensor product/10 9 allocs: 13.1 kB 9 allocs: 13.1 kB 1
operations/tensor product/100 10 allocs: 1.22 MB 10 allocs: 1.22 MB 1
operations/tensor product/2 8 allocs: 0.797 kB 8 allocs: 0.797 kB 1
operations/tensor product/200 10 allocs: 4.89 MB 10 allocs: 4.89 MB 1
operations/tensor product/50 9 allocs: 0.307 MB 9 allocs: 0.307 MB 1
operations/unitary product/10 14 allocs: 6.95 kB 14 allocs: 6.95 kB 1
operations/unitary product/100 14 allocs: 0.614 MB 14 allocs: 0.614 MB 1
operations/unitary product/2 12 allocs: 0.688 kB 12 allocs: 0.688 kB 1
operations/unitary product/200 16 allocs: 2.45 MB 16 allocs: 2.45 MB 1
operations/unitary product/50 14 allocs: 0.155 MB 14 allocs: 0.155 MB 1
time_to_load 0.145 k allocs: 11 kB 0.145 k allocs: 11 kB 1

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.

huh... this was surprisingly easy. I guess the check was just too unnecessarily harsh, while the code already supports it.

Comment thread test/test_measurements.jl
Copy link
Copy Markdown
Member

@apkille apkille left a comment

Choose a reason for hiding this comment

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

@Krastanov we could probably do the same for generaldyne and soon to be heterodyne (#96).

@Krastanov
Copy link
Copy Markdown
Member

good point, I will make an issue about it to keep track of it

@Krastanov-agent Krastanov-agent changed the title Allow single-mode homodyne measurements Allow single-mode homodyne and generaldyne measurements Mar 19, 2026
@Krastanov
Copy link
Copy Markdown
Member

Ok, generaldyne is treated the same way now, and some barebones tests are added. I will merge and release and then proceed with the related PR in QuantumSavory.jl

@Krastanov Krastanov merged commit 93ede8e into QuantumSavory:main Mar 19, 2026
15 checks passed
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.

3 participants