Zum Inhalt springen
Skillpedia
Allgemeines Programmieren51k · #3438

cirq

Was er macht

Cirq ist ein Tool zum Erstellen und Testen von Programmen für Quantencomputer. Du kannst damit Quantenschaltkreise bauen, simulieren, wie sie funktionieren würden, und sie auf echten Quantencomputern ausführen, besonders auf denen von Google.

Wann du ihn nutzt

  • ✓Du möchtest Quantenschaltkreise in Python bauen und testen.
  • ✓Du musst Experimente auf der Quantenhardware von Google durchführen.
  • ✓Du möchtest simulieren, wie sich ein Quantenschaltkreis verhält, einschließlich möglicher Fehler.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/cirq/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Erstelle einen einfachen Quantenschaltkreis mit zwei Qubits, wende ein Hadamard-Gatter auf eines an und ein CNOT-Gatter zwischen beiden, und sag mir das Messergebnis.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Mit Cirq definierst du die grundlegenden Bausteine eines Quantencomputers, etwa Qubits und Logikgatter. Diese Bausteine setzt du dann zu einem Schaltkreis zusammen und nutzt Simulatoren oder echte Hardware, um zu sehen, was passiert.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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

…

Häufige Fragen

Was sind Quantenschaltkreise?

Quantenschaltkreise sind so etwas wie Programme für Quantencomputer. Sie bestehen aus Qubits (der Grundeinheit der Quanteninformation) und Quantengattern (Operationen, die den Zustand der Qubits verändern).

Kann ich Cirq auf jedem Quantencomputer nutzen?

Cirq ist für die Hardware von Google optimiert, lässt sich aber auch mit anderen Anbietern wie IonQ und Azure Quantum verwenden. Für IBM-Hardware ist Qiskit die bessere Wahl.

Was ist Rauschsimulation?

Quantencomputer sind empfindlich gegenüber Fehlern (Rauschen). Die Rauschsimulation in Cirq hilft dir vorherzusagen, wie sich diese Fehler auf das Ergebnis deines Schaltkreises auswirken könnten.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
51k
Platz im Ranking
#3438
Lizenz
MIT
Aktualisiert
15.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills