참고
이 페이지는 tutorials/simulators/5_noise_transformation.ipynb 에서 생성되었다.
노이즈 변환¶
소개¶
이 노트북은 양자 노이즈 채널을 보다 적합한 다른 노이즈 채널로 변환하기 위해 Qiskit Aer 효용 함수인 approximate_quantum_error
와 approximate_noise_model
을 사용하는 방법을 보여준다.
Our guiding example is Clifford simulation. A Clifford simulator can efficiently simulate quantum computations which include gates only from a limited, non-universal set of gates (the Clifford gates). Not all quantum noises can be added to such simulations; hence, we aim to find a 《close》 noise channel which can be simulated in a Clifford simulator.
먼저, Aer 공급자 유틸리티에서 변환 함수를 가져온다.
[1]:
from qiskit_aer.utils import approximate_quantum_error, approximate_noise_model
The name 《approximate》 suggests that these functions generate the closest (in the Hilbert-Schmidt metric) error possible to the given one.
Qiskit에 정의된 여러 개의 표준 에러 채널을 사용하여 근사를 증명한다.
[2]:
import numpy as np
# Import Aer QuantumError functions that will be used
from qiskit_aer.noise import amplitude_damping_error, reset_error, pauli_error
from qiskit.quantum_info import Kraus
개요¶
1-큐비트 양자 채널은 (이미지가 밀도 연산자 \(\mathcal{C}\) 가 완전히 양의 값이 되고, 보존을 추적도록) 밀도 연산자를 다른 밀도 연산자공간으로 사상하는 함수 \(\mathcal{C}:\mathbb{C}^{2\times2}\to\mathbb{C}^{2\times2}\) 이다. 여기서 완전히 양의 값이 되고, 보존을 추적하는 것은 completely positive and trace preserving, CPTP 라 한다.
주어진 양자 채널 \(\mathcal{E}_{1},\dots,\mathcal{E}_{r}\), 그리고 \(0\le p_i \le 1\) 와 \(p_1+\dots +p_r = 1\) 와 같은 확률 \(p_1, p_2, \dots, p_r\) 으로 새로운 양자 채널 \(\mathcal{C}_\mathcal{E}\) 은 \(\mathcal{C}_\mathcal{E}(\rho)\) 이 확률 \(p_i\) 으로 채널 \(\mathcal{E}_i\) 을 선택하고, \(\rho\) 에 적용하는 효과를 가지도록 구성될 수 있다.
The noise transformation function solves the following optimization problem: Given a channel \(\mathcal{C}\) (《goal》) and a list of channels \(\mathcal{E}_{1},\dots,\mathcal{E}_{r}\), find the probabilities \(p_1, p_2, \dots, p_r\) minimizing \(D(\mathcal{C}, \mathcal{C}_\mathcal{E})\) according to some distance metric \(D\) (the Hilbert-Schmidt metric is currently used).
To ensure the approximation is honest, in the sense that the approximate error channel serves as an 《upper bound》 for the actual error channel, we add the additional honesty constraint:
여기서 \(\text{F}\) 은 정확성 측정이고, \(I\) 은 단위 채널이다.
예제: 진폭 감폭 노이즈(Amplitude damping noise) 를 초기화 노이즈(reset noise) 로 근사하기¶
진폭 감폭 노이즈는 단일 파라미터 \(0\le \gamma \le 1\) 로 설명되며, 크라우스 연산자에 의해 주어진다.
초기화 오류는 \(p+q\le 1\) 과 같은 확률 \(0\le p, q\le 1\) 로 설명되며 크라우스 연산자는 다음과 같이 부여한다.
This can be thought of as 《resetting》 the quantum state of the affected qubit to \(\left|0\right\rangle\) with probability \(p\), to \(\left|1\right\rangle\) with probability \(q\), and do nothing with probability \(1-(p+q)\).
\(p, q\) 의 최상의 값을 분석적으로 판별하여 \(\gamma\) 진폭 감쇠 채널을 근사화하는 것은 어렵지 않다. 자세한 정보는 ** 여기 * * 에서 확인할 수 있다. 가장 근사한 값은 다음과 같다.
[3]:
gamma = 0.23
error = amplitude_damping_error(gamma)
results = approximate_quantum_error(error, operator_string="reset")
우리는 실제 근사치를 수행하기 위해 위의 코드만 필요한다.
[4]:
print(results)
p = (1 + gamma - np.sqrt(1 - gamma)) / 2
q = 0
print("")
print("Expected results:")
print("P(0) = {}".format(1-(p+q)))
print("P(1) = {}".format(p))
print("P(2) = {}".format(q))
QuantumError on 1 qubits. Noise circuits:
P(0) = 0.8237482193044617, Circuit =
┌───┐
q: ┤ I ├
└───┘
P(1) = 0.17625178069553835, Circuit =
q: ─|0>─
P(2) = 2.158685879252966e-23, Circuit =
┌───┐
q: ─|0>─┤ X ├
└───┘
Expected results:
P(0) = 0.8237482193696062
P(1) = 0.17625178063039387
P(2) = 0
우리는 그 결과를 분석적으로 예측했다.
다양한 입력 유형¶
근사 함수에는 두 가지 입력이 있다. 근사할 오류 채널 및 근사치를 구성하는 데 사용할 수 있는 오류 채널 세트이다.
근사치의 오류 채널 은 QuantumError
객체로 변환할 수 있는 모든 입력으로 지정할 수 있다.
예를 들어, 우리는 명시적으로 진폭 감폭의 크라우스 행렬을 구성하고 이전과 동일한 근사 함수로 전달한다.
[5]:
gamma = 0.23
K0 = np.array([[1,0],[0,np.sqrt(1-gamma)]])
K1 = np.array([[0,np.sqrt(gamma)],[0,0]])
results = approximate_quantum_error(Kraus([K0, K1]), operator_string="reset")
print(results)
QuantumError on 1 qubits. Noise circuits:
P(0) = 0.8237482193044623, Circuit =
┌───┐
q: ┤ I ├
└───┘
P(1) = 0.1762517806955376, Circuit =
q: ─|0>─
P(2) = 6.463899246563026e-23, Circuit =
┌───┐
q: ─|0>─┤ X ├
└───┘
근사 채널을 구성하는 데 사용되는 오류 연산자 는 목록, 사전 또는 하드 코딩된 채널을 나타내는 문자열로 지정할 수 있다.
Any channel can be either a list of Kraus operators, or 〈QuantumError〉 objects.
식별 채널을 직접 전달할 필요는 없다. 이는 항상 암묵적으로 사용된다.
예를 들어 재설정 노이즈에 대한 명시적 크라우스 표현을 사용하여 진폭 감폭에 근사치를 산출한다.
[6]:
reset_to_0 = Kraus([np.array([[1,0],[0,0]]), np.array([[0,1],[0,0]])])
reset_to_1 = Kraus([np.array([[0,0],[1,0]]), np.array([[0,0],[0,1]])])
reset_kraus = [reset_to_0, reset_to_1]
gamma = 0.23
error = amplitude_damping_error(gamma)
results = approximate_quantum_error(error, operator_list=reset_kraus)
print(results)
QuantumError on 1 qubits. Noise circuits:
P(0) = 0.8237482193044617, Circuit =
┌───┐
q: ┤ I ├
└───┘
P(1) = 0.17625178069553835, Circuit =
┌───────┐
q: ┤ kraus ├
└───────┘
P(2) = 2.158685879252966e-23, Circuit =
┌───────┐
q: ┤ kraus ├
└───────┘
출력 채널의 차이를 참고하라. 확률은 같지만 입력 크라우스 연산자는 클리포드 시뮬레이터에서 사용할 수 없는 일반 크라우스 채널로 변환되었다. 따라서 가능하면 크라우스 행렬 대신 QuantumError
객체를 패스하는 것이 항상 더 좋다.
[7]:
import qiskit.tools.jupyter
%qiskit_version_table
%qiskit_copyright
Version Information
Qiskit Software | Version |
---|---|
qiskit-terra | 0.24.0.dev0+dba2eff |
qiskit-aer | 0.11.2 |
qiskit-ignis | 0.7.1 |
qiskit-ibmq-provider | 0.20.0 |
qiskit | 0.41.0 |
System information | |
Python version | 3.8.11 |
Python compiler | Clang 12.0.5 (clang-1205.0.22.11) |
Python build | default, Jul 27 2021 10:46:38 |
OS | Darwin |
CPUs | 8 |
Memory (Gb) | 64.0 |
Wed Feb 15 14:17:23 2023 JST |
This code is a part of Qiskit
© Copyright IBM 2017, 2023.
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works of this code must retain this
copyright notice, and modified files need to carry a notice indicating
that they have been altered from the originals.
[ ]: