Skip to main content

Amin-QVM: Quantum Computing Library With Built In Novum QVM

Project description

amin-qvm Library Documentation

Overview

The amin-qvm library has good tools for simulating quantum algorithms and neural networks. It has classes for quantum state manipulation, representation of quantum gates, and implementations of algorithms like Grover and Deutsch-Jozsa.

Modules in the Library

novum

Class: Novum

This is the primary class representing a quantum system.

  • Initialization: Novum(num_qubits: int) Initiates a quantum system with a specified number of qubits.

  • Methods:

    • execute_qasm(qasm_code: str): Executes QASM code on the quantum system.
    • convert_to_binary(input_data: str, num_bits: int): Converts CSV data into binary representation.
    • prepare_classical_state(input_data): Prepares the quantum state based on classical binary input data.
    • apply_gate(gate_matrix: np.ndarray, qubit_indices: List[int]): Applies a specified gate to the qubits of the quantum system.
    • apply_oracle(b1, b2, entanglements): Applies an oracle gate to the qubits using the specified entanglements.
    • measure_qubits(): Measures the qubits and returns the outcome.
    • plot_results(title="Measurement Results"): Plots the measurement outcomes of the qubits.

gates

Defines an assortment of quantum gates represented as NumPy arrays.

  • Gate Variables: PauliX, PauliY, PauliZ, Hadamard, Identity, S, T, CNOT, SWAP, etc.

  • Functions: PhaseShift(theta): Returns a phase shift gate for a given angle. Rx(theta), Ry(theta), Rz(theta): Rotation gates around the x, y, and z-axis.

qasm_processing

Provides functions for converting QASM code into executable Python code using the Novum library.

  • Functions: qasm_to_python(qasm_code: str): Converts QASM code into Python code commands for the Novum system.

tools

Functions supporting quantum neural network operations.

  • Functions: update_weights(...), compute_gradients(...), initialize_weights(...), apply_layer(...), forward_pass(...), calculate_loss(...), train_qnn(...)

equations

Basic mathematical functions used in quantum computing.

  • Functions: inner_product(...), eigen(...), dot_product(...), normalize_state(...), tensor_product(...), is_unitary(...)

grover

Implements Grover's search algorithm as a class.

  • Class: Grover
    • Initialization: Grover(data: list[str], target: str, iterations: int = 1)
    • Methods:
      • run(): Executes the Grover search algorithm.
      • prepare_superposition_state(): Sets up the initial superposition across all qubits.
      • apply_oracle(): Applies the oracle function.
      • apply_diffusion_operator(): Applies the diffusion (inversion about the mean) operator.

deutschjozsa

Implementation of the Deutsch-Jozsa algorithm as a class.

  • Class: DeutschJozsa
    • Inherits from Novum.
    • Initialization: DeutschJozsa(num_qubits: int, f)
    • Methods:
      • oracle(): Encodes the provided function f into the quantum oracle.
      • run(): Executes the Deutsch-Jozsa algorithm to determine if the function f is constant or balanced.

Usage

Installation

pip install amin-qvm

Setting Up the Environment

Make sure you have Python installed on your system, because like, how else are you going to use the library :)

Creating a Novum Instance

To create a Novum system and run QASM:

from amin_qvm.system.novum import Novum

# Create an instance with 2 qubits
novum = Novum(2)

# Run QASM code
qasm_code = """
qreg[2];
cx 0,1;
h 0;
measure;
"""
novum.execute_qasm(qasm_code)

Applying Gates and Running Algorithms

from amin_qvm.system.gates import Hadamard
from amin_qvm.algorithms.grover import Grover

# Initialize Grover's algorithm with data and target
grover = Grover(data=["00", "01", "10", "11"], target="10")
grover.run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

amin_qvm-2.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file amin_qvm-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: amin_qvm-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for amin_qvm-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cddcc49ce2c7a312b9ff8aee02959e6cf0e6acc4096e8ad2d934105475b5896
MD5 29b21fdde8e51604fc11852d39bf56b6
BLAKE2b-256 61b852d07081848e53d331f13be0ed1cb1912c5f473a5bb01ced20c653777370

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