Skip to content

Commit

Permalink
Merge pull request #46 from apkille/express
Browse files Browse the repository at this point in the history
Migrate `express` and `AbstractRepresentation` type from QuantumSymbolics
  • Loading branch information
apkille authored Jan 16, 2025
2 parents f22adb7 + 7ce478a commit 8f8c0e2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# News

## v0.3.7 - 2025-01-16

- Migrate `express` functionalities and representation types from QuantumSymbolics.

## v0.3.6 - 2024-09-08

- Add `coherentstate`, `thermalstate`, `displace`, `squeeze`, `wigner`, previously from QuantumOptics.
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuantumInterface"
uuid = "5717a53b-5d69-4fa3-b976-0bf2f97ca1e5"
authors = ["QuantumInterface.jl contributors"]
version = "0.3.6"
version = "0.3.7"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
1 change: 1 addition & 0 deletions src/QuantumInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@ include("julia_linalg.jl")
include("sparse.jl")

include("sortedindices.jl")
include("express.jl")

end # module
32 changes: 32 additions & 0 deletions src/express.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
express(obj, repr::AbstractRepresentation)
express(obj, repr::AbstractRepresentation, use::AbstractUse)
Translate a quantum object `obj` to a backend representation `repr`. It is relevant to define `use`
for formalism-specific cases, e.g., for `QuantumCliffordRepr`.
"""
function express end

"""An abstract type for the supported representation of quantum objects."""
abstract type AbstractRepresentation end
abstract type AbstractUse end
struct UseAsState <: AbstractUse end
struct UseAsOperation <: AbstractUse end
struct UseAsObservable <: AbstractUse end

express(obj) = express(obj, QuantumOpticsRepr()) # The default representation
express(s::Number, repr::AbstractRepresentation, use::AbstractUse) = s
express(s, repr::AbstractRepresentation) = express(s, repr, UseAsState())

##
# Commonly used representations -- interfaces for each one defined in separate packages
##

"""Representation using kets, bras, density matrices, and superoperators governed by `QuantumOptics.jl`."""
Base.@kwdef struct QuantumOpticsRepr <: AbstractRepresentation
cutoff::Int = 2
end
"""Similar to `QuantumOpticsRepr`, but using trajectories instead of superoperators."""
struct QuantumMCRepr <: AbstractRepresentation end
"""Representation using tableaux governed by `QuantumClifford.jl`"""
struct CliffordRepr <: AbstractRepresentation end
2 changes: 1 addition & 1 deletion test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ end
)
)
@show rep
@test length(JET.get_reports(rep)) <= 2
@test length(JET.get_reports(rep)) <= 3
@test_broken length(JET.get_reports(rep)) == 0
end

2 comments on commit 8f8c0e2

@apkille
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/123143

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.7 -m "<description of version>" 8f8c0e209bff8d6acb2156bacf0ed5011d624111
git push origin v0.3.7

Please sign in to comment.