Bengali
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

নোট

এই পৃষ্ঠাটি tutorials/simulators/5_noise_transformation.ipynb -থেকে বানানো হয়েছে।

ত্রুটি রূপান্তর

ভূমিকা

এই নোটবুকে দেখানো হয়েছে কিভাবে Qiskit এয়ারের ইউটিলিটি ফাংশন approximate_quantum_errorapproximate_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.

আমরা এয়ার প্রোভাইডার ইউটিলিটি থেকে রূপান্তর ফাংশন ইম্পোর্ট বা আনীত করা দিয়ে কাজ শুরু করবো

[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

সারাংশ

একটা ১-কিউবিট কোয়ান্টাম চ্যানেল হলো একটা ফাংশন \(\mathcal{C}:\mathbb{C}^{2\times2}\to\mathbb{C}^{2\times2}\) যার কাজ ঘনত্ব অপারেটরকে ঘনত্ব অপারেটরে ম্যাপ (চিত্রায়ন) করা (ছবিটা যে একটা ঘনত্ব অপারেটর তা নিশ্চিত করতে \(\mathcal{C}\) -এর মান ধনাত্মক এবং পদাঙ্ক সংরক্ষণকারী হতে হবে, সিপিটিপি (CPTP))।

প্রদত্ত কোয়ান্টাম চ্যানেল \(\mathcal{E}_{1},\dots,\mathcal{E}_{r}\), সম্ভাবনা \(p_1, p_2, \dots, p_r\) এমন যাতে \(0\le p_i \le 1\) and \(p_1+\dots +p_r = 1\), একটা নতুন কোয়ান্টাম চ্যানেল \(\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,\mathcal{C})\ge F(I,\mathcal{C}_\mathcal{E})\]

যেখানে \(\text{F}\) হলো বিশ্বস্ততা পরিমাপক এবং \(I\) হলো অভেদক (আইডেন্টিটি) চ্যানেল।

উদাহরণ: রিসেট বা পুনঃস্থাপন ত্রুটির সাহায্যে বিস্তার অবনমন (ড্যাম্পিং) ত্রুটির অনুমান করা

বিস্তার অবনমন (ড্যাম্পিং) ত্রুটি একটা প্যারামিটার \(0\le \gamma \le 1\) দ্বারা সূচিত হয় এবং নিম্নলিখিত ক্রাউস অপারেটরগুলো দিয়ে বানানো হয়:

\[\begin{split}\left(\begin{array}{cc} 1 & 0\\ 0 & \sqrt{1-\gamma} \end{array}\right),\left(\begin{array}{cc} 0 & \sqrt{\gamma}\\ 0 & 0 \end{array}\right)\end{split}\]

রিসেট বা পুনস্থাপন ত্রুটি \(0\le p, q\le 1\) সম্ভাবনা দ্বারা সূচিত হয়, এমনভাবে যাতে \(p+q\le 1\) এবং এটা বানাতে নিম্নলিখিত ক্রাউস অপেরাটরগুলো লাগে:

\[\begin{split}\left(\begin{array}{cc} \sqrt{p} & 0\\ 0 & 0 \end{array}\right),\left(\begin{array}{cc} 0 & \sqrt{p}\\ 0 & 0 \end{array}\right),\left(\begin{array}{cc} 0 & 0\\ \sqrt{q} & 0 \end{array}\right),\left(\begin{array}{cc} 0 & 0\\ 0 & \sqrt{q} \end{array}\right)\end{split}\]

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\) বিস্তার অবনমন (ড্যাম্পিং) চ্যানেল অনুমানে কাজে লাগে বিস্তারিত: <https://arxiv.org/abs/1207.0046>`__) এর সবচেয়ে ভালো মান নির্ণয় করা খুব কঠিন না। সবচেয়ে ভালো অনুমান হল:

\[p=\frac{1}{2}\left(1+\gamma-\sqrt{1-\gamma}\right), q=0\]
[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 SoftwareVersion
qiskit-terra0.24.0.dev0+dba2eff
qiskit-aer0.11.2
qiskit-ignis0.7.1
qiskit-ibmq-provider0.20.0
qiskit0.41.0
System information
Python version3.8.11
Python compilerClang 12.0.5 (clang-1205.0.22.11)
Python builddefault, Jul 27 2021 10:46:38
OSDarwin
CPUs8
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.

[ ]: