Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hamiltonian simulation function template #39

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/test_templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Function template tests

on:
push:
branches:
- main
- 'stable/**'
pull_request:
branches:
- main
- 'stable/**'
schedule:
- cron: '0 1 * * *'

jobs:
tests:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
include:
- os: macos-latest
python-version: 3.11
- os: windows-latest
python-version: 3.11
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Modify tox.ini for more thorough check
shell: bash
run: |
sed -i.bak -E '/#.*CI:[[:space:]]*skip-next-line/I{N;d;}' tox.ini
cat tox.ini
- name: Test using tox environment
run: tox -e templates
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ venv/
.idea/
.vscode/

/templates/hamiltonian-simulation/source_files/

# Distribution / packaging
.Python
env/
Expand Down
3 changes: 3 additions & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains examples of function template(s)

- [Hamiltonian simulation](./hamiltonian-simulation/)
19 changes: 19 additions & 0 deletions templates/hamiltonian-simulation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Hamiltonian simulation function template

The [Hamiltonian simulation function template](https://qiskit.github.io/documentation/guides/serverless-template-hamiltonian-simulation)
grew out of notebooks which are included in this directory.

It performs Hamiltonian simulation
using the [AQC-Tensor](https://github.com/Qiskit/qiskit-addon-aqc-tensor)
Qiskit addon.

### Guide to files

`hamsim_template0.ipynb`: The original Hamiltonian simulation notebook, before it was adapted to be a Function.
`hamsim_template.ipynb`: A polyglot notebook which can either be run on a user's machine or executed as a Function.
`serverless_demo.ipynb`: A notebook which converts `hamsim_template.ipynb` to a Python program and runs it in Qiskit serverless.
`hamsim_template.pregenerated.py`: The Python program generated by the above notebook.
`hw_results_aqc.pkl`: Hardware results on `ibm_fez` with AQC enabled
`hw_results_comparison.pkl`: Hardware results on `ibm_fez` of equivalent circuit, without AQC.
`requirements.txt`: Dependencies.
`test_hamsim_template.py`: Automated tests of notebook.
1,025 changes: 1,025 additions & 0 deletions templates/hamiltonian-simulation/hamsim_template.ipynb

Large diffs are not rendered by default.

Loading
Loading