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.DepolarizingChannel

View Source On Gitee
class mindquantum.core.gates.DepolarizingChannel(p: float, n_qubits: int = 1, **kwargs)[source]

A depolarizing channel.

Depolarizing channel express errors that have probability P to turn qubit's quantum state into maximally mixed state, by randomly applying one of the pauli gate(I,X,Y,Z) with same probability P/4. And it has probability 1P to change nothing.

In one qubit case, depolarizing channel applies noise as:

ϵ(ρ)=(1P)ρ+P/4(IρI+XρX+YρY+ZρZ)

where ρ is quantum state as density matrix type; P is the probability of occurred the depolarizing error.

This channel supports many object qubits. In N qubit case, depolarizing channel applies noise as:

ϵ(ρ)=(1P)ρ+P4NjUjρUj

where N is the number of object qubits; Uj{I,X,Y,Z}N is many qubit pauli operator.

  • For 0P1 case, this channel is a depolarizing channel, and it becomes a completely depolarizing channel when P=1.

  • However, 1<P4N/(4N1) is also an available case, but not a depolarizing channel any more. When P=4N/(4N1) it becomes a uniform Pauli error channel: E(ρ)=jVjρVj/(4n1), where Vj=UjIN.

Parameters
  • p (int, float) – probability of occurred depolarizing error.

  • n_qubits (int) – qubit number of this depolarizing channel. Default: 1.

Examples

>>> from mindquantum.core.gates import DepolarizingChannel
>>> from mindquantum.core.circuit import Circuit
>>> circ = Circuit()
>>> circ += DepolarizingChannel(0.02).on(0)
>>> circ += DepolarizingChannel(0.01, 2).on([0, 1])
>>> print(circ)
      ╔════════════╗ ╔═════════════╗
q0: ──╢ DC(p=1/50) ╟─╢             ╟───
      ╚════════════╝ ║             ║
                     ║ DC(p=1/100) ║
q1: ─────────────────╢             ╟───
                     ╚═════════════╝
get_cpp_obj()[source]

Get underlying C++ object.

matrix()[source]

Kraus operator of the quantum channel.

Returns

list, the kraus matrix of this operator, while order of output is in dictionary

order of {I,X,Y,Z}N.