From b6b7c93c4a4df8389ae2f01163842557c4af58b3 Mon Sep 17 00:00:00 2001 From: mlk621-qtm <116674166+mlk621-qtm@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:53:00 -0500 Subject: [PATCH 1/2] First draft of SU(4) gate addition --- articles/provider-quantinuum.md | 61 ++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/articles/provider-quantinuum.md b/articles/provider-quantinuum.md index 657771baf..55a0e4c03 100644 --- a/articles/provider-quantinuum.md +++ b/articles/provider-quantinuum.md @@ -220,7 +220,7 @@ open Microsoft.Quantum.Intrinsic; open Microsoft.Quantum.Measurement; open Microsoft.Quantum.Arrays; -operation ContinueComputationAfterReset(theta : Double) : Result[] { +operation ArbitraryAngleZZExample(theta : Double) : Result[] { // Set up circuit with 2 qubits use qubits = Qubit[2]; @@ -271,6 +271,65 @@ circuit.measure_all() *** +### General SU(4) Entangling Gate + +Quantinuum's native gate set includes a general SU(4) entangling gate. Note that quantum circuits submitted to the hardware are rebased to the fully entangling ZZ gate and the arbitrary angle RZZ gate. Circuits are only rebased to the General SU(4) Entangling gate if users opt into it. For information on the General SU(4) Entangler in Quantinuum systems, see the H-series product data sheets on the [System Model H1] and [System Model H2] pages. + +#### [General SU(4) Gate with Q# Provider](#tab/tabid-su4-with-q-provider) + +In Q\#, the SU(4) gate is not implemented directly in a gate function, but is a gate implemented in Quantinuum's QIR profile. To implement the gate in your code in Q#, a function for the gate is first defined using a customer intrinsic matching the signature in Quantinuum's QIR profile. This is then used within the `SU4Example` operation when creating the circuit. To submit the circuit and ensure the circuit is run using the General SU(4) Entangling gate, options need to be passed to specify this. Specifically, `noreduce: True` will ensure the gates as used in the circuit are what will run on the hardware. + +```qsharp +%%qsharp +open Microsoft.Math; + +operation __quantum__qis__rxxyyzz__body(a1 : Double, a2 : Double, a3 : Double, q1 : Qubit, q2 : Qubit) : Unit { + body intrinsic; +} + +operation SU4Example() : Result[] { + use qs = Qubit[2]; + + // Add SU(4) gate + __quantum__qis__rxxyyzz__body(PI(), PI(), PI(), qs[0], qs[1]); + + MResetEachZ(qs) +} + +``` + +Now compile the operation: + +```python +MyProgram = qsharp.compile("GenerateRandomBit()") +``` + +Connect to Azure Quantum, select the target machine, and configure the noise parameters for the emulator: + +```python +MyWorkspace = azure.quantum.Workspace( + resource_id = "", + location = "" +) + +MyTarget = MyWorkspace.get_targets("quantinuum.sim.h1-1e") + +# Update TKET optimization level desired +option_params = { + "noreduce": True +} + +``` + +Pass in the `noreduce` option when submitting the job: + +```python +job = MyTarget.submit(MyProgram, "Submit a program with SU(4) gate", shots = 10, input_params = option_params) +job.get_results() +``` + +*** + ### Emulator Noise Parameters Users have the option of experimenting with the noise parameters of the Quantinuum emulators. **Only a few of the available noise parameters are highlighted** here demonstrating how to pass through the parameters in the Azure Quantum providers. From 04f8d8c449ea137712ea839516d9d9d632fa1888 Mon Sep 17 00:00:00 2001 From: mlk621-qtm <116674166+mlk621-qtm@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:15:01 -0500 Subject: [PATCH 2/2] Add General SU(4) section Edit the description and options --- articles/provider-quantinuum.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/articles/provider-quantinuum.md b/articles/provider-quantinuum.md index 55a0e4c03..484ccb1ee 100644 --- a/articles/provider-quantinuum.md +++ b/articles/provider-quantinuum.md @@ -275,9 +275,14 @@ circuit.measure_all() Quantinuum's native gate set includes a general SU(4) entangling gate. Note that quantum circuits submitted to the hardware are rebased to the fully entangling ZZ gate and the arbitrary angle RZZ gate. Circuits are only rebased to the General SU(4) Entangling gate if users opt into it. For information on the General SU(4) Entangler in Quantinuum systems, see the H-series product data sheets on the [System Model H1] and [System Model H2] pages. -#### [General SU(4) Gate with Q# Provider](#tab/tabid-su4-with-q-provider) +#### [General SU(4) Entangling Gate with Q# Provider](#tab/tabid-su4-with-q-provider) -In Q\#, the SU(4) gate is not implemented directly in a gate function, but is a gate implemented in Quantinuum's QIR profile. To implement the gate in your code in Q#, a function for the gate is first defined using a customer intrinsic matching the signature in Quantinuum's QIR profile. This is then used within the `SU4Example` operation when creating the circuit. To submit the circuit and ensure the circuit is run using the General SU(4) Entangling gate, options need to be passed to specify this. Specifically, `noreduce: True` will ensure the gates as used in the circuit are what will run on the hardware. +In Q\#, the General SU(4) Entangling gate is implemented via Quantinuum's QIR profile. To use it, define a function with a custom intrinsic matching the QIR profile signature, and use this function within the `SU4Example` operation. + +To ensure the circuit runs with the General SU(4) Entangling gate, pass the following options in the H-Series stack: + +- `nativetq: Rxxyyzz` to prevent rebasing to other native gates. +- `noreduce: True` to avoid additional compiler optimizations (optional). ```qsharp %%qsharp @@ -316,6 +321,7 @@ MyTarget = MyWorkspace.get_targets("quantinuum.sim.h1-1e") # Update TKET optimization level desired option_params = { + "nativetq": `Rxxyyzz`, "noreduce": True }