Skip to content

Commit

Permalink
Merge branch 'main' into rmshaffer/release-v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rmshaffer authored Sep 24, 2024
2 parents 6331869 + d24ca7f commit 29d4050
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # release/v1
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # release/v1
12 changes: 6 additions & 6 deletions doc/decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This decorator marks the entry point to a quantum program.

You can include gates, pulse control, classical control and subroutine calls. The function wrapped by `@aq.main` is converted into a `Program` object. The `Program` object can be executed on [devices available through Amazon Braket](https://docs.aws.amazon.com/braket/latest/developerguide/braket-devices.html), including local simulators. The code snippet below creates a quantum program with `@aq.main` and runs it on the `Device` instantiated as `device`.

```
```python
size = 5

@aq.main(num_qubits=size)
Expand All @@ -26,7 +26,7 @@ device.run(ghz_state)

When you run your quantum program, the Amazon Braket SDK automatically serializes the program to OpenQASM before sending it to the local simulator or the Amazon Braket service. In AutoQASM, you can optionally view the OpenQASM script of your quantum program before submitting to a device by calling `build()` on the MainProgram object, and calling `display()` on the resulting `Program` object.

```
```python
ghz_state.build().display()
```

Expand All @@ -39,7 +39,7 @@ Like any subroutine, `@aq.subroutine` is often used to simplify repeated code an
Because AutoQASM supports strongly-typed serialization formats such as OpenQASM, you must provide type hints for the inputs of your subroutine definitions.

Our example below uses a subroutine to make Bell states on two pairs of qubits.
```
```python
@aq.subroutine
def bell(q0: int, q1: int) -> None:
h(q0)
Expand Down Expand Up @@ -72,7 +72,7 @@ Gate definitions define higher-level gates in terms of other gates, and are ofte

The body of a gate definition can only contain gates. Qubits used in the body of a gate definition must be passed as input arguments, with the type hint `aq.Qubit`. Like subroutines, a gate definition must be called from within the context of a main quantum program or subroutine in order to be included in the program.

```
```python
@aq.gate
def ch(q0: aq.Qubit, q1: aq.Qubit):
"""Define a controlled-Hadamard gate."""
Expand Down Expand Up @@ -100,7 +100,7 @@ Every qubit and angle parameter of the gate being implemented must appear either

For example, the gate `rx` takes two arguments, target and theta. Each arguments must be either set in the decorator or declared as an input parameter to the decorated function.

```
```python
# This calibration only applies to physical qubit zero, so we
# mark that in the decorator call
@aq.gate_calibration(implements=rx, target="$0")
Expand All @@ -116,7 +116,7 @@ def cal_1(theta: float):

To add the gate calibration to your program, use the `with_calibrations` method of the main program.

```
```python
@aq.main
def my_program():
rx("$0", 0.123)
Expand Down
6 changes: 3 additions & 3 deletions doc/hybrid_jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Amazon Braket Hybrid Jobs provides a solution for executing hybrid quantum-class
## Using `AwsQuantumJob.create`

This [documentation page](https://docs.aws.amazon.com/braket/latest/developerguide/braket-jobs-first.html#braket-jobs-first-create) shows you how to create a hybrid job with `AwsQuantumJob.create`. To use a hybrid job with AutoQASM, simply use AutoQASM in your algorithm script. Because AutoQASM is currently not installed in the default job container, be sure to include AutoQASM in the requirements.txt of your source module, or add AutoQASM as a dependency when you build your own container. Below is an example algorithm script to get you started.
```
```python
import os

from braket.devices import LocalSimulator
Expand Down Expand Up @@ -34,7 +34,7 @@ def start_here():
```

Save this algorithm script as "algorithm_script.py" in a folder called "source_module" and run this code snippet below to create your first hybrid job with AutoQASM!
```
```python
from braket.aws import AwsQuantumJob

job = AwsQuantumJob.create(
Expand All @@ -52,7 +52,7 @@ Alternatively, you can use the `@aq.hybrid_job` decorator to create a hybrid job
One of the core mechanisms of AutoQASM is source code analysis. When calling an AutoQASM decorated function, the source code of the function is analyzed and converted into a transformed Python function by AutoGraph. With the the `@aq.hybrid_job` decorator, the source code of a function defined inside the `@aq.hybrid_job` decorated function is separately saved as input data to the job. When [AutoQASM decorators](decorators.md) wrap these functions, the source code is retrieved from the input data. Because of this, if you use an AutoQASM decorator to convert a function that is defined outside of the `@aq.hybrid_job` decorated function, it may not work properly. If your application requires AutoQASM decorated functions to be defined outside of the `@aq.hybrid_job` decorated function, we recommend that you use the option described in the "Using `AwsQuantumJob.create`" section above to create the hybrid job.

Below is a working example to create an AutoQASM job with the `@aq.hybrid_job` decorator.
```
```python
from braket.devices import LocalSimulator

import autoqasm as aq
Expand Down

0 comments on commit 29d4050

Please sign in to comment.