Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindquantum.core.gates.PauliChannel

View Source On Gitee
class mindquantum.core.gates.PauliChannel(px: float, py: float, pz: float, **kwargs)[source]

A pauli channel.

Pauli channel express error that randomly applies an additional X, Y or Z gate on qubits with different probabilities Px, Py and Pz, or do noting (applies I gate) with probability 1PxPyPz.

Pauli channel applies noise as:

ϵ(ρ)=(1PxPyPz)ρ+PxXρX+PyYρY+PzZρZ

where ρ is quantum state as density matrix type; Px, Py and Pz is the probability of applying an additional X, Y and Z gate.

Parameters
  • px (int, float) – probability of applying X gate.

  • py (int, float) – probability of applying Y gate.

  • pz (int, float) – probability of applying Z gate.

Examples

>>> from mindquantum.core.gates import PauliChannel
>>> from mindquantum.core.circuit import Circuit
>>> circ = Circuit()
>>> circ += PauliChannel(0.8, 0.1, 0.1).on(0)
>>> circ.measure_all()
>>> print(circ)
      ╔══════════════════════════════╗ ┍━━━━━━┑
q0: ──╢ PC(px=4/5, py=1/10, pz=1/10) ╟─┤ M q0 ├───
      ╚══════════════════════════════╝ ┕━━━━━━┙
>>> from mindquantum.simulator import Simulator
>>> sim = Simulator('mqvector', 1)
>>> sim.sampling(circ, shots=1000, seed=42)
shots: 1000
Keys: q0│0.00     0.2         0.4         0.6         0.8         1.0
────────┼───────────┴───────────┴───────────┴───────────┴───────────┴
       0│▒▒▒▒▒▒▒

       1│▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

{'0': 101, '1': 899}
define_projectq_gate()[source]

Define the corresponded projectq gate.

get_cpp_obj()[source]

Get underlying C++ object.

matrix()[source]

Kraus operator of the quantum channel.

Returns

list, contains all Kraus operators of this quantum channel.