Перейти к содержанию
Skillpedia
Код в целом51k · #3438

cirq

Что он делает

Cirq — это инструмент для создания и тестирования программ для квантовых компьютеров. Он позволяет собирать квантовые схемы, моделировать их работу и запускать их на реальных квантовых компьютерах, в первую очередь на оборудовании Google.

Когда использовать

  • ✓Вы хотите создавать и тестировать квантовые схемы на Python.
  • ✓Вам нужно проводить эксперименты на квантовом оборудовании Google.
  • ✓Вы хотите смоделировать поведение квантовой схемы, включая возможные ошибки.

Ссылка на скилл

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/cirq/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/cirq/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Создай простую квантовую схему из двух кубитов, примени вентиль Адамара к одному из них и вентиль CNOT между ними, и скажи, каким будет результат измерения.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Cirq позволяет задать базовые элементы квантового компьютера, например кубиты и логические вентили. Затем вы собираете их в схему и используете симуляторы или реальное оборудование, чтобы увидеть результат.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

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 This Skill

Use this skill when:

  • Building, simulating, or optimizing NISQ circuits in Python
  • Running jobs on Google Quantum AI processors (via cirq-google) or partner backends (IonQ, Azure Quantum, AQT, Pasqal)
  • Modeling noise, compiling to hardware gatesets, or designing characterization experiments
  • Using parameter sweeps, transformers, or the ReCirq experiment patterns

For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

Installation

Examples target Cirq 1.7.0 on Python 3.11+. Keep Cirq vendor packages on the matching release; independently versioned integrations such as Azure Quantum need their own compatibility check.

uv pip install "cirq-core==1.7.0"
# Optional OpenQASM import dependency
uv pip install ply

For hardware integration (pin matching versions for reproducibility):

# Google Quantum Engine (requires approved GCP project access)
uv pip install "cirq-google==1.7.0"

# IonQ
uv pip install "cirq-ionq==1.7.0"

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

# Pasqal
uv pip install "cirq-pasqal==1.7.0"

# Azure: use a SEPARATE environment; its current extras require Cirq <1.7.
uv pip install "qdk[azure,cirq]==1.32.3" "azure-quantum==3.13.0"

Pin all cirq-* packages in an environment to the same release. The Azure example targets its supported Cirq 1.6.1 stack separately; do not force Cirq 1.7.0 into it. Cirq 1.7.0 updates the IonQ adapter to API v0.4.

Local examples were checked with synthetic circuits. Hardware examples are illustrative and were checked against released source and provider documentation, without submitting cloud jobs. See review evidence.

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(seed=42)
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:

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:

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:

Common topics:

  • Transformer framework
  • Gate decomposition

…

Частые вопросы

Что такое квантовые схемы?

Квантовые схемы — это что-то вроде программ для квантовых компьютеров. Они состоят из кубитов (базовой единицы квантовой информации) и квантовых вентилей (операций, которые меняют состояние кубитов).

Можно ли использовать Cirq на любом квантовом компьютере?

Cirq оптимизирован для оборудования Google, но его также можно использовать с другими провайдерами, например IonQ и Azure Quantum. Для оборудования IBM лучше использовать Qiskit.

Что такое моделирование шума?

Квантовые компьютеры чувствительны к ошибкам (шуму). Моделирование шума в Cirq помогает предсказать, как эти ошибки могут повлиять на результат вашей схемы.

Подробности

Оригинальное описание автора

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

repo: K-Dense-AI/scientific-agent-skills

Популярность

Звёзды на GitHub
51k
Место в рейтинге
#3438
Лицензия
MIT
Обновлён
15.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы