-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Add Reset, Barrier, Delay, and bump deps (#104)
* feature: Add Reset, Barrier, Delay, and bump deps * fix: Doc ref * fix: doctests * fix: More coverage * fix: even more tests for coverage
- Loading branch information
1 parent
81486d8
commit 2efe7c3
Showing
12 changed files
with
197 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Braket" | ||
uuid = "19504a0f-b47d-4348-9127-acc6cc69ef67" | ||
authors = ["Katharine Hyatt <[email protected]>"] | ||
version = "0.9.4" | ||
version = "0.9.5" | ||
|
||
[deps] | ||
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc" | ||
|
@@ -33,7 +33,7 @@ Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" | |
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" | ||
|
||
[compat] | ||
AWS = "=1.91.0" | ||
AWS = "=1.92.0" | ||
AWSS3 = "=0.11.2" | ||
Aqua = "=0.8" | ||
AxisArrays = "=0.4.7" | ||
|
@@ -50,20 +50,20 @@ Downloads = "1" | |
Graphs = "=1.11.2" | ||
HTTP = "=1.10.8" | ||
InteractiveUtils = "1.6" | ||
JLD2 = "=0.4.51" | ||
JLD2 = "=0.5.4" | ||
JSON3 = "=1.14.0" | ||
LinearAlgebra = "1.6" | ||
Logging = "1.6" | ||
Markdown = "=0.7.5" | ||
Mocking = "=0.7.9" | ||
Mocking = "=0.8.1" | ||
NamedTupleTools = "=0.14.3" | ||
OrderedCollections = "=1.6.3" | ||
Pkg = "1.6" | ||
Random = "1.6" | ||
SparseArrays = "1.6" | ||
StaticArrays = "=1.9.7" | ||
Statistics = "1.6" | ||
StructTypes = "=1.10.0" | ||
StructTypes = "=1.11.0" | ||
Tar = "1.9.3" | ||
Test = "1.6" | ||
UUIDs = "1.6" | ||
|
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 = "PyBraket" | ||
uuid = "e85266a6-1825-490b-a80e-9b9469c53660" | ||
authors = ["Katharine Hyatt <[email protected]>"] | ||
version = "0.9.4" | ||
version = "0.9.5" | ||
|
||
[deps] | ||
Braket = "19504a0f-b47d-4348-9127-acc6cc69ef67" | ||
|
@@ -14,13 +14,13 @@ StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" | |
|
||
[compat] | ||
Aqua = "=0.8" | ||
Braket = "=0.9.4" | ||
Braket = "=0.9.5" | ||
CondaPkg = "=0.2.23" | ||
DataStructures = "=0.18.20" | ||
LinearAlgebra = "1.6" | ||
PythonCall = "=0.9.22" | ||
Statistics = "1" | ||
StructTypes = "=1.10.0" | ||
StructTypes = "=1.11.0" | ||
Test = "1.6" | ||
julia = "1.6" | ||
|
||
|
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
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,53 @@ | ||
using Braket, Braket.Dates, Test | ||
using Braket: Instruction, VIRTUAL, PHYSICAL, OpenQASMSerializationProperties | ||
|
||
@testset "Barrier, reset, and delay operators" begin | ||
@test Barrier() isa Braket.QuantumOperator | ||
@test Reset() isa Braket.QuantumOperator | ||
@test Braket.Parametrizable(Reset()) == Braket.NonParametrized() | ||
@test Braket.Parametrizable(Barrier()) == Braket.NonParametrized() | ||
@test Braket.Parametrizable(Delay(Microsecond(200))) == Braket.NonParametrized() | ||
@test qubit_count(Reset()) == 1 | ||
@test qubit_count(Barrier()) == 1 | ||
circ = Circuit([(H, 0), (CNot, 0, 1)]) | ||
circ = barrier(circ, 0) | ||
@test circ.instructions == [Instruction{H}(H(), QubitSet(0)), Instruction{CNot}(CNot(), QubitSet(0, 1)), Instruction{Barrier}(Barrier(), QubitSet(0))] | ||
circ = Circuit([(H, 0), (CNot, 0, 1)]) | ||
circ = reset(circ, 0) | ||
@test circ.instructions == [Instruction{H}(H(), QubitSet(0)), Instruction{CNot}(CNot(), QubitSet(0, 1)), Instruction{Reset}(Reset(), QubitSet(0))] | ||
circ = Circuit([(H, 0), (CNot, 0, 1)]) | ||
circ = delay(circ, Nanosecond(10), 0) | ||
@test circ.instructions == [Instruction{H}(H(), QubitSet(0)), Instruction{CNot}(CNot(), QubitSet(0, 1)), Instruction{Delay}(Delay(Nanosecond(10)), QubitSet(0))] | ||
@test qubit_count(Delay(Microsecond(200))) == 1 | ||
@test Delay(Microsecond(200)) isa Braket.QuantumOperator | ||
@testset "Equality" for t in (Barrier, Reset) | ||
t1 = t() | ||
t2 = t() | ||
non_t = Measure() | ||
@test t1 == t2 | ||
@test t1 != non_t | ||
end | ||
@test Delay(Nanosecond(10)) != Delay(Microsecond(10)) | ||
@test Delay(Nanosecond(10_000)) == Delay(Microsecond(10)) | ||
@test Braket.chars(Barrier()) == ("Barrier",) | ||
@test Braket.chars(Reset()) == ("Reset",) | ||
@test Braket.chars(Delay(Nanosecond(4))) == ("Delay(4ns)",) | ||
@test Braket.chars(Delay(Microsecond(4))) == ("Delay(4ms)",) | ||
@testset "To IR" for (t, str) in ((Barrier(), "barrier"), | ||
(Reset(), "reset"), | ||
(Delay(Second(1)), "delay[1s]"), | ||
) | ||
@testset "Invalid ir_type $ir_type" for (ir_type, message) in ((:JAQCD, "$str instructions are not supported with JAQCD."), | ||
) | ||
@test_throws ErrorException(message) ir(t, QubitSet([0]), Val(ir_type)) | ||
end | ||
@testset "OpenQASM, target $target, serialization properties $sps" for (target, sps, expected_ir) in ( | ||
([0], OpenQASMSerializationProperties(qubit_reference_type=VIRTUAL), "$str q[0];"), | ||
([4], OpenQASMSerializationProperties(qubit_reference_type=PHYSICAL), "$str \$4;"), | ||
) | ||
|
||
|
||
@test ir(Instruction(t, target), Val(:OpenQASM); serialization_properties=sps) == expected_ir | ||
end | ||
end | ||
end |
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
2efe7c3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
2efe7c3
There was a problem hiding this comment.
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/116776
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.
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:
2efe7c3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register subdir=PyBraket
2efe7c3
There was a problem hiding this comment.
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/116777
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.
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:
Also, note the warning: Version 0.9.5 skips over 0.9.3
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.