Skip to content

Commit 067b4b8

Browse files
committed
add cheat sheet
1 parent d5dfbf4 commit 067b4b8

50 files changed

Lines changed: 994 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish Cheat Sheet
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Setup Pages
30+
uses: actions/configure-pages@v5
31+
- name: Build with Jekyll
32+
uses: actions/jekyll-build-pages@v1
33+
with:
34+
source: ./doc/cheat_sheet
35+
destination: ./_site
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
39+
deploy:
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deployment.outputs.page_url }}
43+
runs-on: ubuntu-latest
44+
needs: build
45+
steps:
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

doc/cheat_sheet/LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
MIT License
2+
3+
Original (Julia cheat sheet) Copyright (c) 2015 Ian Hellström
4+
Original (Julia cheat sheet) Copyright (c) 2016 Harris Brakmic
5+
Modifications (Braket cheat sheet) Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

doc/cheat_sheet/Translation.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Translation Guide
2+
3+
TL;DR:
4+
5+
- See `_config.yml`, `index.br.html` and `_includes/`
6+
7+
The translation of this cheat-sheet requires the followings steps:
8+
9+
- Choose a tag for your language, such as `en` for English or `fr` for French;
10+
- On [`_config.yml`](_config.yml), add your tag and translate the given phrases;
11+
- Copy `index.html` to `index.TAG.html`, where TAG is your tag;
12+
- Modify `index.TAG.html`, changing `lang: TAG` and `permalink: /TAG/`;
13+
- Copy the folder `_includes/en/` to `_includes/TAG/`, i.e., create a folder `TAG`
14+
inside `_includes` with a copy of all the `.md` files; **don't change the .md names**;
15+
- On file `_data/blocks.yml`, add a ` TAG: translated title` line for each title;
16+
- Translate each block in `_includes/TAG`.
17+

doc/cheat_sheet/_config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
domain: amazon-braket.github.io
2+
title: The Fast Track to Amazon Braket
3+
description: "The Fast Track to Amazon Braket - Braket Cheat Sheet"
4+
github_username: amazon-braket
5+
markdown: kramdown
6+
7+
t:
8+
en:
9+
name: "English"
10+
fast-track: "The Fast Track to Amazon Braket"
11+
github-1: "This page's source is"
12+
github-2: "located here"
13+
github-3: "Pull requests are welcome!"
14+
github-4: "This cheat sheet is inspired by"
15+
translate: "Help translate!" # Not used for `en`
16+
fr:
17+
name: "Français"
18+
fast-track: "Aide-mémoire"
19+
github-1: "Les sources de cette page sont"
20+
github-2: "disponibles ici"
21+
github-3: "Pull Requests bienvenues !"
22+
github-4: "Cet aide-memoire est inspiré de"
23+
translate: "Aidez à traduire !" # Not used for `en`

doc/cheat_sheet/_data/blocks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
- file: What-is.md
2+
title: What is…?
3+
fr: De quoi s'agit-il ?
4+
- file: Circuits.md
5+
title: Circuits
6+
fr: Circuits
7+
- file: FreeParameters.md
8+
title: FreeParameters
9+
fr: Paramètres libres
10+
- file: Tasks.md
11+
title: Tasks
12+
fr: Tâches
13+
- file: Results.md
14+
title: Results
15+
- file: Device.md
16+
title: Device
17+
- file: DeviceProperties.md
18+
title: Device Properties
19+
- file: Pricing.md
20+
title: Pricing
21+
- file: HybridJobs.md
22+
title: Hybrid Jobs
23+
fr: Tâches
24+
- file: Simulators.md
25+
title: Simulators
26+
- file: NoiseSimulation.md
27+
title: Noise Simulation
28+
- file: LLDC.md
29+
title: Low-Level Device Control
30+
- file: AHS.md
31+
title: Analog Hamiltonian Simulation
32+
- file: ErrorMitigation.md
33+
title: Error Mitigation
34+
- file: Console.md
35+
title: Console
36+
- file: APICalls.md
37+
title: API Calls
38+
- file: QiskitProvider.md
39+
title: Qiskit Provider
40+
- file: Resources.md
41+
title: Resources
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<div id="contents">
2+
<ul>
3+
<li>
4+
{% for block in site.data.blocks %}
5+
<div class="box">
6+
<div class="title">
7+
8+
{% if page.lang == "en" %}
9+
<h1>{{ block.title }}</h1>
10+
{% elsif block[page.lang] %}
11+
<h1>{{ block[page.lang] }}</h1>
12+
{% else %}
13+
<h1>{{ block.title }} <small>({{ site.t[page.lang].translate }})</small> </h1>
14+
{% endif %}
15+
</div>
16+
{% capture this_block %}{% include {{page.lang}}/{{ block.file }} %}{% endcapture %}
17+
{{ this_block | markdownify }}
18+
</div>
19+
{% endfor %}
20+
</li>
21+
</ul>
22+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| Imports | `from braket.ahs import AtomArrangement, DrivingField, AnalogHamiltonianSimulation` |
2+
| Atom arrangement | `register = AtomArrangement()` |
3+
| Add an atom by coordinates (in meters) | `register.add((5.7e-6, 5.7e-6))` |
4+
| Get coordinates | `register.coordinate_list(axis)` |
5+
| Create a driving field | `DrivingField(amplitude, phase, detuning)` |
6+
| Create an AHS program | `ahs_program = AnalogHamiltonianSimulation(register, drive)` |
7+
| Run an AHS program | `device.run(ahs_program)` |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
| Cancel a Braket hybrid job | CancelJob |
2+
| Cancel the specified task | CancelQuantumTask |
3+
| Create a Braket hybrid job | CreateJob |
4+
| Create a quantum task | CreateQuantumTask |
5+
| Retrieve the devices available in Braket | GetDevice |
6+
| Retrieve the specified Braket hybrid job | GetJob |
7+
| Retrieve the specified quantum task | GetQuantumTask |
8+
| Show the tags associated with this resource | ListTagsForResource |
9+
| Search for devices using the specified filters | SearchDevices |
10+
| Search for Braket hybrid jobs that match the specified filter values | SearchJobs |
11+
| Search for tasks that match the specified filter values | SearchQuantumTasks |
12+
| Add a tag to the specified resource | TagResource |
13+
| Remove tags from a resource | UntagResource |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
| Imports | `from braket.circuits import Circuit, Gate, Instruction`<br>`from braket.circuits.observables import X` |
2+
| Create a circuit | `circuit = Circuit()` |
3+
| Add gates | `circuit.x(0).rx(1, 1.23).cnot(0, 1)` |
4+
| Get the list of available gates | `[attr for attr in dir(Gate) if attr[0].isupper()]` |
5+
| Apply a unitary matrix | `circuit.unitary(matrix, [0])` |
6+
| Get the circuit unitary | `circuit.to_unitary()` |
7+
| Add a result type | `circuit.probability(0)`<br>`circuit.expectation(0.5 * X() @ X(), target=[0, 1])` |
8+
| List of the available result types | adjoint_gradient, amplitude, density_matrix, expectation, probability, sample, state_vector, variance |
9+
| Add a verbatim box | `circuit.add_verbatim_box(circuit2)` |
10+
| Gate modifiers | `circuit.x(0, control=[1, 2], control_state=[0, 1], power=-0.5)` |
11+
| Draw a circuit | `print(circuit)` |
12+
| Import from OpenQASM3 | `Circuit.from_ir(source=qasm_str)` |
13+
| Export to OpenQASM3 | `Circuit.to_ir("OPENQASM")` |
14+
| Create an instruction | `inst = Instruction(Gate.CPhaseShift(1.23), target=[0, 1])` |
15+
| Add an instruction | `circuit.add(inst)` |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The console is a web interface where you can find important up-to-date information about the Braket service and the available devices.
2+
3+
| Device tab | Device summary<br>Connectivity |
4+
| Notebook | Jupyter hub |
5+
| Braket Direct | Device reservation<br>Office hours |

0 commit comments

Comments
 (0)