Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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).

Code

JaqalPaq is available on GitLab under the Apache 2.0 License.

Installation

TLDR: Inside a venv/conda env:

pip install Cython numpy
pip install ipykernel JaqalPaq[pygsti-integration] QSCOUT-gatemodels
ipython kernel install --user --name=jaqal

Step 0: Prepare base dependencies

JaqalPaq requires Python 3.6 (or later), but Python 3.7 (or later) is recommended. To check your installed version, run

python3 --version

Windows users are encouraged to install under WSL2. You may also consider conda, which provides a platform-independent Python installation.

We also recommend having Python headers installed. Check for headers by running

python3-config --includes

On apt-based systems, headers can be installed by running (as root)

apt install python3-dev

On rpm-based ones,

yum install python3-devel

Mac users may need to install XCode to ensure they have a functional C++ compiler.

Conda users should have these header files installed automatically.

WARNING: JaqalPaq's dependencies may sometimes conflict with each other. Upgrading may introduce incompatible versions, and for this reason we STRONGLY recommend installing within some kind of virtual environment.

To create a Python virtual environment, run

python3 -m venv /path/to/venv

The location of the venv is left to your discretion, but please be aware that a full installation will be ~100s of megabytes.

To create a conda virtual environment, run

conda create --name your-preferred-name python=3.9

To enter the virtual environment, run

source /path/to/venv/bin/activate

or

conda activate your-preferred-name

respectively.

NOTE: All following steps should be performed inside the virtual environment. If you close your terminal, you will have to enter the virtual environment again, using the appropriate command above.

Jupyter users can install a kernel to access this virtual environment by running

pip install ipykernel
ipython kernel install --user --name=preferred-name

NOTE: Restart the Jupyter server. A new kernel will be available.

If you no longer want that kernel, you can remove it with

jupyter kernelspec remove pip-jaqal

NOTE: Unlike every other command, this must be performed from the environment in which Jupyter is installed, and NOT the JaqalPaq environment.

JaqalPaq includes an emulator that can provide measurement probabilities for any native gate set. This capability requires pyGSTi, which pre-depends on Cython and numpy:

pip install Cython numpy

NOTE: pyGSTi will produce warnings if you do not have Python development headers installed as recommended in Step 0.

Step 3: Install JaqalPaq

JaqalPaq packages are provided with pip.

WARNING: Some dependencies may conflict with each other. Be sure to include all desired dependencies on this line. It is safe to re-run the whole command with a new desired feature set.

pip install JaqalPaq'[pygsti-integration,notebooks]' QSCOUT-gatemodels \
    JaqalPaq-extras'[qiskit,pyquil,cirq,projectq,pytket,tutorial]'
  • pygsti-integration provides the emulator.
  • notebooks installs all dependencies for the chemistry example notebook
  • QSCOUT-gatemodels provides the native gates of the QSCOUT project , which are modeled as pure-state preparations, unitary transformations, and destructive measurements. See QSCOUT-gatemodels for details.
  • The five transpiler targets for JaqalPaq-extras each install a compatible version of the respective third-party package.
  • tutorial installs an additional dependency required for the JaqalPaq-extras tutorial notebook to run.

NOTE: The notebooks, qiskit, pyquil, cirq, projectq, pytket, and tutorial targets will install a large number of third-party packages. You should consider only installing the subset of these packages that you plan on using.

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

Testing and examples

Underneath your environment prefix, navigate to share/jaqalpaq. Inside a venv, run

cd "$VIRTUAL_ENV/share/jaqalpaq"

or, inside a conda environment,

cd "$CONDA_PREFIX/share/jaqalpaq"

Example Jaqal files, as well as tutorials and example quantum chemistry calculations are in the examples/ directory. To run the tests, first install pytest,

pip install pytest

and then run it on the tests/ directory:

pytest tests

Documentation

Online documentation is hosted on Read the Docs.

License

Apache 2.0

Questions?

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

Metadata

Release files for test-JaqalPaq 0.0.1.1.0.0rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-JaqalPaq 0.0.1.1.0.0rc2
File Size Uploaded Provenance Actions
test-JaqalPaq-0.0.1.1.0.0rc2.tar.gz 387.8 kB Without provenance Details for test-JaqalPaq-0.0.1.1.0.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for test-JaqalPaq 0.0.1.1.0.0rc2
File Interpreter ABI Platform Actions
test_JaqalPaq-0.0.1.1.0.0rc2-py2.py3-none-any.whl Python 3, Python 2 none any Details for test_JaqalPaq-0.0.1.1.0.0rc2-py2.py3-none-any.whl

Total release size: 825.1 kB

Release files / test-JaqalPaq-0.0.1.1.0.0rc2.tar.gz

Download URL test-JaqalPaq-0.0.1.1.0.0rc2.tar.gz
Size 387.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cb5d87afa642af6feb79220e1063df8a4b759036300363d214850260181be055
BLAKE2b-256 checksum
How to use checksums
50205393bf8d2692866687d29e5c243dbd3a56424f6923510671d035cba3e470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / test_JaqalPaq-0.0.1.1.0.0rc2-py2.py3-none-any.whl

Download URL test_JaqalPaq-0.0.1.1.0.0rc2-py2.py3-none-any.whl
Size 437.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d54ecbf27840660e5690a8f50021a050669860b5852e0a1635961675b6bdfb0a
BLAKE2b-256 checksum
How to use checksums
1de5fb3e50c06064d11963328a93cc1ec164fd4d0e6e23a87ce4db9a299e46ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Security for test-JaqalPaq 0.0.1.1.0.0rc2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page