algorithms-and-observables
Use Cirq to assemble textbook algorithm circuits, Pauli observables, expectation-value checks, and variational-loop validation.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- algorithms-and-observables
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Cirq to assemble textbook algorithm circuits, Pauli observables, expectation-value checks, and variational-loop validation.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/algorithm-recipes.md9.4 KB
- 参考文档references/observables-and-validation.md6.9 KB
- 参考文档references/troubleshooting.md7.0 KB
03 SKILL.md 正文
Cirq algorithms and observables
Use this sub-skill when the task is about algorithm-level Cirq patterns or observable validation rather than basic circuit syntax. Typical triggers include QFT, phase estimation, Grover search, Bernstein-Vazirani, quantum teleportation, superdense coding, QAOA-style ansatz loops, PauliString, PauliSum, Pauli measurements, expectation values, or interpreting algorithm result histograms.
Start here
- Pick the closest recipe in algorithm-recipes.md.
- For observables, expectation values, qubit-order checks, or result validation, read observables-and-validation.md.
- If a result looks wrong, use troubleshooting.md before changing the circuit.
- For a tiny deterministic smoke check of Pauli expectations, run estimate_pauli_expectation.py:
python scripts/estimate_pauli_expectation.py --state bell --observable zz
python scripts/estimate_pauli_expectation.py --state zero --observable sum
Routing boundaries
- Route raw qubits, gates, moments, measurement keys, parameters, custom gates, JSON/QASM, and protocol mechanics to core-circuits-and-ops.
- Route simulator choice, noisy runs, sweeps, result objects, histograms at sampler depth, and plotting setup to simulation-study-and-noise.
- Route decomposition, optimizer passes, target gatesets, adjacency constraints, and hardware routing to transformers-and-compilation.
- Route provider packaging, cloud samplers, credentials, provider serializers, and widgets to hardware-providers-and-serialization.
API anchors covered here
- Built-in QFT:
cirq.qft(*qubits, without_reverse=False, inverse=False)andcirq.QuantumFourierTransformGate(num_qubits, without_reverse=False). - Observables:
cirq.PauliString(*contents, qubit_pauli_map=None, coefficient=1)andcirq.PauliSum(linear_dict=None); prefer arithmetic orPauliSum.from_pauli_stringsfor user code. - Exact expectations:
PauliString.expectation_from_state_vector(...),PauliSum.expectation_from_state_vector(...), and density-matrix counterparts. - Measurement of Pauli observables:
cirq.measure_single_paulistring(...)andcirq.measure_paulistring_terms(...). - Histogram/plot handoff:
cirq.Result.histogram, customfold_funcbitstrings, andcirq.plot_state_histogram(...)for plotting after simulation.
Validation stance
Favor small, deterministic validation circuits before scaling an algorithm. For textbook examples, validate one known setting with a state-vector or expectation-value check, then validate sampled behavior with explicit measurement keys and qubit order. Treat Shor/HHL-scale examples and full optimizer loops as educational or integration tests, not fast smoke tests.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.