Chuyển đến nội dung
Skillpedia
Lập trình chung48k · #4134

cirq

Skill này làm gì

Cirq là công cụ để tạo, mô phỏng và chạy chương trình trên máy tính lượng tử. Nó cho phép bạn xây dựng chuỗi các phép toán lượng tử, gọi là mạch (circuit), và xem chúng hoạt động ra sao.

Khi nào nên dùng

  • ✓Khi bạn muốn thử nghiệm với điện toán lượng tử.
  • ✓Khi đang học về mạch lượng tử.
  • ✓Để kiểm tra ý tưởng thuật toán lượng tử.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cirq/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một mạch lượng tử đơn giản với hai phép toán rồi mô phỏng nó.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn viết mã Python để định nghĩa các qubit (đơn vị cơ bản của thông tin lượng tử) và các phép toán bạn muốn áp dụng cho chúng. Sau đó, bạn có thể chạy mạch này trên một trình mô phỏng hoặc một máy tính lượng tử thật.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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:

…

Câu hỏi thường gặp

Qubit là gì?

Qubit giống như các “bit” trong máy tính thông thường, nhưng có thể là 0, 1 hoặc kết hợp của cả hai cùng lúc, giúp xử lý nhiều thông tin hơn.

Mạch lượng tử là gì?

Đó là chuỗi các chỉ dẫn cho máy tính lượng tử biết cần áp dụng phép toán nào lên các qubit để thực hiện một phép tính.

Tôi có chạy được trên máy tính của mình không?

Bạn có thể mô phỏng mạch lượng tử trên máy tính bằng Cirq, nhưng để chạy trên một máy tính lượng tử thật, bạn cần có quyền truy cập vào một máy như vậy.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4134
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự