Skip to main content

TQSim is a Topological Quantum Computing simulator based on Anyon models

Project description

CQTech

TQSim

CircleCI Version License License

TQSim stands for Topological Quantum Simulator. It is an open-source library for simulating topological quantum computer based on anyons.

Installation

You can install TQSim from pip using

pip install --upgrade tqsim

Usage

1. Basic Example

In this example, we create a circuit with 2 qudits, made of 3 anyons each. We then braid the anyons manually.

from tqsim import AnyonicCircuit

circuit = AnyonicCircuit(2, 3) # Create a circuit having 2 qudits and 3 anyons per qudits
circuit.braid(1, 2) # Braids the first with the second anyon
circuit.braid(3, 4) # Braids the first with the second anyon
circuit.braid(2, 1)
circuit.measure() # Measure the system by fusing the anyons
circuit.draw() # Draw the circuit

Here is the output of the draw() method:

Circuit Output

Simulating the circuit:

circuit.run(shots = 50)

Output:

{'counts': {'0': 16, '2': 20, '4': 14}, 'memory': array([4, 2, 2, 2, 2, 2, 2, 4, 2, 4, 2, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 4,
       2, 4, 0, 2, 0, 0, 0, 0, 4, 4, 2, 2, 2, 4, 2, 2, 0, 0, 2, 4, 2, 2,
       4, 2, 4, 4, 0, 2])}

2. Simulating a Hadamard gate

Here we simulate the application of a Hadamard gate on a single qudit with 3 anyons. Unlike the previous example, we will use a braiding sequence of braiding operators and their corresponding powers.

from tqsim import AnyonicCircuit

circuit = AnyonicCircuit(nb_qudits=1, nb_anyons_per_qudit=3)  # Create a circuit with 1 qudit composed of 3 anyons
circuit.initialize([0,0,1])  # We initialize the circuit in the last state (state 2).
                            # For this circuit, we have 3 basis states: [0, 1, 2].

# The Hadamard gate braiding sequence in terms of braiding operators
had_sequence = [[1, 2], [2, 2], [1, -2], [2, -2], [1, 2], [2, 4], [1, -2], [2, 2],
                [1, 2], [2, -2], [1, 2], [2, -2], [1, 4]]

circuit.braid_sequence(had_sequence)  # We apply the braiding sequence.
                                      # This should put our qudit in a superposition of the states 2 and 1.
circuit.measure()  # Measure the system by fusing the anyons
circuit.draw()  # Draw the circuit

The Hadamard braid looks like this

Circuit Output

Simulating the circuit:

result = circuit.run(shots = 1000)  # Run the circuit 1000 times.
print(result['counts'])  # Show the counts only.

Output:

{'1': 493, '2': 507}

Authors and Citation

Abdellah Tounsi, Mohamed Messaoud Louamri, Nacer eddine Belaloui, and Mohamed Taha Rouabah – Constantine Quantum Technologies.

If you have used TQSim in your work, please use the BibTeX file to cite the authors.

License

Copyright © 2022, Constantine Quantum Technologies. Released under the Apache License 2.0.

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

tqsim-0.0.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

tqsim-0.0.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file tqsim-0.0.1.tar.gz.

File metadata

  • Download URL: tqsim-0.0.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.4 Linux/5.15.0-52-generic

File hashes

Hashes for tqsim-0.0.1.tar.gz
Algorithm Hash digest
SHA256 89f513e1ff52526a384dc764adc506e7241d0277de5ccb97b599d06030a4a6dc
MD5 585dc31bb20c4e614758be9f8085c878
BLAKE2b-256 1b6d5651d9666cb8fae9e44f491b57f9ea6099bd7abd943c9dddb45c552ff38e

See more details on using hashes here.

File details

Details for the file tqsim-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tqsim-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.4 Linux/5.15.0-52-generic

File hashes

Hashes for tqsim-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16e94cc0ad5b1fc877227e00f49e61c5641b309acd47f8054a85aec8091adb70
MD5 6c9f97171a50ae4654af6d9dea6b108d
BLAKE2b-256 918b8e593fa958ece366b0bf6a96acf4125b43338df12f33f56b6dfb4a42e8ba

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