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:
- Python 3.9 or higher version
- NumPy
- isQ Compiler (isqc) version 0.2.5
Additional Requirements:
-
For quantum machine learning:
-
For quantum chemistry simulations:
-
For accessing QuantumCtek quantum hardware:
Installation
To get started with isqtools, we recommend downloading the source code and installing it using pip. Follow these steps:
- Clone the repository or download the source code.
- Navigate to the project directory.
- 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.isqwith the path to your actual isQ file. - Ensure that all required dependencies are installed and that the isqtools environment is properly set up.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file isqtools-1.0.0.tar.gz.
File metadata
- Download URL: isqtools-1.0.0.tar.gz
- Upload date:
- Size: 134.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0ded99d8714e9a7d270cca8d35be0d3abe009b87d9e0f4c1829311590c87e4b
|
|
| MD5 |
ad6cc38e2817adc7105db41fd445a83c
|
|
| BLAKE2b-256 |
1f4a27ab64bd304d7e5abae2cc4c822f6072ceaa9e8c1078f2ba89b1f844833b
|
File details
Details for the file isqtools-1.0.0-py3-none-any.whl.
File metadata
- Download URL: isqtools-1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
167316198d78aec6233ea9280eec3d04f243ac2051f3f932f14e168ce7b566f9
|
|
| MD5 |
1bef1f29d1c2cb6a7681e3aefa2503a6
|
|
| BLAKE2b-256 |
613cc140fdcb56ddb27286480d6cf7bbd07514bc4c0fb24cece59ca72859af09
|