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

View Source On Gitee
class mindquantum.core.gates.GroupedPauliChannel(probs: npt.NDArray[np.float64], **kwargs)[source]

A group of pauli channels.

This quantum channel is equivalent to a list of pauli channels, but will evaluate much faster than apply them one by one. For detail of pauli channel, please refers to PauliChannel.

ϵ(ρ)=iϵpaulii(ρ)
Parameters

probs (numpy.ndarray) – The error probabilities of pauli channel. It has dimension of (n, 3), where the first dimension n is the qubit number or the number of pauli channels represented by this quantum channel . The second dimension 3 represents the probability of applying X, Y or Z gate.

Examples

>>> import numpy as np
>>> from mindquantum.core.gates import GroupedPauliChannel
>>> from mindquantum.core.circuit import Circuit
>>> from mindquantum.simulator import Simulator
>>> probs = np.array([[1.0, 0.0, 0.0], [0.0, 0.3, 0.0]])
>>> circ = Circuit([GroupedPauliChannel(probs).on([0, 1])]).measure_all()
>>> circ
      ╭ ╔═══Grouped Pauli Channel     ╮ ┍━━━━━━┑
q0: ──┤─╢ PC(px=1, py=0, pz=0) ╟──────├─┤ M q0 ├───
      │ ╚══════════════════════╝      │ ┕━━━━━━┙
      │ ╔═════════════════════════╗   │ ┍━━━━━━┑
q1: ──┤─╢ PC(px=0, py=3/10, pz=0) ╟───├─┤ M q1 ├───
      ╰ ╚═════════════════════════╝   ╯ ┕━━━━━━┙
>>> Simulator('mqvector', circ.n_qubits).sampling(circ, shots=1000, seed=42)
shots: 1000
Keys: q1 q0│0.00   0.177       0.355       0.532        0.71       0.887
───────────┼───────────┴───────────┴───────────┴───────────┴───────────┴
         01│▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

         11│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

{'01': 710, '11': 290}
get_cpp_obj()[source]

Get underlying C++ object.

matrix()[source]

Kraus operator of the quantum channel.

Returns

list, contains all Kraus operators of every pauli channel.