Skip to main content

A quantum computing library

Project description

Quanthon

A minimal Python library for quantum computing, for physicists!

Installation

Using PIP:

pip3 install Quanthon

Get Started

Importing the Module

import Quanthon as qt

Initializing a Single Qubit

Initialize a single qubit by creating an instance of the Qubits class.

qubit = qt.Qubits(1)

Applying Quantum Gates

Quanthon supports various quantum gates like the Hadamard (H), Pauli-X (X), Pauli-Y (Y), and Pauli-Z (Z) gates.

# Apply a Hadamard gate on the first qubit
qubit.H(0)

# Apply a Pauli-X gate on the first qubit
qubit.X(0)

# Apply a Pauli-Y gate on the first qubit
qubit.Y(0)

# Apply a Pauli-Z gate on the first qubit
qubit.Z(0)

Performing Quantum Measurements

You can perform quantum measurements on your qubit system with a specific number of shots.

result = qubit.measure(n_shots=10)

Working with Multiple Qubits

Use the Qubits class for all states.

from Quanthon import Qubits

# Initialize a 2-qubit system
two_qubits = Qubits(2)

# Initialize an n-qubit system
n = 4
n_qubits = Qubits(n)

CNOT and SWAP Operations for Multiple Qubits

Quanthon allows you to perform CNOT and SWAP operations on multi-qubit systems.

# Perform a CNOT operation between the first and second qubit
two_qubits.CONT(0, 1)

two_qubits.SWAP(0, 1)

New in 0.3.6:

Added pauli_decomposition for matrices of size $2^n \times 2^n$.

from Quanthon import pauli_decomposition

Previous Version Releases

0.3.5:

  • VQE now supports non-Hermitian 'Hamiltonians', but why would you ever need it?

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

quanthon-0.4.0.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

Quanthon-0.4.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file quanthon-0.4.0.tar.gz.

File metadata

  • Download URL: quanthon-0.4.0.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for quanthon-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6a16e4a8b7e8de3bda418bee6218f8fe197f89ae5d7dfcbfc20a36f548e0ab64
MD5 73f06eb2e438f44b272995c45393bbed
BLAKE2b-256 ce1230765fc0df0c6a5d82a7711b03f4e1d44831a8610bae4d144e5898bb9940

See more details on using hashes here.

File details

Details for the file Quanthon-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: Quanthon-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for Quanthon-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 958d5f8e90169857fd6fe7a976d060a8fd9e5787acfb93d2f0316cb02cbacc2b
MD5 929a55b80aaa8dd79bda34722b5143a9
BLAKE2b-256 f890da3a008900911a12cb4e544b6291356c85649230759a47017933814eaaad

See more details on using hashes here.

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