Skip to content

Latest commit

 

History

History
106 lines (78 loc) · 4.49 KB

README.md

File metadata and controls

106 lines (78 loc) · 4.49 KB

Apache Mahout

License PyPI version PyPI - Python Version GitHub Stars GitHub Contributors

The goal of the Apache Mahout™ project is to build an environment for quickly creating scalable, performant machine learning applications.
For additional information about Mahout, visit the Mahout Home Page

Qumat

Apache Mahout

Qumat is a high-level Python library for quantum computing that provides:

  • Quantum Circuit Abstraction - Build quantum circuits with standard gates (Hadamard, CNOT, Pauli, etc.) and run them on Qiskit, Cirq, or Amazon Braket with a single unified API. Write once, execute anywhere. Check out basic gates for a quick introduction to the basic gates supported across all backends.
  • QDP - Mahout's own GPU-native engine. It encodes classical data into quantum states with GPU-accelerated kernels, and hands them to PyTorch, NumPy, and TensorFlow through zero-copy DLPack.

Quick Start

pip install "qumat[qiskit]"     # or [cirq], [braket], [all]

The core package is light: circuits are recorded in Mahout's own representation, and each execution backend is an optional extra.

Extra Installs Use it with
qiskit Qiskit and Aer Circuit(backend="qiskit")
cirq Cirq Circuit(backend="cirq")
braket Amazon Braket SDK Circuit(backend="amazon_braket")
all all three of the above any third-party backend
qdp Mahout's GPU engine Encoder(device="cuda"), Circuit(backend="qdp")

The qdp extra needs Linux, an NVIDIA GPU with CUDA, and Python 3.10-3.12.

Qumat: Run a Quantum Circuit

from qumat import Circuit

qc = Circuit(backend="qiskit", shots=1000)   # or "cirq", "amazon_braket"
qc.create_empty_circuit(num_qubits=2)
qc.apply_hadamard_gate(0)
qc.apply_cnot_gate(0, 1)
qc.execute_circuit()

The configuration dictionary form Circuit({"backend_name": ..., "backend_options": {...}}) is also accepted.

QDP: Encode data for Quantum ML

from qumat import Encoder

encoder = Encoder(device="cuda")   # or device="amd" on ROCm
state = encoder.encode([1.0, 2.0, 3.0, 4.0], num_qubits=2, encoding_method="amplitude")

device picks the GPU platform the encoding runs on. backend picks the framework that executes a circuit. The two choices are independent.

Encode and run entirely on the GPU

qc = Circuit(backend="qdp", shots=1000)
qc.create_empty_circuit(num_qubits=2)
qc.load_data([1.0, 2.0, 3.0, 4.0], encoding_method="amplitude")
qc.apply_hadamard_gate(0)
qc.execute_circuit()

load_data() encodes straight into the GPU buffer the gates then run on. Give it a 2-D array to run the same circuit over a whole batch of samples.

Results have the same format on every backend: counts are {bitstring: shots} with qubit 0 as the rightmost character. To run an already-encoded state on another backend, pass it to initialize(); the qiskit and cirq backends copy it to host memory first.

Legal

Please see the NOTICE.txt included in this directory for more information.