Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit d97e377

Browse files
dcmckayibmjaygambetta
authored andcommitted
Overview of gate error calibration sequences (#549)
1 parent 814e3c0 commit d97e377

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

community/ignis/gate_errors.ipynb

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"<img src=\"../../images/qiskit-heading.gif\" alt=\"Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook\" width=\"500 px\" align=\"left\">"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"## _*Gate Errors*_ \n",
15+
"\n",
16+
"\n",
17+
"***\n",
18+
"### Contributors\n",
19+
"David McKay"
20+
]
21+
},
22+
{
23+
"cell_type": "markdown",
24+
"metadata": {},
25+
"source": [
26+
"## Introduction\n",
27+
"\n",
28+
"The general form of an arbitrary single qubit gate is a rotation $\\theta$ around some axis in the Bloch sphere with unit vector $\\hat{n}$ such that\n",
29+
"$$U(\\theta,\\hat{n}) = e^{-i \\theta \\hat{n} \\cdot \\sigma} $$\n",
30+
"Physically these rotations are performed by applying some oscillating electromagnetic field at the qubit frequency to the location of the qubit. It is not necessary to calibrate all such rotations, only a few rotation angles and axes are enough. At minimum we need a $\\pi/2$ rotation ($\\theta=\\pi/4$) along two orthogonal axis. So then the calibration question becomes how to tell that the gate $X90p$ ($\\pi/2$ around $X$) is really $ e^{-i \\frac{\\pi}{4} \\sigma_X} $?\n",
31+
"\n",
32+
"Here we will look at different sequences to amplify possible errors in the gate.\n",
33+
"\n",
34+
"\n",
35+
"**Contents**\n",
36+
"\n",
37+
"[Amplitude](#sect1)\n",
38+
"\n",
39+
"[Phase](#sect2)\n",
40+
"\n",
41+
"\n",
42+
"### References\n",
43+
"\n",
44+
"[1]<a id=\"ref1\"></a> David C. McKay, Christopher J. Wood, Sarah Sheldon, Jerry M. Chow and Jay M. Gambetta. Efficient Z-Gates for Quantum Computing. https://arxiv.org/abs/1612.00858"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"Code imports\n",
52+
"=============="
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": 1,
58+
"metadata": {
59+
"ExecuteTime": {
60+
"end_time": "2018-12-18T15:13:54.475305Z",
61+
"start_time": "2018-12-18T15:13:53.026353Z"
62+
}
63+
},
64+
"outputs": [],
65+
"source": [
66+
"# Import general libraries (needed for functions)\n",
67+
"import numpy as np\n",
68+
"import time\n",
69+
"\n",
70+
"# Import Qiskit classes\n",
71+
"import qiskit \n",
72+
"from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister, Aer\n",
73+
"from qiskit.providers.aer import noise\n",
74+
"from qiskit.tools.visualization import plot_histogram\n",
75+
"\n",
76+
"# Import measurement calibration functions\n",
77+
"from qiskit.ignis.mitigation.measurement import (complete_meas_cal,\n",
78+
" CompleteMeasFitter, MeasurementFilter)"
79+
]
80+
},
81+
{
82+
"cell_type": "markdown",
83+
"metadata": {},
84+
"source": [
85+
"<a id='sect1'></a>"
86+
]
87+
},
88+
{
89+
"cell_type": "markdown",
90+
"metadata": {},
91+
"source": [
92+
"# Amplitude Error\n",
93+
"\n",
94+
"Consider a gate which is a X90p, but with a slight rotation error. \n",
95+
"$$U = e^{-i (\\pi/2+d\\theta) \\sigma_X/2} $$\n",
96+
"One way to measure $d\\theta$ would be to apply the gate starting with the qubit in the ground state and look at the $|0\\rangle$ and $|1\\rangle$ counts. However, the signal could be lost in the noise. To amplify the roration error we continually apply the gate in groups of 2,\n",
97+
"$$U = X90p-[X90p-X90p]^n$$\n",
98+
"\n",
99+
"To predict the outcome we expand using Euler's formula,\n",
100+
"$$X90p = \\text{cos}\\left(\\frac{\\pi}{4}+\\frac{d\\theta}{2}\\right)I - \\text{sin}\\left(\\frac{\\pi}{4}+\\frac{d\\theta}{2}\\right) \\sigma_X $$\n",
101+
"$$X90p^{2n+1} = \\text{cos}\\left(n\\frac{\\pi}{2}+nd\\theta+\\frac{\\pi}{4}+\\frac{d\\theta}{2}\\right)I - \\text{sin}\\left(n\\frac{\\pi}{2}+nd\\theta+\\frac{\\pi}{4}+\\frac{d\\theta}{2}\\right) \\sigma_X $$\n",
102+
"and the population in the excited state is\n",
103+
"$$ P_{|1\\rangle, 2n+1} = \\text{sin}^2\\left(n\\frac{\\pi}{2}+nd\\theta+\\frac{\\pi}{4}+\\frac{d\\theta}{2}\\right) $$ \n",
104+
"$$ P_{|1\\rangle, 2n+1} = \\frac{1}{2}-\\frac{1}{2}\\text{cos}\\left(n\\pi+2nd\\theta+\\frac{\\pi}{2}+d\\theta\\right) $$ \n",
105+
"$$ P_{|1\\rangle, 2n+1} = \\frac{1}{2}+\\frac{(-1)^n}{2}\\text{sin}\\left(2nd\\theta+d\\theta\\right) $$ \n",
106+
"for small $d\\theta$ this amplifies the error by $n$,\n",
107+
"$$ P_{|1\\rangle, 2n+1} \\approx \\frac{1}{2}+\\frac{(-1)^n d\\theta}{2}(2n+1) $$ \n"
108+
]
109+
},
110+
{
111+
"cell_type": "markdown",
112+
"metadata": {},
113+
"source": [
114+
"<a id='sect2'></a>"
115+
]
116+
},
117+
{
118+
"cell_type": "markdown",
119+
"metadata": {},
120+
"source": [
121+
"# Phase Error\n",
122+
"\n",
123+
"A phase error means that the angle between the X90p and Y90p is not perfectly $\\pi/2$. We assume the amplitude is correct so,\n",
124+
"$$X90p = e^{-i \\frac{\\pi}{4}\\sigma_X}$$\n",
125+
"$$Y90p = e^{-i \\frac{\\pi}{4}\\left[\\text{cos}(d\\phi)\\sigma_Y+\\text{sin}(d\\phi)\\sigma_X\\right]}$$\n",
126+
"The angle error can be amplified by the sequence\n",
127+
"$$X90p-[\\{Y90p\\}^2 \\{X90p\\}^2]^n - Y90p$$"
128+
]
129+
},
130+
{
131+
"cell_type": "code",
132+
"execution_count": null,
133+
"metadata": {},
134+
"outputs": [],
135+
"source": []
136+
}
137+
],
138+
"metadata": {
139+
"anaconda-cloud": {},
140+
"celltoolbar": "Tags",
141+
"hide_input": false,
142+
"kernelspec": {
143+
"display_name": "Python 3",
144+
"language": "python",
145+
"name": "python3"
146+
},
147+
"language_info": {
148+
"codemirror_mode": {
149+
"name": "ipython",
150+
"version": 3
151+
},
152+
"file_extension": ".py",
153+
"mimetype": "text/x-python",
154+
"name": "python",
155+
"nbconvert_exporter": "python",
156+
"pygments_lexer": "ipython3",
157+
"version": "3.6.8"
158+
}
159+
},
160+
"nbformat": 4,
161+
"nbformat_minor": 2
162+
}

0 commit comments

Comments
 (0)