:::tip Auto-Generated API Documentation For the Rust implementation details, see the qdp-core Rust API documentation. For Python usage, see the Python API Reference. :::
Mahout QDP (Quantum Data Plane) provides GPU-accelerated quantum state encoding. It writes classical data directly into GPU memory and returns a DLPack-compatible handle for zero-copy integration with downstream frameworks.
qumat.qdpPrefer importing from qumat.qdp; the native extension is _qdp.
import qumat.qdp as qdp
# or: from _qdp import QdpEngine, QuantumTensor
QdpEngineQdpEngine(device_id=0, precision="float32")Create a GPU encoder instance.
Parameters
device_id (int): CUDA device ID, default 0.precision (str): "float32" or "float64".Raises
RuntimeError: Initialization failure or unsupported precision.encode(data, num_qubits, encoding_method="amplitude") -> QuantumTensorEncode classical input into a quantum state and return a DLPack tensor on GPU.
Parameters
data: Supported inputs
list[float]numpy.ndarray (1D/2D, dtype=float64, C-contiguous)torch.Tensor (CPU, float64, contiguous)str / pathlib.Path file path
.parquet, .arrow / .feather, .npy, .pt / .pth, .pbnum_qubits (int): Number of qubits, range 1–30.encoding_method (str): "amplitude" | "angle" | "basis" | "iqp" | "iqp-z" (lowercase).Returns
QuantumTensor with 2D shape:
[1, 2^num_qubits][batch_size, 2^num_qubits]Notes
complex64 (precision="float32") or complex128 (precision="float64")."amplitude" and "basis"..pt, .pth) require building with the pytorch feature.Raises
RuntimeError: Invalid inputs, shapes, dtypes, or unsupported formats.encode_from_tensorflow(path, num_qubits, encoding_method="amplitude") -> QuantumTensorEncode directly from a TensorFlow TensorProto file (.pb).
QuantumTensorDLPack wrapper for GPU-resident quantum states.
__dlpack__(stream=None)Return a DLPack PyCapsule. This can be consumed only once.
__dlpack_device__()Return (device_type, device_id); CUDA devices report (2, gpu_id).
Ownership & Lifetime
amplitude<= 2^num_qubits; remaining entries are zero-padded.anglenum_qubits angles.basis[0, 2^num_qubits).iqpn + n*(n-1)/2 parameters for n = num_qubits (Z + ZZ terms).iqp-zn parameters for n = num_qubits (Z terms only)..parquet.arrow, .feather.npy.pt, .pth (requires pytorch feature).pb (TensorProto)num_qubits out of range.2^num_qubits.float64 NumPy/Torch inputs.requires-python >=3.10,<3.13).qumat installed (the QDP native extension ships as qumat-qdp).torch for DLPack integration, numpy for NumPy inputs.No deprecations are planned for the initial PoC.