Skip to main content

python tools for isQ

Project description

isqtools

The isqtools is the Python interface for isQ – a high-level quantum programming language developed by Arclight Quantum. The isqtools library facilitates interaction with isQ, enabling users to construct, analyze, and execute quantum programs seamlessly within Python.

Features

  • Integration with isQ
  • Quantum Circuit Construction and Simulation
  • Support for Quantum Machine Learning

Prerequisites

Before using isqtools, ensure the following requirements are met:

Requirements:

Additional Requirements:

Installation

To get started with isqtools, we recommend downloading the source code and installing it using pip. Follow these steps:

  1. Clone the repository or download the source code.
  2. Navigate to the project directory.
  3. Run the following command to install:
pip install .

Usage

Here is an example workflow for using isqtools:

Step 1: Create an isQ File

First, create an isQ file (e.g., example.isq) with the following content:

import std;

qbit q[2];

procedure main() {
    H(q[0]);
    H(q[1]);
    M(q[0]);
    M(q[1]);
}

This file defines a simple quantum circuit using the isQ language. For more details, please refer to isQ Programming Language.

Step 2: Compile and Simulate Using Python

Run the following Python code to compile the isQ file and simulate its execution:

from pathlib import Path

from isqtools import isqc_compile, isqc_simulate
from isqtools.utils import CompileTarget, IsqcError

# Define the path to your isQ file
temp_file_path = Path("example.isq")

# Compile the isQ file to QIR (or other supported targets)
try:
    isqc_compile(file=str(temp_file_path), target=CompileTarget.QIR)
except IsqcError as e:
    print(f"Compilation failed: {e}")
    exit(1)

# Simulate the compiled QIR
output_file = temp_file_path.with_suffix(".so")
result, err, code = isqc_simulate(output_file)

if code == 0:
    print("Simulation Result:", result)
else:
    print("Simulation Error:", err)

Notes:

  • Replace example.isq with the path to your actual isQ file.
  • Ensure that all required dependencies are installed and that the isqtools environment is properly set up.

License

MIT License

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

isqtools-1.2.0.tar.gz (134.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isqtools-1.2.0-py3-none-any.whl (54.2 kB view details)

Uploaded Python 3

File details

Details for the file isqtools-1.2.0.tar.gz.

File metadata

  • Download URL: isqtools-1.2.0.tar.gz
  • Upload date:
  • Size: 134.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.8

File hashes

Hashes for isqtools-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e2f89aafc8a78d61f334cd06807ac9a7cd6a6daad29f878d5a8a35748fcf87bf
MD5 45acf88a43c067e7f9e3c4b13037929a
BLAKE2b-256 8d2740b365414fc40a67dd20f5336fe03ad60fcdacfaec41963fce9af85c7657

See more details on using hashes here.

File details

Details for the file isqtools-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: isqtools-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.8

File hashes

Hashes for isqtools-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b031f448a351f9bd77fb6ffaa35fb88c1d3d36e5f806307cf9383b5064a1aec6
MD5 1cfcf98a2f3c78d44e47ad59ec5f6361
BLAKE2b-256 f53812ef77e445e0400f471bee1c06883831fb680e7cc4308df38ac29cd19f0b

See more details on using hashes here.

Supported by

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