本文へスキップ
Skillpedia
一般的なプログラミング48k · #4134

cirq

できること

Cirqは、量子コンピュータ向けのプログラムを作成、シミュレーション、実行するためのツールです。量子演算の並びである「回路(circuit)」を組み立て、その振る舞いを確認できます。

使う場面

  • ✓量子コンピューティングを試してみたいとき。
  • ✓量子回路について学んでいるとき。
  • ✓量子アルゴリズムのアイデアを検証するとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cirq/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cirq/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“2つの操作を含む簡単な量子回路を作成し、シミュレーションしてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

Pythonのコードで、量子ビット(量子情報の基本単位)と、それに適用したい操作を定義します。その後、この回路をシミュレーターまたは実機の量子コンピュータで実行できます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Bundled upstream support

Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.

Cirq - Quantum Computing with Python

Cirq is Google Quantum AI's open-source framework for designing, simulating, and running quantum circuits on quantum computers and simulators.

When to Use

  • You are designing, simulating, or executing quantum circuits with the Cirq ecosystem.
  • You need Google Quantum AI-style primitives, parameterized circuits, or integrations like cirq-google and cirq-ionq.
  • You are prototyping or teaching quantum workflows in Python and want concrete circuit examples.

Installation

uv pip install cirq

For hardware integration:

# Google Quantum Engine
uv pip install cirq-google

# IonQ
uv pip install cirq-ionq

# AQT (Alpine Quantum Technologies)
uv pip install cirq-aqt

# Pasqal
uv pip install cirq-pasqal

# Azure Quantum
uv pip install azure-quantum cirq

Quick Start

Basic Circuit

import cirq
import numpy as np

# Create qubits
q0, q1 = cirq.LineQubit.range(2)

# Build circuit
circuit = cirq.Circuit(
    cirq.H(q0),              # Hadamard on q0
    cirq.CNOT(q0, q1),       # CNOT with q0 control, q1 target
    cirq.measure(q0, q1, key='result')
)

print(circuit)

# Simulate
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=1000)

# Display results
print(result.histogram(key='result'))

Parameterized Circuit

import sympy

# Define symbolic parameter
theta = sympy.Symbol('theta')

# Create parameterized circuit
circuit = cirq.Circuit(
    cirq.ry(theta)(q0),
    cirq.measure(q0, key='m')
)

# Sweep over parameter values
sweep = cirq.Linspace('theta', start=0, stop=2*np.pi, length=20)
results = simulator.run_sweep(circuit, params=sweep, repetitions=1000)

# Process results
for params, result in zip(sweep, results):
    theta_val = params['theta']
    counts = result.histogram(key='m')
    print(f"θ={theta_val:.2f}: {counts}")

Core Capabilities

Circuit Building

For comprehensive information about building quantum circuits, including qubits, gates, operations, custom gates, and circuit patterns, see:

  • references/building.md - Complete guide to circuit construction

Common topics:

  • Qubit types (GridQubit, LineQubit, NamedQubit)
  • Single and two-qubit gates
  • Parameterized gates and operations
  • Custom gate decomposition
  • Circuit organization with moments
  • Standard circuit patterns (Bell states, GHZ, QFT)
  • Import/export (OpenQASM, JSON)
  • Working with qudits and observables

Simulation

For detailed information about simulating quantum circuits, including exact simulation, noisy simulation, parameter sweeps, and the Quantum Virtual Machine, see:

  • references/simulation.md - Complete guide to quantum simulation

Common topics:

  • Exact simulation (state vector, density matrix)
  • Sampling and measurements
  • Parameter sweeps (single and multiple parameters)
  • Noisy simulation
  • State histograms and visualization
  • Quantum Virtual Machine (QVM)
  • Expectation values and observables
  • Performance optimization

Circuit Transformation

For information about optimizing, compiling, and manipulating quantum circuits, see:

  • references/transformation.md - Complete guide to circuit transformations

Common topics:

  • Transformer framework
  • Gate decomposition
  • Circuit optimization (merge gates, eject Z gates, drop negligible operations)
  • Circuit compilation for hardware
  • Qubit routing and SWAP insertion
  • Custom transformers
  • Transformation pipelines

Hardware Integration

For information about running circuits on real quantum hardware from various providers, see:

  • references/hardware.md - Complete guide to hardware integration

Supported providers:

  • Google Quantum AI (cirq-google) - Sycamore, Weber processors
  • IonQ (cirq-ionq) - Trapped ion quantum computers
  • Azure Quantum (azure-quantum) - IonQ and Honeywell backends
  • AQT (cirq-aqt) - Alpine Quantum Technologies
  • Pasqal (cirq-pasqal) - Neutral atom quantum computers

Topics include device representation, qubit selection, authentication, job management, and circuit optimization for hardware.

Noise Modeling

For information about modeling noise, noisy simulation, characterization, and error mitigation, see:

  • references/noise.md - Complete guide to noise modeling

Common topics:

…

よくある質問

量子ビットとは何ですか?

量子ビットは通常のコンピュータの「ビット」に似ていますが、0か1、またはその両方の組み合わせを同時に取ることができるため、より多くの情報を処理できます。

量子回路とは何ですか?

量子コンピュータに対して、計算を行うためにどの操作を量子ビットに適用するかを指示する命令の並びです。

自分のコンピュータで実行できますか?

Cirqを使えば、自分のコンピュータで量子回路をシミュレーションできます。ただし、実際の量子コンピュータで実行するには、そのマシンへのアクセスが必要です。

詳細

作者による元の説明

Cirq is Google Quantum AI's open-source framework for designing, simulating, and running quantum circuits on quantum computers and simulators.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#4134
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル