Skip to content

Commit 02e0756

Browse files
authored
[bug] add back getting started (#1019)
1 parent 3d15bce commit 02e0756

File tree

1 file changed

+76
-4
lines changed

1 file changed

+76
-4
lines changed

docs/qdp/getting-started.md

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,80 @@
22
title: Getting Started with QDP
33
---
44

5-
# Getting Started
5+
# Getting Started with QDP
66

7-
:::info Coming Soon
8-
This documentation is under development. Check back soon!
9-
:::
7+
QDP (Quantum Data Plane) is a GPU-accelerated library for encoding classical data into quantum states.
8+
9+
## Prerequisites
10+
11+
- Linux with NVIDIA GPU
12+
- CUDA toolkit installed (`nvcc --version` to verify)
13+
- Python 3.10+
14+
15+
## Installation
16+
17+
```bash
18+
pip install qumat[qdp]
19+
```
20+
21+
For development (from source):
22+
23+
```bash
24+
git clone https://github.com/apache/mahout.git
25+
cd mahout/qdp/qdp-python
26+
uv venv -p python3.10 && source .venv/bin/activate
27+
uv sync --group dev && uv run maturin develop
28+
```
29+
30+
## Quick Start
31+
32+
```python
33+
import torch
34+
from qumat.qdp import QdpEngine
35+
36+
engine = QdpEngine(0) # GPU device 0
37+
data = [0.5, 0.5, 0.5, 0.5]
38+
qtensor = engine.encode(data, num_qubits=2, encoding_method="amplitude")
39+
40+
# Convert to PyTorch (zero-copy)
41+
tensor = torch.from_dlpack(qtensor) # Note: can only be consumed once
42+
```
43+
44+
## Encoding Methods
45+
46+
| Method | Constraint | Example |
47+
|--------|-----------|---------|
48+
| `amplitude` | data length ≤ 2^num_qubits | `encode([0.5, 0.5, 0.5, 0.5], num_qubits=2, encoding_method="amplitude")` |
49+
| `angle` | data length = num_qubits | `encode([0.1, 0.2, 0.3, 0.4], num_qubits=4, encoding_method="angle")` |
50+
| `basis` | data length = num_qubits | `encode([1, 0, 1, 1], num_qubits=4, encoding_method="basis")` |
51+
52+
## File Inputs
53+
54+
```python
55+
engine.encode("data.parquet", num_qubits=10, encoding_method="amplitude") # also: .arrow, .npy, .pt, .pb
56+
```
57+
58+
## Tips
59+
60+
- Use `precision="float64"` for higher precision: `QdpEngine(0, precision="float64")`
61+
- NumPy inputs must be `float64` dtype
62+
- Streaming only works with Parquet files
63+
64+
## Troubleshooting
65+
66+
| Problem | Solution |
67+
|---------|----------|
68+
| Import fails | Activate venv: `source .venv/bin/activate` |
69+
| CUDA errors | Run `cargo clean` in `qdp/` and rebuild |
70+
| Out of memory | Reduce `num_qubits` or use `precision="float32"` |
71+
72+
## Next Steps
73+
74+
- [Concepts](../concepts/) - Learn about quantum encoding concepts
75+
- [API Reference](../api/) - Detailed API documentation
76+
- [Examples](../examples/) - More usage examples
77+
78+
## Help
79+
80+
- Mailing List: dev@mahout.apache.org
81+
- [GitHub Issues](https://github.com/apache/mahout/issues)

0 commit comments

Comments
 (0)