Skip to main content

Python tools for Jaqal

Project description

JaqalPaq

JaqalPaq

JaqalPaq is a python package used to parse, manipulate, emulate, and generate quantum assembly code written in Jaqal (Just another quantum assembly language). JaqalPaq can be installed with optional transpilers that convert code written in other quantum assembly languages to a version of Jaqal whose native gates are relevant for QSCOUT (Quantum Scientific Computing Open User Testbed).

Installation

JaqalPaq is available on GitLab. The installation instructions describe the recommended install process, but a minimal installation can be performed with the package manager pip:

pip install jaqalpaq

JaqalPaq includes an emulator that can provide measurement probabilities for any native gate set. However, we only currently support the native operations of QSCOUT, which are modeled as pure-state preparations, unitary transformations, and destructive measurements. This is available on Gitlab in the QSCOUT Gate Models repository.

Refer to the INSTALL.md for complete instruction on how to enable this capability, as well as others, such as transpilation to other quantum languages.

Usage

The following simple example is from examples/usage_example.py

import jaqalpaq
from jaqalpaq.parser import parse_jaqal_file
from jaqalpaq.emulator import run_jaqal_circuit
from jaqalpaq.generator import generate_jaqal_program

JaqalCircuitObject = parse_jaqal_file("jaqal/Sxx_circuit.jaqal")
JaqalCircuitResults = run_jaqal_circuit(JaqalCircuitObject)
print(f"Probabilities: {JaqalCircuitResults.subcircuits[0].probability_by_str}")
JaqalProgram = generate_jaqal_program(JaqalCircuitObject)

The Jaqal file processed by this example, examples/jaqal/Sxx_circuit.jaqal, is

from qscout.v1.std usepulses *

register q[2]

prepare_all
Sxx q[1] q[0]
measure_all

More extensive examples, including detailed Jupyter notebooks implementing the variational quantum eigensolver (VQE) quantum algorithm for some simple molecules, can be found in the examples directory.

For information on the JaqalPaq emulator's command-line interface, run the following in your shell:

jaqal-emulate --help

Documentation

Online documentation is hosted on Read the Docs.

License

Apache 2.0

Questions?

For help and support, please contact qscout@sandia.gov.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

test-JaqalPaq-0.0.0.1.0.0rc2.tar.gz (357.9 kB view hashes)

Uploaded Source

Built Distribution

test_JaqalPaq-0.0.0.1.0.0rc2-py2.py3-none-any.whl (395.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page