Skip to main content

A simple qubit simulator

Project description

QubitSimulator Library

Overview

QubitSimulator is a simple and lightweight quantum computing simulator library implemented in Python. It provides basic functionalities for simulating quantum circuits with commonly used quantum gates, including Hadamard, $\frac{\pi}{8}$, and Controlled-NOT gates. You can also perform measurements on qubits and run the quantum circuit for multiple shots.

Features

  • Universal gate set (H, T, CNOT)
  • Generic gate (U)
  • Measure in custom basis
  • Circuit printing

Installation

pip install qubit_simulator

Usage

Initialization

Initialize the QubitSimulator with the number of qubits:

from qubit_simulator import QubitSimulator

simulator = QubitSimulator(2)

Applying Gates

Apply the H, T, and CNOT gates to the specified qubits:

simulator.H(0)
simulator.T(1)
simulator.CNOT(0, 1)

Measurements

Perform a measurement on the qubits:

simulator.Measure()

['11']

Running the Circuit

Run the quantum circuit for a specified number of shots:

simulator.run(shots=10)

{'11': 6, '00': 4}

Tests

python -m pytest

License

This library is open-source and available under the 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

qubit_simulator-0.0.1.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

qubit_simulator-0.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

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