Skip to main content

SliQSim simulator

Project description

SliQSim Qiskit Interface - Execute SliQSim on Qiskit

Introduction

This is a Qiskit provider for SliQSim where you can execute SliQSim from Qiskit framework as a backend option.

SliQSim is a BDD-based quantum circuit simulator implemented in C/C++ on top of CUDD package. In SliQSim, a bit-slicing technique based on BDDs is used to represent quantum state vectors. For more details of the simulator, please refer to the paper.

Installation

To use this provider, one should first install IBM's Qiskit, and then install the provider with pip.

pip install qiskit
pip install qiskit-sliqsim-provider

Execution

The gate set supported in SliQSim now contains Pauli-X (x), Pauli-Y (y), Pauli-Z (z), Hadamard (h), Phase and its inverse (s and sdg), π/8 and its inverse (t and tdg), Rotation-X with phase π/2 (rx(pi/2)), Rotation-Y with phase π/2 (ry(pi/2)), Controlled-NOT (cx), Controlled-Z (cz), Toffoli (ccx and mcx), SWAP (swap), and Fredkin (cswap).

For simulation types, we provide both weak and strong simulation options, where the weak simulation samples outcomes from the output distribution obtained after the circuit is applied, and the strong simulation calculates the resulting state vector of the quantum circuit. The following examples demostrate the usage of the provider.

# Import tools
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute
from qiskit_sliqsim_provider import SliQSimProvider

# Initiate SliQSim Provider
provider = SliQSimProvider()

# Construct a 2-qubit bell-state circuit
qr = QuantumRegister(2)
cr = ClassicalRegister(2)
qc = QuantumCircuit(qr, cr)

qc.h(qr[0])
qc.cx(qr[0], qr[1])
qc.measure(qr, cr)

# Get the backend of weak simulation
backend = provider.get_backend('weak_simulator')

# Execute simulation
job = execute(qc, backend=backend, shots=1024)

# Obtain and print the results
result = job.result()
print(result.get_counts(qc))

In the above Python code, we construct a 2-qubit bell-state circuit with measurement gates at the end, and execute the simulator with weak simulation backend option weak_simulator. The sampled result is then printed:

{'00': 523, '11': 501}

Circuits can also be read from files in OpenQASM format, which is used by Qiskit. Here we read a circuit, which is also a 2-qubit bell-state circuit but with no measurements gates, to showcase the strong simulation:

qc = QuantumCircuit.from_qasm_file("../SliQSim/examples/bell_state.qasm")

To execute the strong simulation, the backend option weak_simulator is replaced with strong_simulator:

backend = provider.get_backend('strong_simulator')

and after obtaining the results, we acquire the state vector instead of the counts of sampled outcomes:

print(result.get_statevector(qc))

The state vector is then printed:

[0.707107+0.j 0.      +0.j 0.      +0.j 0.707107+0.j]

One may also use our simulator by executing a compiled binary file. Check this repo.

Citation

Please cite the following paper if you use our simulator for your research:

Y. Tsai, J. R. Jiang, and C. Jhang, "Bit-Slicing the Hilbert Space: Scaling Up Accurate Quantum Circuit Simulation to a New Level," 2020, arXiv: 2007.09304
@misc{tsai2020bitslicing,
      title={Bit-Slicing the Hilbert Space: Scaling Up Accurate Quantum Circuit Simulation to a New Level},
      author={Yuan{-}Hung Tsai and Jie{-}Hong R. Jiang and Chiao{-}Shan Jhang},
      year={2020},
      note={arXiv: 2007.09304}
}

Contact

If you have any questions or suggestions, feel free to create an issue, or contact us through matthewyhtsai@gmail.com.

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

qiskit-sliqsim-provider-0.0.6.tar.gz (1.8 MB view details)

Uploaded Source

File details

Details for the file qiskit-sliqsim-provider-0.0.6.tar.gz.

File metadata

  • Download URL: qiskit-sliqsim-provider-0.0.6.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.2

File hashes

Hashes for qiskit-sliqsim-provider-0.0.6.tar.gz
Algorithm Hash digest
SHA256 51c7a84aefa496ae74234adc73809714d2e76620173964a78981d02ae37d588b
MD5 d686f9d5806d9e2c162a325c40a82367
BLAKE2b-256 60ac3166749684816772b979b2cc784393fb8e95ea7f2d70be244f5625ea3aa3

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