Skip to main content

DQCsim cQASM frontend

PyPi

See also: DQCsim and libqasm.

This repository contains some glue code to allow DQCsim to run cQASM files (file extension *.cq).

Status

The implementation is currently incomplete. The following things are missing:

  • The error model specified in the cQASM file is ignored. You'll have to configure stuff related to error modeling yourself through the respective simulation backend and/or operators.

  • measure_parity is not implemented.

Install

You can install using pip using pip install dqcsim-cqasm or equivalent. If you're installing with --user, make sure that the path Python installs the executables into is in your system path, otherwise DQCsim will not be able to find the plugin. A simple way to see where the files are installed is to run pip uninstall dqcsim-cqasm; it shows which files it's about to delete before querying for confirmation.

Building/installing from source

  • Make sure all git submodules are checked out: git submodule update --init --recursive

  • Build the wheel file locally: python3 setup.py build bdist_wheel

  • Install the wheel file you just built: pip install target/python/dist/* (or equivalent)

Don't push a build like this to PyPI or attempt to distribute this wheel; it will likely only work locally due to hardcoded paths and the likes. Refer to release.md for more info.

Usage

Once the plugin is installed, DQCsim will parse any file with a .cq file extension as a cQASM file through this plugin, so something like dqcsim test.cq qx should work (assuming dqcsim-qx is installed and test.cq exists).

The frontend ignores any arguments passed to its run callback and doesn't have anything useful to return (it just echoes back what you passed it).

As with QX, the display_binary "gate" is used to print simulation results to the terminal by means of printing the most recent measurement state. The frontend also outputs the measurement register contents at the end of the program as the ArbData returned by the run() call, in the following format:

{
    "qubits": [
        {  /* data for qubit 0 */
            "value": <value in qubit measurement register as 0 or 1>,
            "average": <measurement averaging register value>,
            "raw": <raw value returned by backend; 0 or 1, or null for undefined>,
            "json": <JSON part of the optional ArbData associated with the measurement>,
            "binary": [
                [<bytes of binary string 0 of ArbData associated with measurement>],
                [<bytes of binary string 1>],
                <etc., empty list if no ArbData>
            ]
        },
        {<data for qubit 1>},
        {<data for qubit 2>},
        <etc. for all qubits>
    ]
}

The raw, json, and binary keys are not present when the qubit was never measured at all. value defaults to 0 in that case. average is only present when the qubit has been measured since the latest reset_averaging operation.

The display "gate" doesn't provide any additional information over display_binary, as DQCsim frontends don't know what the actual quantum state is; this information is private to the backend. Refer to the documentation of the backend for ways to get additional information, if any. Be aware that DQCsim's qubit numbering starts at one, so the cQASM frontend adds 1 to the zero-referenced cQASM qubit indices to convert.

There is currently no way to attach arbs to gates or to the qubits themselves. If you need to do this, you can write an operator and insert it immediately behind the cQASM frontend.

Metadata

Release files for dqcsim-cqasm 0.0.3

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

Built distributions (wheels)

Table of built distributions (wheels) for dqcsim-cqasm 0.0.3
File
dqcsim_cqasm-0.0.3-cp38-none-manylinux2010_x86_64.whl CPython 3.8 none Linux glibc 2.12+ x86-64 Details
dqcsim_cqasm-0.0.3-cp37-none-manylinux2010_x86_64.whl CPython 3.7 none Linux glibc 2.12+ x86-64 Details
dqcsim_cqasm-0.0.3-cp36-none-manylinux2010_x86_64.whl CPython 3.6 none Linux glibc 2.12+ x86-64 Details
dqcsim_cqasm-0.0.3-cp35-none-manylinux2010_x86_64.whl CPython 3.5 none Linux glibc 2.12+ x86-64 Details

Total release size: 1.0 MB

Release files / dqcsim_cqasm-0.0.3-cp38-none-manylinux2010_x86_64.whl

Download URL dqcsim_cqasm-0.0.3-cp38-none-manylinux2010_x86_64.whl
Size 258.8 kB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
d4eabe22613a8a478aa1c0cf48a1a6ef56647268bd8f235b048e5429fa960f57
BLAKE2b-256 checksum
How to use checksums
4a10286efc58cc4667b8daa6bd64a6c1f26da5d63d7253041bf45b87a23303c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / dqcsim_cqasm-0.0.3-cp37-none-manylinux2010_x86_64.whl

Download URL dqcsim_cqasm-0.0.3-cp37-none-manylinux2010_x86_64.whl
Size 258.8 kB
Tags CPython 3.7 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
13e99dd326d8649009fbfb3ab2644b67d122aa944ef5177729e6ed529a52ccf5
BLAKE2b-256 checksum
How to use checksums
377bafe07f40c3bcc74bafee353e30029ed0acca298c289fd272e38c68b2c28b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / dqcsim_cqasm-0.0.3-cp36-none-manylinux2010_x86_64.whl

Download URL dqcsim_cqasm-0.0.3-cp36-none-manylinux2010_x86_64.whl
Size 258.8 kB
Tags CPython 3.6 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
f085e66a3ac7dac746c402af29ec9b448521d1f9f7f1511af431da3d29152f9d
BLAKE2b-256 checksum
How to use checksums
69761f6e1b066270621b2e83838aadbcec56bfeb8e475375f2b93d14c64b1b53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / dqcsim_cqasm-0.0.3-cp35-none-manylinux2010_x86_64.whl

Download URL dqcsim_cqasm-0.0.3-cp35-none-manylinux2010_x86_64.whl
Size 258.8 kB
Tags CPython 3.5 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
d0930a7bef16516d8347a690a516c0beea02157bdd1ecf41799eee82baed9d6c
BLAKE2b-256 checksum
How to use checksums
2dafce153359022b95b588d25a2e1a4dcdd0125e6ce004e58e7b7ae224df307b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.0.3 This release

4 release files

0.0.2

4 release files

0.0.1

4 release files

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