-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'QuantumSavory:master' into query_docs
- Loading branch information
Showing
25 changed files
with
750 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: "Changelog Enforcer" | ||
on: | ||
pull_request: | ||
# The specific activity types are listed here to include "labeled" and "unlabeled" | ||
# (which are not included by default for the "pull_request" trigger). | ||
# This is needed to allow skipping enforcement of the changelog in PRs with specific labels, | ||
# as defined in the (optional) "skipLabels" property. | ||
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] | ||
|
||
jobs: | ||
# Enforces the update of a changelog file on every pull request | ||
changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dangoslen/changelog-enforcer@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Downgrade | ||
on: | ||
pull_request: | ||
branches: [master, main] | ||
paths-ignore: | ||
- 'docs/**' | ||
push: | ||
branches: [master, main] | ||
paths-ignore: | ||
- 'docs/**' | ||
env: | ||
PYTHON: ~ | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ['1.9'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.version }} | ||
- uses: cjdoris/julia-downgrade-compat-action@v1 | ||
with: | ||
skip: Pkg,TOML,InteractiveUtils,Random,LinearAlgebra | ||
- uses: julia-actions/cache@v1 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "QuantumSavory" | ||
uuid = "2de2e421-972c-4cb5-a0c3-999c85908079" | ||
authors = ["Stefan Krastanov <[email protected]>"] | ||
version = "0.3.2" | ||
version = "0.3.3" | ||
|
||
[deps] | ||
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" | ||
|
@@ -51,7 +51,7 @@ QuantumOpticsBase = "0.4.17" | |
QuantumSymbolics = "0.2.5" | ||
Random = "1" | ||
Reexport = "1.2.2" | ||
ResumableFunctions = "0.6.1 - 0.6.6" | ||
ResumableFunctions = "0.6" | ||
Statistics = "1" | ||
SumTypes = "0.5.1" | ||
julia = "1.9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
QuantumClifford = "0525e862-1e90-11e9-3e4d-1b39d7109de1" | ||
QuantumOptics = "6e0679c1-51ea-5a7c-ac74-d61b76210b0c" | ||
QuantumOpticsBase = "4f57444f-1401-5e15-980d-4471b28d5678" | ||
QuantumSavory = "2de2e421-972c-4cb5-a0c3-999c85908079" | ||
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
using BenchmarkTools | ||
using Pkg | ||
using StableRNGs | ||
using QuantumSavory | ||
using QuantumSavory: tag_types | ||
using QuantumOpticsBase: Ket, Operator | ||
using QuantumClifford: MixedDestabilizer | ||
|
||
const SUITE = BenchmarkGroup() | ||
|
||
rng = StableRNG(42) | ||
|
||
M = Pkg.Operations.Context().env.manifest | ||
V = M[findfirst(v -> v.name == "QuantumSavory", M)].version | ||
|
||
SUITE["register"] = BenchmarkGroup(["register"]) | ||
SUITE["register"]["creation_and_initialization"] = BenchmarkGroup(["creation_and_initialization"]) | ||
function register_creation_and_initialization() | ||
traits = [Qubit(), Qubit(), Qubit()] | ||
reg1 = Register(traits) | ||
qc_repr = [QuantumOpticsRepr(), CliffordRepr(), CliffordRepr()] | ||
reg2 = Register(traits, qc_repr) | ||
qmc_repr = [QuantumOpticsRepr(), QuantumMCRepr(), QuantumMCRepr()] | ||
reg3 = Register(traits, qmc_repr) | ||
net = RegisterNet([reg1, reg2, reg3]) | ||
|
||
i = 1 | ||
initialize!(net[i,2]) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
initialize!(net[i,3],X1) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
apply!([net[i,2], net[i,3]], CNOT) | ||
@assert net[i].staterefs[2].state[] isa Ket | ||
@assert nsubsystems(net[i].staterefs[2]) == 2 | ||
|
||
i = 2 | ||
initialize!(net[i,2]) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
initialize!(net[i,3],X1) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
apply!([net[i,2], net[i,3]], CNOT) | ||
@assert net[i].staterefs[2].state[] isa MixedDestabilizer | ||
@assert nsubsystems(net[i].staterefs[2]) == 2 | ||
|
||
i = 3 | ||
initialize!(net[i,2]) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
initialize!(net[i,3],X1) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
apply!([net[i,2], net[i,3]], CNOT) | ||
@assert net[i].staterefs[2].state[] isa Ket | ||
@assert nsubsystems(net[i].staterefs[2]) == 2 | ||
|
||
## | ||
# with backgrounds | ||
traits = [Qubit(), Qubit(), Qubit()] | ||
backgrounds = [T2Dephasing(1.0),T2Dephasing(1.0),T2Dephasing(1.0)] | ||
reg1 = Register(traits, backgrounds) | ||
qc_repr = [QuantumOpticsRepr(), CliffordRepr(), CliffordRepr()] | ||
reg2 = Register(traits, qc_repr, backgrounds) | ||
qmc_repr = [QuantumOpticsRepr(), QuantumMCRepr(), QuantumMCRepr()] | ||
reg3 = Register(traits, qmc_repr, backgrounds) | ||
net = RegisterNet([reg1, reg2, reg3]) | ||
|
||
i = 1 | ||
initialize!(net[i,2], time=1.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
initialize!(net[i,3],X1, time=2.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
apply!([net[i,2], net[i,3]], CNOT, time=3.0) | ||
@assert net[i].staterefs[2].state[] isa Operator | ||
@assert nsubsystems(net[i].staterefs[2]) == 2 | ||
|
||
i = 2 | ||
initialize!(net[i,2], time=1.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
initialize!(net[i,3],X1, time=2.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
apply!([net[i,2], net[i,3]], CNOT, time=3.0) | ||
@assert net[i].staterefs[2].state[] isa MixedDestabilizer | ||
@assert nsubsystems(net[i].staterefs[2]) == 2 | ||
|
||
i = 3 | ||
initialize!(net[i,2], time=1.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
initialize!(net[i,3],X1, time=2.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 1 | ||
apply!([net[i,2], net[i,3]], CNOT, time=3.0) | ||
@assert nsubsystems(net[i].staterefs[2]) == 2 | ||
end | ||
SUITE["register"]["creation_and_initialization"]["from_tests"] = @benchmarkable register_creation_and_initialization() | ||
|
||
SUITE["tagquery"] = BenchmarkGroup(["tagquery"]) | ||
SUITE["tagquery"]["misc"] = BenchmarkGroup(["misc"]) | ||
function tagquery_interfacetest() | ||
r = Register(10) | ||
tag!(r[1], :symbol1, 2, 3) | ||
tag!(r[2], :symbol1, 4, 5) | ||
tag!(r[5], Int, 4, 5) | ||
|
||
@assert Tag(:symbol1, 2, 3) == tag_types.SymbolIntInt(:symbol1, 2, 3) | ||
@assert query(r, :symbol1, 4, ❓) == (slot=r[2], tag=tag_types.SymbolIntInt(:symbol1, 4, 5)) | ||
@assert query(r, :symbol1, 4, 5) == (slot=r[2], tag=tag_types.SymbolIntInt(:symbol1, 4, 5)) | ||
@assert query(r, :symbol1, ❓, ❓) == (slot=r[1], tag=tag_types.SymbolIntInt(:symbol1, 2, 3)) | ||
@assert query(r, :symbol2, ❓, ❓) == nothing | ||
@assert query(r, Int, 4, 5) == (slot=r[5], tag=tag_types.TypeIntInt(Int, 4, 5)) | ||
@assert query(r, Float32, 4, 5) == nothing | ||
@assert query(r, Int, 4, >(5)) == nothing | ||
@assert query(r, Int, 4, <(6)) == (slot=r[5], tag=tag_types.TypeIntInt(Int, 4, 5)) | ||
|
||
@assert queryall(r, :symbol1, ❓, ❓) == [(slot=r[1], tag=tag_types.SymbolIntInt(:symbol1, 2, 3)), (slot=r[2], tag=tag_types.SymbolIntInt(:symbol1, 4, 5))] | ||
@assert isempty(queryall(r, :symbol2, ❓, ❓)) | ||
|
||
@assert query(r[2], Tag(:symbol1, 4, 5)) == (depth=1, tag=Tag(:symbol1, 4, 5)) | ||
@assert queryall(r[2], Tag(:symbol1, 4, 5)) == [(depth=1, tag=Tag(:symbol1, 4, 5))] | ||
@assert query(r[2], :symbol1, 4, 5) == (depth=1, tag=Tag(:symbol1, 4, 5)) | ||
@assert queryall(r[2], :symbol1, 4, 5) == [(depth=1, tag=Tag(:symbol1, 4, 5))] | ||
|
||
@assert query(r[2], :symbol1, 4, ❓) == (depth=1, tag=Tag(:symbol1, 4, 5)) | ||
@assert queryall(r[2], :symbol1, 4, ❓) == [(depth=1, tag=Tag(:symbol1, 4, 5))] | ||
|
||
@assert querydelete!(r[2], :symbol1, 4, ❓) == Tag(:symbol1, 4, 5) | ||
@assert querydelete!(r[2], :symbol1, 4, ❓) === nothing | ||
end | ||
SUITE["tagquery"]["misc"]["from_tests"] = @benchmarkable tagquery_interfacetest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.