Skip to content

Commit

Permalink
feat!: update measurement and alloc operations (#702)
Browse files Browse the repository at this point in the history
Closes #691 Closes #692 Closes #693

- Add TryQAlloc and MeasureFree to "tket2.quantum"
- Lower new ops to "tket2.hseries"
- Add MeasureReset to "tket2.hseries"

BREAKING CHANGE: hseries qalloc op replaced with fallible TryQalloc

---------

Co-authored-by: Alec Edgington <54802828+cqc-alec@users.noreply.github.com>
  • Loading branch information
ss2165 and cqc-alec authored Dec 2, 2024
1 parent cf73825 commit a7a0201
Show file tree
Hide file tree
Showing 10 changed files with 297 additions and 77 deletions.
87 changes: 60 additions & 27 deletions tket2-exts/src/tket2_exts/data/tket2/hseries.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "0.2.0",
"name": "tket2.hseries",
"extension_reqs": [
"arithmetic.float.types",
Expand All @@ -12,7 +12,7 @@
"LazyMeasure": {
"extension": "tket2.hseries",
"name": "LazyMeasure",
"description": "LazyMeasure",
"description": "Lazily measure a qubit and lose it.",
"signature": {
"params": [],
"body": {
Expand Down Expand Up @@ -50,7 +50,31 @@
"Measure": {
"extension": "tket2.hseries",
"name": "Measure",
"description": "Measure",
"description": "Measure a qubit and lose it.",
"signature": {
"params": [],
"body": {
"input": [
{
"t": "Q"
}
],
"output": [
{
"t": "Sum",
"s": "Unit",
"size": 2
}
],
"extension_reqs": []
}
},
"binary": false
},
"MeasureReset": {
"extension": "tket2.hseries",
"name": "MeasureReset",
"description": "Measure a qubit and reset it to the Z |0> eigenstate.",
"signature": {
"params": [],
"body": {
Expand All @@ -77,7 +101,7 @@
"PhasedX": {
"extension": "tket2.hseries",
"name": "PhasedX",
"description": "PhasedX",
"description": "PhasedX gate.",
"signature": {
"params": [],
"body": {
Expand Down Expand Up @@ -110,28 +134,10 @@
},
"binary": false
},
"QAlloc": {
"extension": "tket2.hseries",
"name": "QAlloc",
"description": "QAlloc",
"signature": {
"params": [],
"body": {
"input": [],
"output": [
{
"t": "Q"
}
],
"extension_reqs": []
}
},
"binary": false
},
"QFree": {
"extension": "tket2.hseries",
"name": "QFree",
"description": "QFree",
"description": "Free a qubit (lose track of it).",
"signature": {
"params": [],
"body": {
Expand All @@ -149,7 +155,7 @@
"Reset": {
"extension": "tket2.hseries",
"name": "Reset",
"description": "Reset",
"description": "Reset a qubit to the Z |0> eigenstate.",
"signature": {
"params": [],
"body": {
Expand All @@ -171,7 +177,7 @@
"Rz": {
"extension": "tket2.hseries",
"name": "Rz",
"description": "Rz",
"description": "Rotate a qubit around the Z axis. Not physical.",
"signature": {
"params": [],
"body": {
Expand All @@ -197,10 +203,37 @@
},
"binary": false
},
"TryQAlloc": {
"extension": "tket2.hseries",
"name": "TryQAlloc",
"description": "Allocate a qubit in the Z |0> eigenstate.",
"signature": {
"params": [],
"body": {
"input": [],
"output": [
{
"t": "Sum",
"s": "General",
"rows": [
[],
[
{
"t": "Q"
}
]
]
}
],
"extension_reqs": []
}
},
"binary": false
},
"ZZMax": {
"extension": "tket2.hseries",
"name": "ZZMax",
"description": "ZZMax",
"description": "Maximally entangling ZZ gate.",
"signature": {
"params": [],
"body": {
Expand Down Expand Up @@ -228,7 +261,7 @@
"ZZPhase": {
"extension": "tket2.hseries",
"name": "ZZPhase",
"description": "ZZPhase",
"description": "ZZ gate with an angle.",
"signature": {
"params": [],
"body": {
Expand Down
59 changes: 58 additions & 1 deletion tket2-exts/src/tket2_exts/data/tket2/quantum.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "0.1.1",
"name": "tket2.quantum",
"extension_reqs": [],
"types": {},
Expand Down Expand Up @@ -214,6 +214,33 @@
},
"binary": false
},
"MeasureFree": {
"extension": "tket2.quantum",
"name": "MeasureFree",
"description": "MeasureFree",
"misc": {
"commutation": []
},
"signature": {
"params": [],
"body": {
"input": [
{
"t": "Q"
}
],
"output": [
{
"t": "Sum",
"s": "Unit",
"size": 2
}
],
"extension_reqs": []
}
},
"binary": false
},
"QAlloc": {
"extension": "tket2.quantum",
"name": "QAlloc",
Expand Down Expand Up @@ -544,6 +571,36 @@
},
"binary": false
},
"TryQAlloc": {
"extension": "tket2.quantum",
"name": "TryQAlloc",
"description": "TryQAlloc",
"misc": {
"commutation": []
},
"signature": {
"params": [],
"body": {
"input": [],
"output": [
{
"t": "Sum",
"s": "General",
"rows": [
[],
[
{
"t": "Q"
}
]
]
}
],
"extension_reqs": []
}
},
"binary": false
},
"X": {
"extension": "tket2.quantum",
"name": "X",
Expand Down
Loading

0 comments on commit a7a0201

Please sign in to comment.