This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 08687ba57 [Docs] [QDP] add qdp example (#1079)
08687ba57 is described below
commit 08687ba5706dee57a8a1e1de3a8e0780ea926864
Author: Ryan Huang <[email protected]>
AuthorDate: Mon Feb 23 20:01:05 2026 +0800
[Docs] [QDP] add qdp example (#1079)
* add qdp example
* Remove Example 2 from qdp documentation
Removed Example 2 related to NumPy batch and .npy file input from the
documentation.
---
docs/qdp/examples.md | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/docs/qdp/examples.md b/docs/qdp/examples.md
index 29f864944..a0846ddf2 100644
--- a/docs/qdp/examples.md
+++ b/docs/qdp/examples.md
@@ -4,6 +4,28 @@ title: Examples - QDP
# Examples
-:::info Coming Soon
-This documentation is under development. Check back soon!
+:::info Prerequisites
+These examples require Linux with an NVIDIA GPU and CUDA.
+
+- Install QDP support: `pip install qumat[qdp]`
+- Optional deps used below: `torch`, `numpy`
:::
+
+## Example 1: Basic Encode + DLPack to PyTorch
+
+```python
+import torch
+import qumat.qdp as qdp
+
+engine = qdp.QdpEngine(device_id=0)
+qtensor = engine.encode(
+ [0.5, 0.5, 0.5, 0.5],
+ num_qubits=2,
+ encoding_method="amplitude",
+)
+
+# DLPack capsule is single-consume; convert once.
+tensor = torch.from_dlpack(qtensor)
+assert tensor.is_cuda
+assert tensor.shape == (1, 4) # [batch_size, 2^num_qubits]
+```