Skip to content

Add StateVectorRepr backend with tests and documentation #120

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 29 commits into
base: main
Choose a base branch
from

Conversation

phantmgx
Copy link

@phantmgx phantmgx commented May 30, 2025

This PR adds a new StateVectorRepr backend to QuantumSymbolics.jl, which converts symbolic quantum objects to numerical vectors/matrices using QuantumOpticsRepr. The changes include:

  • Implementation of StateVectorRepr in QuantumOpticsExt.jl.
  • Tests in test_statevectorrepr.jl using @testitem.
  • Documentation in docs/src/index.md under a new ## Backends section.
  • Added QuantumOptics as a weak dependency in Project.toml for the QuantumOpticsExt extension.
  • Updated CHANGELOG.md with an entry for the new StateVectorRepr backend.

Checklist

  • 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.
  • Formatting checks for new code.

phantmgx added 14 commits May 30, 2025 00:55
Added `StateVectorRepr` backend to `QuantumSymbolics.jl`. Turns symbolic quantum stuff into `Vector{ComplexF64}` (kets) or `Matrix{ComplexF64}` (operators) using `QuantumOpticsRepr` for `express`. Put it in `QuantumOpticsExt.jl`, added tests in `quantumoptics_tests.jl`, docs in `index.md`, and `QuantumOptics` as a weak dep in `Project.toml`. Tests pass locally.
Add [compat] section and QuantumSavory version to test/Project.toml
Project.toml Outdated
@@ -16,11 +16,12 @@ TermInterface = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c"
[weakdeps]
QuantumClifford = "0525e862-1e90-11e9-3e4d-1b39d7109de1"
QuantumOpticsBase = "4f57444f-1401-5e15-980d-4471b28d5678"
QuantumOptics = "6e4d0e0e-3d2e-5f0e-8f3f-2b5b8e8d2f1e"
Copy link
Member

Choose a reason for hiding this comment

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

QuantumOpticsBase should be sufficient. I do not think you need QuantumOptics.

Copy link
Author

Choose a reason for hiding this comment

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

thanks i have removed that line now

Copy link
Member

Choose a reason for hiding this comment

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

The changes to this file seem a bit weird. Was this done by an LLM?

Copy link
Author

Choose a reason for hiding this comment

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

Indeed, an LLM provided some initial support on these changes, especially with deciphering a few errors and code patterns

Copy link
Member

Choose a reason for hiding this comment

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

check the Pkg.jl documentation and look at how QuantumSymbolics.jl and QuantumClifford.jl have things done as a reference, so that you can detect whether the LLM is suggesting silly things

Comment on lines 114 to 117
struct StateVectorRepr{C}
config::C
StateVectorRepr(config=nothing) = new{typeof(config)}(config)
end
Copy link
Member

Choose a reason for hiding this comment

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

The type parameterization here is a bit overly complicated. Any reason to set it up like this? Check out the QuantumOpticsRepr -- it can be a good reference for how to do it in a simpler way.

@Krastanov Krastanov marked this pull request as draft June 4, 2025 14:43
@Krastanov
Copy link
Member

I am marking this as a draft just to keep my review queue a bit more manageable. Feel free to convert it back once it is ready and do not hesitate to ask for a review at any time.

@apkille
Copy link
Member

apkille commented Jul 17, 2025

@phantmgx what's the status on this PR? If you want I can help finish it :)

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