Land quantum Q4 visuals and gate Stream to LLM/agent imports.
Add probs/Bloch draw kinds and matches_matrix, plus feature docs; hide the view Stream panel unless llm/agent is imported, and stop rewriting method names like 绘图 through host_plot aliases. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
25b7be6739
commit
eea6fe1a0e
20 files changed
+852
-23
No files matched your search
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: quantum draw probs/bloch smoke
|
||||
description: draw kind=probs and kind=bloch return matching kind tags.
|
||||
> ext/quantum/quantum.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
`steps` =
|
||||
|
||||
| step | gate | qubits |
|
||||
|------|------|--------|
|
||||
| 1 | H | 0 |
|
||||
| 2 | CX | 0,1 |
|
||||
|
||||
*`qc` = > quantum.circuit qubits=2 steps=`steps` *
|
||||
*`img` = > `qc`.draw kind=probs path=quantum-draw-probs.svg *
|
||||
*`kind` = `img`[^kind] *
|
||||
|
||||
1. `kind` == probs
|
||||
> print text=probs-ok
|
||||
2. *
|
||||
> print text=probs-fail
|
||||
|
||||
*`qc1` = > quantum.circuit qubits=1 *
|
||||
*`qc1` = > `qc1`.h qubit=0 *
|
||||
*`bloch` = > `qc1`.draw kind=bloch path=quantum-draw-bloch.svg *
|
||||
*`bk` = `bloch`[^kind] *
|
||||
|
||||
1. `bk` == bloch
|
||||
> print text=bloch-ok
|
||||
2. *
|
||||
> print text=bloch-fail
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: quantum gate matches_matrix smoke
|
||||
description: Named H matches an explicit 2x2 nested list.
|
||||
> ext/quantum/quantum.mq.md
|
||||
> lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`H_matrix` = > json.parse text=[[0.7071067811865475,0.7071067811865475],[0.7071067811865475,-0.7071067811865475]] *
|
||||
*`H` = > quantum.gate name=H *
|
||||
*`ok` = > `H`.matches_matrix matrix=`H_matrix` *
|
||||
|
||||
1. `ok`
|
||||
> print text=match-ok
|
||||
2. *
|
||||
> print text=match-fail
|
||||
|
||||
*`bad` = > json.parse text=[[1,0],[0,1]] *
|
||||
*`no` = > `H`.matches_matrix matrix=`bad` *
|
||||
|
||||
1. not `no`
|
||||
> print text=reject-ok
|
||||
2. *
|
||||
> print text=reject-fail
|
||||
Reference in new issue
Block a user