marqdo

06-quantumok

features/06-quantum.mq.md

Structure

importquantum:ext/quantum/quantum.mq.md
fn · h1main
comment

Optional package (not stdlib). Install: marqdo ext add quantum (or build marqdo_plugin_quantum).

comment

GHZ (3 qubits): H on q0, then CX 0→1 and 0→2. Ideal |000⟩ / |111⟩ each ≈ 1/2.

comment

Q7: Bell density, partial trace, Schmidt, draw kind=hinton / qsphere — examples/quantum-entanglement/.

comment

Q8: draw theme="dark"|"light"|"bw" (default dark lab look) on circuit / probs / bloch. Rebuild plugin then ext add so view loads the new native lib.

bind `steps` = {step: [1, 2, 3], gate: [H, CX, CX], qubits: [0, 0,1, 0,2]}
bind `qc` = > quantum.circuit qubits=3 steps=`steps`
bind `p` = > `qc`.probabilities
bind `_` = > `qc`.draw kind=probs theme=dark
bind `H` = > quantum.gate name=H
bind `__` = > `H`.draw kind=matrix
call> print text=`p`
call> print text=quantum-feature-ok
Functions
Variables
  • H gate
    _typegate
    nameH
  • _ quantum_svg
    _typequantum_svg
    kindprobs
    ops
    qubits3
    svg<svg xmlns="http://www.w3.org/2000/s…
  • __ quantum_svg
    _typequantum_svg
    kindmatrix
    svg<svg xmlns="http://www.w3.org/2000/s…
  • p map · 2
    0000.5
    1110.5
  • qc circuit
    _typecircuit
    ops
    qubits3
  • steps map · 3
    stepList(3)
    gateList(3)
    qubitsList(3)

Execution

{000: 0.5, 111: 0.5} quantum-feature-ok
100000.501110.50
H matrix000.7070.707110.707-0.707

Source

---
title: Quantum circuits (ext/quantum)
description: Official quantum simulator — tables, gates, Q7 density, Q8 themed SVG
import quantum:ext/quantum/quantum.mq.md
---

# main

Optional package (not stdlib). Install: `marqdo ext add quantum` (or build `marqdo_plugin_quantum`).

GHZ (3 qubits): H on q0, then CX 0→1 and 0→2. Ideal |000⟩ / |111⟩ each ≈ 1/2.

Q7: Bell density, partial trace, Schmidt, `draw kind=hinton` / qsphere — `examples/quantum-entanglement/`.

Q8: `draw theme="dark"|"light"|"bw"` (default dark lab look) on circuit / probs / bloch. Rebuild plugin then `ext add` so view loads the new native lib.

`steps` =

| step | gate | qubits |
|------|------|--------|
| 1 | H | 0 |
| 2 | CX | 0,1 |
| 3 | CX | 0,2 |

**`qc` = > quantum.circuit qubits=3 steps=`steps`**
**`p` = > `qc`.probabilities**
**`_` = > `qc`.draw kind="probs" theme="dark"**
**`H` = > quantum.gate name="H"**
**`__` = > `H`.draw kind="matrix"**

> print text=`p`
> print text=quantum-feature-ok

Variable