Skip to main content

A lightweight quantum computing library for foundational tools and mathematical operations.

Project description

Qlibx: A Quantum Computing Library

Qlibx is a Python library designed to provide foundational tools for quantum computing. It offers classes and methods to represent and manipulate quantum states, operators, and their interactions. The library is lightweight and focuses on the mathematical foundations of quantum mechanics, making it an excellent choice for learning and experimentation.


Features

  • Quantum States:

    • Ket and Bra classes to represent quantum states.
    • Support for operations like addition, subtraction, scalar multiplication, tensor products, and inner/outer products.
  • Quantum Operators:

    • Operator class to represent quantum operators.
    • Methods for Hermitian, unitary, and normality checks.
    • Commutator and anti-commutator calculations.
    • Spectral decomposition and partial trace.
    • Von Neumann entropy calculation.
  • Predefined Operators:

    • Pauli matrices (pauli_x, pauli_y, pauli_z) and the identity matrix.

Installation

Clone the repository and include the library in your Python project:

git clone https://github.com/your-repo/qpylib.git
cd qpylib

Ensure the qpylib directory is in your Python path.


Usage

Importing the Library

from qpylib import Ket, Bra, Operator

Creating Quantum States

# Create a Ket vector
ket = Ket([1, 0])

# Create a Bra vector
bra = Bra([1, 0])

Quantum Operations

# Inner product
inner = ket.inner_product(bra)

# Outer product
outer = ket.outer_product(bra)

# Tensor product
tensor = ket.tensor(Ket([0, 1]))

Working with Operators

# Define an operator
op = Operator([[0, 1], [1, 0]])

# Apply operator to a Ket
result = op.op(ket)

# Check if the operator is unitary
is_unitary = op.unitary()

Example: Quantum Circuit Simulation

from qpylib import Ket, Operator

# Define a quantum state |ψ⟩
psi = Ket([1, 0])

# Define a Pauli-X gate
pauli_x = Operator(Operator.pauli_x)

# Apply the gate
new_state = pauli_x.op(psi)

print(new_state)

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.


License

This project is licensed under the MIT License.


Acknowledgments

Qlibx is inspired by the mathematical foundations of quantum mechanics and aims to provide an intuitive interface for quantum computing enthusiasts.

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

qlibx-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

qlibx-1.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file qlibx-1.0.0.tar.gz.

File metadata

  • Download URL: qlibx-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for qlibx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dfbe7931a2213427c75b406352aad42176637c4eb805b38f5f9a566efbff37cc
MD5 6b9028030d3fe1276584580fcc62b893
BLAKE2b-256 a493672f94b1541e12361c20959611959bfee6b05f66d73ba831dd15711e6ae1

See more details on using hashes here.

File details

Details for the file qlibx-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: qlibx-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for qlibx-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bda0db04fdfe63202ae781e75c65bcd1768b6e208974c7f888bfb475ff206ef
MD5 7267cceb1f6fe2549297a1a495afcbff
BLAKE2b-256 40220e0ef95933fa5f61952a8bde122a9ceb1363247a7cf4fd03a0c75a5a472b

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