Agent skill

Mq Noisy Simulation

by mindspore-ai in mindspore-ai/mindquantum

Simulate noisy quantum circuits with MindQuantum. An agent skill from mindspore-ai/mindquantum.

Apache-2.0Auto-check passedResearch & Science

Install Mq Noisy Simulation

skills CLI
$ npx skills add mindspore-ai/mindquantum --skill mq-noisy-simulation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mindspore-ai/mindquantum mq-noisy-simulation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mindspore-ai/mindquantum.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mq-noisy-simulation .claude/skills/mq-noisy-simulation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mq-noisy-simulation
GitHub stars
102
Token cost
~2.2k tokens
SKILL.md length
405 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
Apache-2.0

At a glance

Simulate noisy quantum circuits with MindQuantum. An agent skill from mindspore-ai/mindquantum.

  • Works in 2 steps: Monte Carlo trajectories — add noise… → Density matrix — use mqmatrix backend…
  • The user mentions noise
  • SKILL.md covers Approach 1: Manual Noise…, Approach 2: ChannelAdder System, Approach 3: NoiseBackend and Approach 4: Density Matrix…, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Mq Noisy Simulation is an agent skill from mindspore-ai/mindquantum. Simulate noisy quantum circuits with MindQuantum. Covers noise channels (depolarizing, amplitude damping, phase damping, thermal relaxation, Kraus), the ChannelAdder system for systematic noise insertion, NoiseBackend for automatic noise injection, and density matrix simulation with mqmatrix. Use whenever the user mentions noise, decoherence, error rates, noise models, noisy simulation, density matrix, mixed states, ChannelAdder, quantum error channels, fidelity under noise, or wants to study how noise affects…

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Research & Science, covering Quantum computing. The repository describes itself as: MindQuantum is a quantum machine learning library that can be used to build and train different quantum neural networks. The licence is Apache-2.0.

When your agent uses it

  • The user mentions noise
  • Noisy simulation
  • Quantum error channels
  • Fidelity under noise

Example prompts

  • “/mq-noisy-simulation”

Requirements

  • Python 3

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Monte Carlo trajectories — add noise channels to circuits, sample via mqvector. Results are statistical and controlled by shots.
  2. Density matrix — use mqmatrix backend for exact mixed-state evolution. Deterministic, with O(4^n) memory scaling.

What it can do on your machine

Read from SKILL.md and the folder at commit 2a0ca08. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mq Noisy Simulation loads about 2.2k tokens when it runs. Until then it costs about 142 tokens; SKILL.md has 405 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~142
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mindspore-ai/mindquantum at commit 2a0ca08, republished under its Apache-2.0 licence (© mindspore-ai). 405 words, ~2,233 tokens.

Download SKILL.mdSave it as .claude/skills/mq-noisy-simulation/SKILL.md (or your agent's skills folder).
name
mq-noisy-simulation
description
Simulate noisy quantum circuits with MindQuantum. Covers noise channels (depolarizing, amplitude damping, phase damping, thermal relaxation, Kraus), the ChannelAdder system for systematic noise insertion, NoiseBackend for automatic noise injection, and density matrix simulation with mqmatrix. Use whenever the user mentions noise, decoherence, error rates, noise models, noisy simulation, density matrix, mixed states, ChannelAdder, quantum error channels, fidelity under noise, or wants to study how noise affects quantum circuits or algorithms.

Noisy Quantum Circuit Simulation

MindQuantum provides two approaches to noise simulation:

  1. Monte Carlo trajectories — add noise channels to circuits, sample via mqvector. Results are statistical and controlled by shots.
  2. Density matrix — use mqmatrix backend for exact mixed-state evolution. Deterministic, with O(4^n) memory scaling.

Approach 1: Manual Noise Channels

Add noise gates directly into your circuit like any other gate:

python
from mindquantum.core.circuit import Circuit
from mindquantum.core.gates import (
    H,
    CNOT,
    RX,
    Measure,
    DepolarizingChannel,
    AmplitudeDampingChannel,
    PhaseDampingChannel,
    BitFlipChannel,
    PauliChannel,
    ThermalRelaxationChannel,
)
from mindquantum.simulator import Simulator

# Build noisy circuit
circ = Circuit()
circ += H.on(0)
circ += DepolarizingChannel(0.01).on(0)  # 1% depolarizing after H
circ += CNOT.on(1, 0)
circ += DepolarizingChannel(0.02).on(0)  # 2% after CNOT (per qubit)
circ += DepolarizingChannel(0.02).on(1)
circ += Measure().on(0)
circ += Measure().on(1)

# Simulate via Monte Carlo sampling
sim = Simulator("mqvector", 2)
result = sim.sampling(circ, shots=10000)
print(result.data)  # {'00': 4980, '11': 4720, '01': 150, '10': 150}
result.svg()  # Visualize histogram
Available Noise Channels
ChannelConstructorPhysical Model
BitFlipChannelBitFlipChannel(p)X gate with probability p
PhaseFlipChannelPhaseFlipChannel(p)Z gate with probability p
BitPhaseFlipChannelBitPhaseFlipChannel(p)Y gate with probability p
DepolarizingChannelDepolarizingChannel(p)Random X/Y/Z each with p/3
PauliChannelPauliChannel(px, py, pz)Custom Pauli probabilities
AmplitudeDampingChannelAmplitudeDampingChannel(γ)Energy decay (T1 process)
PhaseDampingChannelPhaseDampingChannel(γ)Dephasing (T2 process)
ThermalRelaxationChannelThermalRelaxationChannel(T1, T2, gate_time)Combined T1/T2 relaxation
KrausChannelKrausChannel('name', [K0, K1, ...])Arbitrary Kraus operators
GroupedPauliChannelGroupedPauliChannel(probs).on(qubits)Batched per-qubit Pauli channels; probs has shape (n_qubits, 3)
Helper: Add Noise After Every Gate
python
from mindquantum.core.gates import DepolarizingChannel, Measure, NoiseGate


def add_noise_to_circuit(circuit, p_depol=0.01):
    """Insert depolarizing noise after every non-noise, non-measure gate."""
    noisy = Circuit()
    for gate in circuit:
        noisy += gate
        if not isinstance(gate, (Measure, NoiseGate)):
            for q in gate.obj_qubits:
                noisy += DepolarizingChannel(p_depol).on(q)
    return noisy

Approach 2: ChannelAdder System

For systematic, configurable noise injection without manually editing circuits. Uses rules to decide which gates get noise.

python
from mindquantum.core.circuit.channel_adder import (
    ChannelAdderBase,
    BitFlipAdder,
    DepolarizingChannelAdder,
    MeasureAccepter,
    NoiseExcluder,
    QubitIDConstrain,
    QubitNumberConstrain,
    GateSelector,
    SequentialAdder,
    MixerAdder,
    ReverseAdder,
)
Built-in Adders
AdderPurpose
BitFlipAdder(p)Add BitFlipChannel after matching gates
DepolarizingChannelAdder(p, n_qubits)Add DepolarizingChannel
MeasureAccepterSelect only measurement gates
NoiseExcluderExclude existing noise gates from re-noising
QubitIDConstrain(qubit_ids)Select gates whose participating qubits are all in qubit_ids
QubitNumberConstrain(n)Only add noise to n-qubit gates
GateSelector(gate)Select a supported gate by name, such as "H" or "CX"
SequentialAdder([adder1, adder2])Apply multiple adders in sequence
MixerAdder([adder1, adder2])Add noise only if ALL sub-adders agree
ReverseAdder(adder)Flip accept/reject logic
Show full SKILL.md (164 more words)Show less
Example: Realistic Noise Model
python
from mindquantum.core.circuit.channel_adder import (
    DepolarizingChannelAdder,
    QubitNumberConstrain,
    MixerAdder,
    SequentialAdder,
)

# Different noise rates for 1-qubit vs 2-qubit gates
single_qubit_noise = MixerAdder(
    [
        DepolarizingChannelAdder(0.001, 1),
        QubitNumberConstrain(1),
    ]
)
two_qubit_noise = MixerAdder(
    [
        DepolarizingChannelAdder(0.01, 2),
        QubitNumberConstrain(2),
    ]
)
noise_model = SequentialAdder([single_qubit_noise, two_qubit_noise])
Custom ChannelAdder
python
from mindquantum.core.circuit.channel_adder import ChannelAdderBase
from mindquantum.core.circuit import Circuit
from mindquantum.core.gates import DepolarizingChannel, Measure, NoiseGate


class QubitSpecificDepolarizing(ChannelAdderBase):
    """Apply different noise rates per qubit."""

    def __init__(self, qubit_id, p):
        self.qubit_id = qubit_id
        self.p = p
        super().__init__()

    def _accepter(self):
        return [lambda g: self.qubit_id in g.obj_qubits or self.qubit_id in g.ctrl_qubits]

    def _excluder(self):
        return [lambda g: isinstance(g, (Measure, NoiseGate))]

    def _handler(self, gate):
        return Circuit([DepolarizingChannel(self.p).on(self.qubit_id)])

Approach 3: NoiseBackend

Wraps a simulator backend to automatically inject noise via a ChannelAdder:

python
from mindquantum.simulator import Simulator
from mindquantum.simulator.noise import NoiseBackend

# Create noisy simulator
noise_sim = Simulator(NoiseBackend("mqvector", n_qubits, noise_model))

# Use exactly like a normal simulator
result = noise_sim.sampling(circuit, shots=10000)

# Inspect the transformed circuit (with noise inserted)
noisy_circ = noise_sim.backend.transform_circ(circuit)
noisy_circ.svg()  # See where noise channels were added

Approach 4: Density Matrix (mqmatrix)

For density-matrix noise simulation:

python
sim = Simulator("mqmatrix", 4)
sim.apply_circuit(noisy_circuit)

# Density matrix operations
rho = sim.get_qs()  # Full density matrix
entropy = sim.entropy()  # Von Neumann entropy
purity = sim.purity()  # Tr(ρ²)
rho_sub = sim.get_partial_trace([0, 1])  # Trace out qubits 0,1
mqmatrix vs mqvector Characteristics
Factormqvector + Monte Carlomqmatrix
State sizeO(2^n)O(4^n)
SamplingStatistical, controlled by shotsNot shot-based for a single density-matrix evolution
Mixed-state queriesNot represented as a density matrixEntropy, purity, partial trace
Gradient supportSupported by simulator gradient APIsSupported, but circ_left and simulator_left are rejected

Noisy VQE Example

python
from mindquantum.core.circuit import Circuit
from mindquantum.core.gates import RY, CNOT, DepolarizingChannel
from mindquantum.core.operators import QubitOperator, Hamiltonian
from mindquantum.simulator import Simulator
import numpy as np
from scipy.optimize import minimize

# Noisy ansatz
ansatz = Circuit()
ansatz += RY("a0").on(0)
ansatz += DepolarizingChannel(0.005).on(0)
ansatz += RY("a1").on(1)
ansatz += DepolarizingChannel(0.005).on(1)
ansatz += CNOT.on(1, 0)
ansatz += DepolarizingChannel(0.01).on(0)
ansatz += DepolarizingChannel(0.01).on(1)

ham = Hamiltonian(QubitOperator("Z0 Z1") + QubitOperator("X0", 0.5))
sim = Simulator("mqvector", 2)
grad_ops = sim.get_expectation_with_grad(ham, ansatz)


def cost(params):
    f, _ = grad_ops(params)
    return np.real(f)[0, 0]


# Example gradient-free SciPy optimizer
result = minimize(cost, np.zeros(2), method="Nelder-Mead")
print(f"Noisy VQE energy: {result.fun:.6f}")

Raw Memory Guide

QubitsState vector raw sizeDensity matrix raw size
10~16 KB~16 MB
13~128 KB~1 GB
15~512 KB~16 GB
20~16 MB~16 TB
25~512 MB~16 PB
30~16 GB~16 EB

The table assumes complex128 storage only and does not include simulator overhead. When the dense density matrix is too large for the target machine, use state-vector sampling with noise channels and increase shots according to the statistical precision needed.

© mindspore-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/mq-noisy-simulation of mindspore-ai/mindquantum.

Open the folder on GitHubat commit 2a0ca08

Compare with similar skills

Mq Noisy Simulation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mq Noisy Simulation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mq Noisy Simulation this skillmindspore-ai/mindquantum102—~2.2kAutomated safety check: PassApache-2.0
Qiskit 2.x Quantum ML Referenceaiming-lab/AutoResearchClaw15k—~4.7kAutomated safety check: PassMIT
QutipzLanqing/codex-claude-academic-skills4.7k8 repos~2.3kAutomated safety check: PassBSD-3-Clause
Cirqdavila7/claude-code-templates33k11 repos~2.7kAutomated safety check: PassMIT
Qiskitdavila7/claude-code-templates33k9 repos~2.2kAutomated safety check: PassMIT
Pennylanedavila7/claude-code-templates33k7 repos~1.9kAutomated safety check: PassMIT

Similar skills

  • Qiskit 2.x Quantum ML Reference

    aiming-lab/AutoResearchClaw

    Reference patterns for writing qiskit 2.x code for variational quantum machine learning: feature maps, VQC training, VQE for chemistry, MPS circuits and noise models.

    15k GitHub stars~4.7k tokensUpdated 1 mo ago
    Research & ScienceAuto-check passed
  • Qutip

    zLanqing/codex-claude-academic-skills

    Quantum physics simulation library for open quantum systems.

    4.7k GitHub starsUsed in 8 repos~2.3k tokens
    Research & ScienceAuto-check passed
  • Cirq

    davila7/claude-code-templates

    Quantum computing framework for building, simulating, optimizing, and executing quantum circuits.

    33k GitHub starsUsed in 11 repos~2.7k tokens
    Research & ScienceAuto-check passed
  • Qiskit

    davila7/claude-code-templates

    Comprehensive quantum computing toolkit for building, optimizing, and executing quantum circuits.

    33k GitHub starsUsed in 9 repos~2.2k tokens
    Research & ScienceAuto-check passed
  • Pennylane

    davila7/claude-code-templates

    Cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry.

    33k GitHub starsUsed in 7 repos~1.9k tokens
    Research & ScienceAuto-check passed
  • Qiskit

    K-Dense-AI/scientific-agent-skills

    Builds, simulates, transpiles, and executes quantum circuits with Qiskit and IBM Quantum Runtime.

    48k GitHub starsUsed in 1 repo~3.3k tokens
    Research & ScienceAuto-check passed

More from mindspore-ai/mindquantum

  • Mindquantum

    mindspore-ai/mindquantum

    Build, simulate, and analyze quantum circuits with MindQuantum.

    102 GitHub stars~2.3k tokensUpdated 19 days ago
    Auto-check passed
  • Mq Circuit Compiler

    mindspore-ai/mindquantum

    Compile and optimize quantum circuits for hardware execution using MindQuantum's compiler pipeline.

    102 GitHub stars~1.7k tokensUpdated 19 days ago
    Auto-check passed
  • Mq Qaia Solver

    mindspore-ai/mindquantum

    Solve Ising/QUBO-style combinatorial optimization problems using MindQuantum's Quantum Annealing-Inspired Algorithms (QAIA).

    102 GitHub stars~2.2k tokensUpdated 19 days ago
    Auto-check passed
  • Mq Quantum Chemistry

    mindspore-ai/mindquantum

    Run quantum chemistry simulations with MindQuantum. An agent skill from mindspore-ai/mindquantum.

    102 GitHub stars~2.2k tokensUpdated 19 days ago
    Auto-check passed
  • Mq Variational Training

    mindspore-ai/mindquantum

    Build and train variational quantum algorithms (VQE, QAOA, QML, QNN) with MindQuantum.

    102 GitHub stars~2.5k tokensUpdated 19 days ago
    Auto-check passed

Questions about Mq Noisy Simulation

What does Mq Noisy Simulation do?

Simulate noisy quantum circuits with MindQuantum. An agent skill from mindspore-ai/mindquantum. Mq Noisy Simulation is an agent skill from mindspore-ai/mindquantum. Simulate noisy quantum circuits with MindQuantum.

When should I use Mq Noisy Simulation?

Mq Noisy Simulation fits situations like: the user mentions noise; noisy simulation; quantum error channels; fidelity under noise.

How do I install Mq Noisy Simulation in Claude Code?

Run `npx skills add mindspore-ai/mindquantum --skill mq-noisy-simulation -a claude-code`. Or copy the skill folder (skills/mq-noisy-simulation in mindspore-ai/mindquantum) into .claude/skills/mq-noisy-simulation in your project. Claude Code loads it when a task matches its description.

How do I install Mq Noisy Simulation in Codex?

Run `npx skills add mindspore-ai/mindquantum --skill mq-noisy-simulation -a codex`. Or copy the skill folder (skills/mq-noisy-simulation in mindspore-ai/mindquantum) into .agents/skills/mq-noisy-simulation in your project. Codex loads it when a task matches its description.

Can I use Mq Noisy Simulation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mindspore-ai/mindquantum --skill mq-noisy-simulation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mq-noisy-simulation, .gemini/skills/mq-noisy-simulation, .github/skills/mq-noisy-simulation and .opencode/skills/mq-noisy-simulation in your project.

What does Mq Noisy Simulation need to run?

SKILL.md names no scripts, command-line tools or credentials: Mq Noisy Simulation is instructions for the agent only. Our summary lists: Python 3.

Does Mq Noisy Simulation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mq Noisy Simulation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mq Noisy Simulation use?

Mq Noisy Simulation is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mq Noisy Simulation use?

About 2.2k tokens (SKILL.md is roughly 8.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mq Noisy Simulation?

Skills that share tags, products or a category with Mq Noisy Simulation: Qiskit 2.x Quantum ML Reference (aiming-lab/AutoResearchClaw, 15k stars), Qutip (zLanqing/codex-claude-academic-skills, 4.7k stars), Cirq (davila7/claude-code-templates, 33k stars) and Qiskit (davila7/claude-code-templates, 33k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mq Noisy Simulation?

mindspore-ai (a GitHub organization) maintains it in mindspore-ai/mindquantum, which has 102 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on September 21, 2026.

Source: mindspore-ai/mindquantum on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.