removing the tutorial

putting the tutorial into a new repo
This commit is contained in:
Jay M. Gambetta 2017-08-03 14:54:02 -04:00
parent e6f09a8c9e
commit 0c2612b757
152 changed files with 1 additions and 26141 deletions

View File

@ -3,7 +3,7 @@ Quantum Information Software Kit (QISKit) SDK Python
|Build Status|
Python software development kit (SDK) and Jupyter notebooks for working
Python software development kit (SDK) for working
with OpenQASM and the IBM Q experience (QX).
Philosophy

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1,160 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"images/QISKit-c.gif\" alt=\"Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook\" width=\"250 px\" align=\"left\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## _*QISKit (Quantum Information Software Kit) *_ \n",
"\n",
"The latest version of this notebook is available on https://github.com/IBM/qiskit-sdk-py/tree/master/scripts.\n",
"\n",
"For more information about how to use the IBM Q experience (QX), consult the [tutorials](https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=c59b3710b928891a1420190148a72cce&pageIndex=0), or check out the [community](https://quantumexperience.ng.bluemix.net/qstage/#/community).\n",
"\n",
"***\n",
"### Contributors (alphabetical)\n",
"Jerry Chow, Antonio Córcoles, Abigail Cross, Andrew Cross, Ismael Faro, Andreas Fuhrer, Jay M. Gambetta, Antonio Mezzacapo, Ramis Movassagh, Anna Phan, Rudy Raymond, Kristan Temme, Chris Wood\n",
"\n",
"In future releases, anyone who contributes to the tutorial can include their name here."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Introduction\n",
"Welcome to QISKit! Interested in quantum computing and programming a real live quantum processor? QISKit is a simple set of tools for anyone to get started with quantum information science. We have put together these Jupyter notebooks to demonstrate how to use our tools and explore the quantum world.\n",
"\n",
"The notebooks are organized into the following topics:\n",
"\n",
"1. [Introducing the tools](#section1)\n",
"2. [Exploring quantum physics](#section2)\n",
"3. [Verification tools for quantum science](#section3)\n",
"4. [Applications of short-depth quantum circuits on quantum computers](#section4)\n",
"5. [Quantum games](#section5) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Introducing the tools<a id='section1'></a>\n",
"\n",
"In this first topic, we break down the tools in this QISKit SDK, and introduce all the different parts to make this useful. Our list of introductory notebooks:\n",
"* [Getting Started with QISKit SDK](sections/getting_started.ipynb) - how to use the the QISKit SDK tools. \n",
"* [Understanding the Different Backends](sections/working_with_backends.ipynb) - how to get information about the connected backends.\n",
"* [Compiling and Running a Quantum Program](sections/compiling_and_running.ipynb) - how to rewrite circuits to different backends.\n",
"* Loading and Saving a Quantum Program [coming soon]\n",
"* [Visualizing a Quantum State](sections/visualizing_quantum_state.ipynb) - illustrates the different tools we have for visualizing a quantum state"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Exploring quantum information concepts<a id='section2'></a> \n",
"\n",
"The next set of notebooks shows how you can explore some simple concepts of quantum information science. \n",
"\n",
"* [Superposition and Entanglement](sections/superposition_and_entanglement.ipynb) - how to make simple quantum states on one and two qubits, and demonstrates concepts such as quantum superpositions and entanglement. \n",
"* [Single-qubit States: Amplitude and Phase](sections/single_qubit_states_amplitude_and_phase.ipynb) - discusses more complicated single-qubit states. \n",
"* [Single-qubit Quantum Random Access Coding](sections/single-qubit_quantum_random_access_coding.ipynb) - how superpositions of one-qubit quantum states can be used to encode two and three bits into one qubit, and how measurements can be used to decode any one bit with a success probability of more than half. \n",
"* [Two-qubit Quantum Random Access Coding](sections/two-qubit_state_quantum_random_access_coding.ipynb) - how superposition and entanglement can be used to encode seven bits of information into two qubits, such that any one of seven bits can be recovered probabilistically.\n",
"* [Entanglement Revisited](sections/entanglement_revisited.ipynb) - the CHSH inequality, and extensions for three qubits (Mermin). \n",
"* [Quantum Teleportation](sections/quantum_teleportation.ipynb) - introduces quantum teleportation.\n",
"* [Quantum Superdense Coding](sections/superdense_coding.ipynb) - introduces the concept of superdense coding."
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## 3. Verification tools for quantum information science<a id='section3'></a>\n",
"\n",
"The third set of notebooks allows you to explore tools for verification of quantum systems with commonly used techniques such as tomography and randomized benchmarking.\n",
"\n",
"### Error Amplications methods\n",
"* [Relaxation and decoherence](sections/Relaxation_and_decoherence.ipynb) - a simple notebook showing how to measure coherence \n",
"\n",
"### Tomography methods\n",
"* [Quantum state tomography](sections/state_tomography.ipynb) - how to run quantum state tomography\n",
"* [Quantum process tomography](sections/process_tomography.ipynb) - how to run quantum process tomography\n",
"\n",
"### Randomization methods\n",
"* Pauli randomized benchmarking [coming soon]\n",
"* Standard randomized benchmarking [coming soon]\n",
"* Purity randomized benchmarking [coming soon]\n",
"* Leakage randomized benchmarking [coming soon]\n",
"* Simultaneous randomized benchmarking [coming soon]\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. Applications of quantum information science<a id='section4'></a>\n",
"\n",
"To fully grasp the possibilities, this set of notebooks shows how you can explore applications of short-depth quantum computers.\n",
"\n",
"### Sampling \n",
"* [Quantum optimization](sections/classical_optimization.ipynb) by variational quantum eigensolver method - illustrates how to use a quantum computer to look at optimization problems. \n",
"* [Quantum chemistry](sections/quantum_chemistry.ipynb) by variational quantum eigensolver method - discusses using a quantum computer to look at chemistry problems. \n",
"\n",
"### Non-Sampling \n",
"* [Iterative phase estimation](sections/iterative_phase_estimation_algorithm.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## 5. Quantum Games<a id='section5'></a>\n",
"\n",
"The notebooks below show how quantum algorithms can be used to play games and solve puzzles in different ways that cannot be done with their classical counterparts.\n",
"\n",
"* [Quantum counterfeit coin finding](sections/Quantum_counterfeit_coin_problem.ipynb) algorithm: can you solve [the counterfeit coin riddle](https://ed.ted.com/lessons/can-you-solve-the-counterfeit-coin-riddle-jennifer-lu)? You are given a quantum computer and quantum beam balance, and your task is to find a counterfeit coin hidden in a set of coins. Armed with the knowledge of the Bernstein-Vazirani algorithm, you can easily find the counterfeit coin using the beam balance only once.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,230 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " epub3 to make an epub3"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
@echo " dummy to check syntax errors of document sources"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/qiskit-sdk-py-dev.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/qiskit-sdk-py-dev.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/qiskit-sdk-py-dev"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/qiskit-sdk-py-dev"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: epub3
epub3:
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
@echo
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
.PHONY: dummy
dummy:
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
@echo
@echo "Build finished. Dummy builder generates no files."

View File

@ -1,745 +0,0 @@
========================
Classical Optimization
========================
The latest version of this notebook is available on
https://github.com/IBM/qiskit-sdk-py/tree/master/scripts.
For more information about how to use the IBM Q Experience (QX), consult
the `Quantum Experience
tutorials <https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=c59b3710b928891a1420190148a72cce&pageIndex=0>`__,
or check out the
`community <https://quantumexperience.ng.bluemix.net/qstage/#/community>`__.
Contributors
============
Jay Gambetta, Antonio Mezzacapo, Ramis Movassagh, Kristan Temme
Introduction
============
Many problems in finance and business are optimization problems.
Optimization or combinatorial optimization means searching for an
optimal solution in a finite or countably infinite set of potential
solutions. Optimality is defined with respect to some criterion
function, which is to be minimized or maximized, typically
called the cost function.
**Types of optimization problems**
Minimization: cost, distance, length of a traversal, weight, processing
time, material, energy consumption, number of objects.
Maximization: profit, value, output, return, yield, utility, efficiency,
capacity, number of objects.
The two problems that are consider in this notebook are:
MaxCut
======
MaxCut is an NP-complete problem. MaxCut has applications in clustering,
network science, and statistical physics. For example, consider the
problem of many different people (nodes) and how they can influence
(weight) overs. OVERS? You want to answer the question of the best
marketing stratety to maximize revenue, by offering for free the product
to one subset of buyers, while determining how to approach the remaining
buyers with a particular price. MaxCut derives its importance from its
``hardness" as well as the applications it has in aforementioned fields (SHOULD WE
ADD THAT APPROXIMATIONS ARE ALSO HARD).
Consider a :math:`n`-node undirectional graph *G(V, E)* where *\|V\| =
n* with edge weights :math:`w_{ij}>0` for :math:`(i, j)\in E`. A cut is
defined as the partitioning into two sets. We define the cost as the sum
of weights of edges crossing the cut. By assigning :math:`x_i=0` or
:math:`x=1` to each node :math:`i` depding on its location to the cut,
the maximum cut is a cut that maximizes
.. math:: C(\textbf{x}) = \sum_{i,j} w_{ij} x_i (1-x_j).
An extension of the MaxCut problem is to let the nodes themselves carry
weights, which can be regarded as the nodes having a preference for their
location. The cost function then becomes
.. math:: C(\textbf{x}) = \sum_i w_i x_i + \sum_{i,j} w_{ij} x_i (1-x_j).
Mapping this to a quantum Hamiltonian is trival:
:math:`x_i\rightarrow (1-Z_i)/2` where :math:`Z_i` is the Pauli Z
operator that has eigenvalues :math:`\pm 1`. Doing this, we find that
.. math:: C(\textbf{Z}) = \sum_i w_i (1-Z_i)/2 + \sum_{i<j} \frac{w_{ij}}{2} (1-Z_iZ_j)= \frac{-1}{2}\left(\sum_i w_i Z_i + \sum_{i<j} w_{ij} Z_iZ_j\right)+\mathrm{const},
where const = :math:`\sum_i w_i/2 + \sum_{i<j}w_{ij}/2`. That is, the
MAXCUT is equivalent to minimizing the Ising Hamiltonian
.. math:: H = \sum_i w_i Z_i + \sum_{i<j} w_{ij} Z_iZ_j.
Traveling Salesman Problem
==========================
In addition to being a notorious NP-complete problem that has drawn the
attention of computer scientists and mathematician for over two
centuries, as the name suggests, the Traveling Salesman Problem (TSP)
has important bearings on finance and marketing. Colloquially, the
traveling salesman is one who goes from city to city to sell
merchandise. His/her objective (TSP) is to find the shortest path that
would enable a path to visit all the cities and return to the starting city. This way, potential sales are maximized in the least amount of time.
The problem derives its importance from its ``hardness" and ubiquitous
equivalence to other relevant combinatorial optimization problems that
arise in practice.
The mathematical formulation with some early analysis was proposed by
W.R. Hamilton in early 19th century. Mathematically, the problem is best
abstracted in terms of graphs. The TSP on the nodes of a graph asks for
the shortest Hamiltonian cycle that can be taken through each of the
nodes. The general solution is unknown, and finding an efficient solution
(e.g., a polynomial time algorithm) is expected not to exist.
Find the shortest Hamiltonian cycle in a given complete graph
:math:`G=(V,E)` with :math:`n=|V|` vertices and distances,
:math:`w_{ij} =` distance from vertex :math:`i` to vertex :math:`j`. The
decission variable :math:`x_{ij}` = 1 if the cycle goes along arc
:math:`i\rightarrow j` or 0 otherwise.
Approximate Universal Quantum Computing for Optimization problems
=================================================================
Recently there has been interest in investgating approximate algorithims
for optimization [ADD REFS]. Here we show a slight variation, which we have been considering under the general concept of approximate
quantum computing. In general, we don't expect this to have a exponential
speed-up, but due to the nature and importance of these problems, it is
worth investigating heuristic approaches on a quantum computer. The hope
is that that the large space of a quantum computer will make it possible to explore
the problem by exploiting entanglement to trade exponential calls for
quantum depth.
The algorithm works as follows: 1. Choose a Ising problem (can have
higher powers of Z). 2. Choose the maximum depth of the quantum circuit
(this could be done adaptively.) 3. Choose a set of controls
:math:`\theta` and make a trial function :math:`|\psi(\theta)\rangle`.
4. Evaluate
:math:`C = \langle\psi~|H|~\psi\rangle = \sum_i w_i \langle\psi~|Z_i|~\psi\rangle+ \sum_{i<j} w_{ij} \langle\psi~|Z_iZ_j|~\psi\rangle`
by sampling the outcome of the circuit and adding the expectation values
together. 5. Use a classical optimizer to choose a new set of controls.
6. Continue until the C has reach a minimium and return
:math:`|\langle z~|\psi\rangle|^2`.
FIX THIS NEXT SENTENCE: Not some benefits on this over making this is real hardware is we are
not limited to the connectivity of the device and it is trival to map
optimize problems to the virtual Hamiltonain which we make though
simulation. Getting higher orders such as :math:`Z_iZ_jZ_k` is simple
which in real hardware is generally possible. The noise is mainly due to
the gates, and if the depth is small enough, we can perform this high
fidelity.
It is our belief the difficulty of finding good heuristic algorithms will
come down to the trial funciton. Do we choose a trial function that has
entanglement in a way that best aligns with the problem (as indicated in
[REF]), or do we make the amount of entanglement a variable [REF]? These
questions are beyond our goals here, and we will consider only the
simplie trial functions
.. math:: |\psi(\theta)\rangle = [U_\mathrm{single}(\theta) U_\mathrm{entangler}]^m |+\rangle
where :math:`U_\mathrm{entangler}` is a function of cPhase gates (fully
entangling), and
:math:`U_\mathrm{single}(\theta) = Y(\theta)^{\otimes n}`, where
:math:`n` is the number of qubits and :math:`m` is the depth of the
quantum circuit. The motivation for this choice is that for these
classical problems, this choice allows us to search over the space of
states that have only real superpositions and don't have to worry about
refocusing out all the complex phases, but still can exploit the
entanglment to search for solutions.
.. code:: python
# Checking the version of PYTHON; we only support 3 at the moment
import sys
if sys.version_info < (3,0):
raise Exception("Please use Python version 3 or greater.")
# useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from scipy import linalg as la
import sys
sys.path.append("../../")
# importing the QISKit
from qiskit import QuantumCircuit, QuantumProgram
import Qconfig
# import basic plot tools
from qiskit.basicplotter import plot_histogram
# import optimization tools
from tools.optimizationtools import trial_circuit_ryrz,trial_circuit_ry, SPSA_optimization
from tools.optimizationtools import Energy_Estimate, Measure_pauli_z, Hamiltonian_from_file, make_Hamiltonian
MaxCut on Four Qubits
==================
::
Graph:
X---X
| \ |
X---X
The ground state is degenerate and is either :math:`|0110\rangle` or
:math:`|1001\rangle`.
.. code:: python
n=2
m=
device='local_qasm_simulator'
SPSA_params=[1,.1,.602,.101,0]
theta=np.zeros(2*n*m)
entangler_map={0: [1]} # the map of two-qubit gates with control at key and target at values
shots=1000
max_trials=25
#Exact Energy
pauli_list=Hamiltonian_from_file('H2/H2Equilibrium.txt')
eigen=la.eig(make_Hamiltonian(pauli_list))
exact=np.amin(eigen[0])
# Optimization
eval_hamiltonian_partial=partial(eval_hamiltonian,n,m,'H2/H2Equilibrium.txt',device,shots)
output=SPSA_optimization(eval_hamiltonian_partial,theta,SPSA_params,max_trials,1);
plt.plot(output[2],label='E(theta_plus)')
plt.plot(output[3],label='E(theta_minus)')
plt.plot(np.ones(max_trials)*output[0],label='Final Energy')
plt.plot(np.ones(max_trials)*exact,label='Exact Energy')
plt.legend()
.. code:: python
# cost function H = alpha_i z_i + beta_ij z_i z_j
n =4
alpha = np.zeros(n)
beta = np.zeros((n, n))
beta[0, 1] = 1
beta[0, 2] = 1
beta[1, 2] = 1
beta[1, 3] = 1
beta[2, 3] = 1
.. code:: python
#Setting up a quantum program and connecting to the Quantum Experience API
Q_program = QuantumProgram()
# set the APIToken and API url
Q_program.set_api(Qconfig.APItoken, Qconfig.config["url"])
.. code:: python
#Making the Hamiltonian in its full form and getting the lowest eigenvalue and eigenvector
H = make_Hamiltonian(n,alpha,beta)
w, v = la.eigh(H, eigvals=(0, 1))
print(w)
v
.. code:: python
# Quantum circuit parameters
device = 'local_qasm_simulator' # the device to run on
shots = 8192 # the number of shots in the experiment.
entangler_map = {0: [1], 1: [2], 2: [3]} # the map of two-qubit gates with control at key and target at values
# Numerical parameters
SPSA_parameters = np.array([.3,0.602,0,.1,0.101]) #[a, alpha, A, c, gamma]
max_trials = 100;
max_depth = 3
cost, data_save, cost_save = SPSA_Minimization(Q_program, alpha, beta, n, device, shots, entangler_map, SPSA_parameters, max_trials, max_depth)
print('m = 1 ' + str(cost[0]) + ' m = 2 ' + str(cost[1]) + 'm = 3 ' + str(cost[2]))
.. code:: python
# plotting data
plt.plot(range(max_trials), cost_save[0])
plot_histogram(data_save[0])
plt.plot(range(max_trials), cost_save[1])
plot_histogram(data_save[1])
plt.plot(range(max_trials), cost_save[2])
plot_histogram(data_save[2])
Four Qubits (fast)
==================
::
Graph:
X---X
| \ |
X---X
The ground state is degenerate and is either :math:`|100\rangle`,
:math:`|010\rangle` and :math:`|001\rangle`.
.. code:: python
# cost function H = alpha_i z_i + beta_ij z_i z_j
n =4
alpha = np.zeros(n)
beta = np.zeros((n, n))
beta[0, 1] = 1
beta[0, 2] = 1
beta[1, 2] = 1
beta[1, 3] = 1
beta[2, 3] = 1
.. code:: python
#Setting up a quantum program and connecting to the Quantum Experience API
Q_program = QuantumProgram()
# set the APIToken and API url
Q_program.set_api(Qconfig.APItoken, Qconfig.config["url"])
.. parsed-literal::
---- Error: Exception connect to servers ----
.. parsed-literal::
False
.. code:: python
# Quantum circuit parameters
entangler_map = {0: [1], 1: [2], 2: [3]} # the map of two-qubit gates with control at key and target at values
# Numerical parameters
SPSA_parameters = np.array([.3,0.602,0,.1,0.101]) #[a, alpha, A, c, gamma]
max_trials = 100;
max_depth = 3
cost, data_save, cost_save = SPSA_Minimization_fast(Q_program, alpha, beta, n, entangler_map, SPSA_parameters, max_trials, max_depth)
print('m = 1 ' + str(cost[0]) + ' m = 2 ' + str(cost[1]) + 'm = 3 ' + str(cost[2]))
.. parsed-literal::
trial 0 of 100 cost -0.943257454022
trial 10 of 100 cost -2.20629876865
trial 20 of 100 cost -2.7499512609
trial 30 of 100 cost -2.84118948435
trial 40 of 100 cost -2.88829727076
trial 50 of 100 cost -2.9242398834
trial 60 of 100 cost -2.96130416407
trial 70 of 100 cost -2.93303732352
trial 80 of 100 cost -2.94302575557
trial 90 of 100 cost -2.93854780452
m = 1 -2.015625 m = 2 -2.9921875m = 3 -2.99609375
.. code:: python
# plotting data
plt.plot(range(max_trials), cost_save[0])
plot_histogram(data_save[0])
plt.plot(range(max_trials), cost_save[1])
plot_histogram(data_save[1])
plt.plot(range(max_trials), cost_save[2])
plot_histogram(data_save[2])
.. image:: classical_optimization_files/classical_optimization_15_0.png
.. image:: classical_optimization_files/classical_optimization_15_1.png
.. image:: classical_optimization_files/classical_optimization_15_2.png
.. image:: classical_optimization_files/classical_optimization_15_3.png
.. image:: classical_optimization_files/classical_optimization_15_4.png
.. image:: classical_optimization_files/classical_optimization_15_5.png
10 qubits
=========
.. code:: python
n = 10
# cost function H = alpha_i z_i + beta_ij z_i z_j
alpha = np.zeros(n)
beta = np.random.choice([0, 0.5], size=(n,n), p=[1./3, 2./3])
.. code:: python
# quantum circuit parameters
device = 'simulator' # the device to run on
shots = 8192 # the number of shots in the experiment
entangler_map = {0: [1], 1: [2], 2: [3], 3: [4], 4: [5], 5: [6], 6: [7], 7: [8], 8: [9]} # the map of two-qubit gates with control at key and target at values
# Numerical parameters
SPSA_parameters = np.array([.3,0.602,0,.1,0.101]) # [a, alpha, A, c, gamma]
max_trials = 100;
theta_depth_1 = np.random.randn(1*n) # initial controls
theta_depth_2 = np.random.randn(2*n) # initial controls
theta_depth_3 = np.random.randn(3*n) # initial controls
trial_circuit_depth_1 = trial_funtion_optimization(n,1,theta_depth_1,entangler_map)
trial_circuit_depth_2 = trial_funtion_optimization(n,2,theta_depth_2,entangler_map)
trial_circuit_depth_3 = trial_funtion_optimization(n,3,theta_depth_3,entangler_map)
program = [trial_circuit_depth_1,trial_circuit_depth_2,trial_circuit_depth_3]
out = run_program(program,api,device,shots,max_credits=3)
results=combine_jobs([out['id']], api, wait=20, timeout=440)
cost_depth_1 = cost_classical(get_data(results,0),n,alpha,beta)
cost_depth_2 = cost_classical(get_data(results,1),n,alpha,beta)
cost_depth_3 = cost_classical(get_data(results,2),n,alpha,beta)
print('m=1 ' + str(cost_depth_1) + ' m=2 ' + str(cost_depth_2) + 'm=3 ' + str(cost_depth_3))
.. code:: python
# plotting data
plt.plot(range(max_trials), cost_plus_depth_1, range(max_trials), cost_minus_depth_1)
plot_histogram(get_data(results,0),n)
plt.plot(range(max_trials), cost_plus_depth_2, range(max_trials), cost_minus_depth_2)
plot_histogram(get_data(results,1),n)
plt.plot(range(max_trials), cost_plus_depth_3, range(max_trials), cost_minus_depth_3)
plot_histogram(get_data(results,2),n)
.. code:: python
# cost function H = alpha_i z_i + beta_ij z_i z_j
n = 10
alpha = np.zeros(n)
beta = np.random.choice([0, 0.5], size=(n,n), p=[1./3, 2./3])
for i in range(n):
for j in range(i):
beta[j,i]=beta[i,j]
for i in range(n):
beta[i,i]=0;
.. code:: python
# quantum circuit parameters
device = 'simulator' # the device to run on
shots = 8192 # the number of shots in the experiment
entangler_map = {0: [1], 1: [2], 2: [3], 3: [4], 4: [5], 5: [6], 6: [7], 7: [8], 8: [9]} # the map of two-qubit gates with control at key and target at values
# Numerical parameters
SPSA_parameters = np.array([.3,0.602,0,.1,0.101]) #[a, alpha, A, c, gamma]
max_trials = 100;
theta_depth_1 = np.random.randn(1*n) # initial controls
theta_depth_2 = np.random.randn(2*n) # initial controls
theta_depth_3 = np.random.randn(3*n) # initial controls
cost_plus_depth_1=np.zeros(max_trials)
cost_minus_depth_1=np.zeros(max_trials)
cost_plus_depth_2=np.zeros(max_trials)
cost_minus_depth_2=np.zeros(max_trials)
cost_plus_depth_3=np.zeros(max_trials)
cost_minus_depth_3=np.zeros(max_trials)
for k in range(max_trials):
print('trial ' + str(k) + " of " + str(max_trials))
a_spsa = float(SPSA_parameters[0])/np.power(k+1+SPSA_parameters[2], SPSA_parameters[1])
c_spsa = float(SPSA_parameters[3])/np.power(k+1, SPSA_parameters[4])
Delta_depth_1 = 2*np.random.randint(2,size=n*1)-1 # \pm 1 random distribution
Delta_depth_2 = 2*np.random.randint(2,size=n*2)-1 # \pm 1 random distribution
Delta_depth_3 = 2*np.random.randint(2,size=n*3)-1 # \pm 1 random distribution
theta_plus_depth_1 = theta_depth_1 + c_spsa*Delta_depth_1
theta_minus_depth_1 = theta_depth_1 - c_spsa*Delta_depth_1
theta_plus_depth_2 = theta_depth_2 + c_spsa*Delta_depth_2
theta_minus_depth_2 = theta_depth_2 - c_spsa*Delta_depth_2
theta_plus_depth_3 = theta_depth_3 + c_spsa*Delta_depth_3
theta_minus_depth_3 = theta_depth_3 - c_spsa*Delta_depth_3
trial_circuit_plus_depth_1 = trial_funtion_optimization(n,1,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_1 = trial_funtion_optimization(n,1,theta_minus_depth_1,entangler_map)
trial_circuit_plus_depth_2 = trial_funtion_optimization(n,2,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_2 = trial_funtion_optimization(n,2,theta_minus_depth_2,entangler_map)
trial_circuit_plus_depth_3 = trial_funtion_optimization(n,3,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_3 = trial_funtion_optimization(n,3,theta_minus_depth_3,entangler_map)
program = [trial_circuit_plus_depth_1,trial_circuit_minus_depth_1,trial_circuit_plus_depth_2
,trial_circuit_minus_depth_2,trial_circuit_plus_depth_3,trial_circuit_minus_depth_3]
out = run_program(program,api,device,shots,max_credits=3)
results=combine_jobs([out['id']], api, wait=20, timeout=440)
cost_plus_depth_1[k] = cost_classical(get_data(results,0),n,alpha,beta)
cost_minus_depth_1[k] = cost_classical(get_data(results,1),n,alpha,beta)
cost_plus_depth_2[k] = cost_classical(get_data(results,2),n,alpha,beta)
cost_minus_depth_2[k] = cost_classical(get_data(results,3),n,alpha,beta)
cost_plus_depth_3[k] = cost_classical(get_data(results,4),n,alpha,beta)
cost_minus_depth_3[k] = cost_classical(get_data(results,5),n,alpha,beta)
g_spsa_depth_1 = (cost_plus_depth_1[k]-cost_minus_depth_1[k])*Delta_depth_1/(2.0*c_spsa)
g_spsa_depth_2 = (cost_plus_depth_2[k]-cost_minus_depth_2[k])*Delta_depth_2/(2.0*c_spsa)
g_spsa_depth_3 = (cost_plus_depth_3[k]-cost_minus_depth_3[k])*Delta_depth_3/(2.0*c_spsa)
theta_depth_1 = theta_depth_1 - a_spsa*g_spsa_depth_1
theta_depth_2 = theta_depth_2 - a_spsa*g_spsa_depth_2
theta_depth_3 = theta_depth_3 - a_spsa*g_spsa_depth_3
print(cost_minus_depth_3[k] + cost_plus_depth_3[k])
trial_circuit_depth_1 = trial_funtion_optimization(n,1,theta_depth_1,entangler_map)
trial_circuit_depth_2 = trial_funtion_optimization(n,2,theta_depth_2,entangler_map)
trial_circuit_depth_3 = trial_funtion_optimization(n,3,theta_depth_3,entangler_map)
program = [trial_circuit_depth_1,trial_circuit_depth_2,trial_circuit_depth_3]
out = run_program(program,api,device,shots,max_credits=3)
results=combine_jobs([out['id']], api, wait=20, timeout=440)
cost_depth_1 = cost_classical(get_data(results,0),n,alpha,beta)
cost_depth_2 = cost_classical(get_data(results,1),n,alpha,beta)
cost_depth_3 = cost_classical(get_data(results,2),n,alpha,beta)
print('m=1 ' + str(cost_depth_1) + ' m=2 ' + str(cost_depth_2) + 'm=3 ' + str(cost_depth_3))
.. code:: python
# plotting data
plt.plot(range(max_trials), cost_plus_depth_1, range(max_trials), cost_minus_depth_1)
plot_histogram(get_data(results,0),n)
plt.plot(range(max_trials), cost_plus_depth_2, range(max_trials), cost_minus_depth_2)
plot_histogram(get_data(results,1),n)
plt.plot(range(max_trials), cost_plus_depth_3, range(max_trials), cost_minus_depth_3)
plot_histogram(get_data(results,2),n)
MaxCut (DONNA)
===============
.. code:: python
# cost function H = alpha_i z_i + beta_ij z_i z_j
n = 6
alpha = np.zeros(n)
beta = np.zeros((n, n))
beta[0, 1] = 93/2
beta[0, 4] = 17/2
beta[0, 5] = 51/2
beta[1, 0] = 93/2
beta[1, 5] = 13/2
beta[1, 2] = 77/2
beta[2, 1] = 77/2
beta[2, 3] = 31/2
beta[2, 5] = 23/2
beta[3,2] = 31/2
beta[3,4] = 7/2
beta[3,5] = 46/2
beta[4,3] = 7/2
beta[4,5] = 65/2
beta[4,0] = 17/2
beta[5,0] = 51/2
beta[5,1] = 13/2
beta[5,2] = 23/2
beta[5,3] = 46/2
beta[5,4] = 65/2
.. code:: python
# quantum circuit parameters
device = 'simulator' # the device to run on
shots = 8192 # the number of shots in the experiment
entangler_map = {0: [1], 1: [2], 2: [3], 3: [4]} # the map of two-qubit gates with control at key and target at values
# Numerical parameters
SPSA_parameters = np.array([3,0.602,0,.3,0.101]) #[a, alpha, A, c, gamma]
max_trials = 100;
theta_depth_1 = np.random.randn(1*n) # initial controls
theta_depth_2 = np.random.randn(2*n) # initial controls
theta_depth_3 = np.random.randn(3*n) # initial controls
cost_plus_depth_1=np.zeros(max_trials)
cost_minus_depth_1=np.zeros(max_trials)
cost_plus_depth_2=np.zeros(max_trials)
cost_minus_depth_2=np.zeros(max_trials)
cost_plus_depth_3=np.zeros(max_trials)
cost_minus_depth_3=np.zeros(max_trials)
for k in range(max_trials):
print('trial ' + str(k) + " of " + str(max_trials))
a_spsa = float(SPSA_parameters[0])/np.power(k+1+SPSA_parameters[2], SPSA_parameters[1])
c_spsa = float(SPSA_parameters[3])/np.power(k+1, SPSA_parameters[4])
Delta_depth_1 = 2*np.random.randint(2,size=n*1)-1 # \pm 1 random distribution
Delta_depth_2 = 2*np.random.randint(2,size=n*2)-1 # \pm 1 random distribution
Delta_depth_3 = 2*np.random.randint(2,size=n*3)-1 # \pm 1 random distribution
theta_plus_depth_1 = theta_depth_1 + c_spsa*Delta_depth_1
theta_minus_depth_1 = theta_depth_1 - c_spsa*Delta_depth_1
theta_plus_depth_2 = theta_depth_2 + c_spsa*Delta_depth_2
theta_minus_depth_2 = theta_depth_2 - c_spsa*Delta_depth_2
theta_plus_depth_3 = theta_depth_3 + c_spsa*Delta_depth_3
theta_minus_depth_3 = theta_depth_3 - c_spsa*Delta_depth_3
trial_circuit_plus_depth_1 = trial_funtion_optimization(n,1,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_1 = trial_funtion_optimization(n,1,theta_minus_depth_1,entangler_map)
trial_circuit_plus_depth_2 = trial_funtion_optimization(n,2,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_2 = trial_funtion_optimization(n,2,theta_minus_depth_2,entangler_map)
trial_circuit_plus_depth_3 = trial_funtion_optimization(n,3,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_3 = trial_funtion_optimization(n,3,theta_minus_depth_3,entangler_map)
program = [trial_circuit_plus_depth_1,trial_circuit_minus_depth_1,trial_circuit_plus_depth_2
,trial_circuit_minus_depth_2,trial_circuit_plus_depth_3,trial_circuit_minus_depth_3]
out = run_program(program,api,device,shots,max_credits=3)
results=combine_jobs([out['id']], api, wait=20, timeout=440)
cost_plus_depth_1[k] = cost_classical(get_data(results,0),n,alpha,beta)
cost_minus_depth_1[k] = cost_classical(get_data(results,1),n,alpha,beta)
cost_plus_depth_2[k] = cost_classical(get_data(results,2),n,alpha,beta)
cost_minus_depth_2[k] = cost_classical(get_data(results,3),n,alpha,beta)
cost_plus_depth_3[k] = cost_classical(get_data(results,4),n,alpha,beta)
cost_minus_depth_3[k] = cost_classical(get_data(results,5),n,alpha,beta)
g_spsa_depth_1 = (cost_plus_depth_1[k]-cost_minus_depth_1[k])*Delta_depth_1/(2.0*c_spsa)
g_spsa_depth_2 = (cost_plus_depth_2[k]-cost_minus_depth_2[k])*Delta_depth_2/(2.0*c_spsa)
g_spsa_depth_3 = (cost_plus_depth_3[k]-cost_minus_depth_3[k])*Delta_depth_3/(2.0*c_spsa)
theta_depth_1 = theta_depth_1 - a_spsa*g_spsa_depth_1
theta_depth_2 = theta_depth_2 - a_spsa*g_spsa_depth_2
theta_depth_3 = theta_depth_3 - a_spsa*g_spsa_depth_3
trial_circuit_depth_1 = trial_funtion_optimization(n,1,theta_depth_1,entangler_map)
trial_circuit_depth_2 = trial_funtion_optimization(n,2,theta_depth_2,entangler_map)
trial_circuit_depth_3 = trial_funtion_optimization(n,3,theta_depth_3,entangler_map)
program = [trial_circuit_depth_1,trial_circuit_depth_2,trial_circuit_depth_3]
out = run_program(program,api,device,shots,max_credits=3)
results=combine_jobs([out['id']], api, wait=20, timeout=440)
cost_depth_1 = cost_classical(get_data(results,0),n,alpha,beta)
cost_depth_2 = cost_classical(get_data(results,1),n,alpha,beta)
cost_depth_3 = cost_classical(get_data(results,2),n,alpha,beta)
print('m=1 ' + str(cost_depth_1) + ' m=2 ' + str(cost_depth_2) + 'm=3 ' + str(cost_depth_3))
.. code:: python
# plotting data
plt.plot(range(max_trials), cost_plus_depth_1, range(max_trials), cost_minus_depth_1)
plot_histogram(get_data(results,0),n)
plt.plot(range(max_trials), cost_plus_depth_2, range(max_trials), cost_minus_depth_2)
plot_histogram(get_data(results,1),n)
plt.plot(range(max_trials), cost_plus_depth_3, range(max_trials), cost_minus_depth_3)
plot_histogram(get_data(results,2),n)
REAL
====
.. code:: python
# quantum circuit parameters
device = 'real' # the device to run on
shots = 8192 # the number of shots in the experiment
n = 2
entangler_map = {0: [1]} # the map of two-qubit gates with control at key and target at values
# Numerical parameters
SPSA_parameters = np.array([.3,0.602,0,.3,0.101]) #[a, alpha, A, c, gamma]
max_trials = 100;
theta_depth_1 = np.random.randn(1*n) # initial controls
theta_depth_2 = np.random.randn(2*n) # initial controls
theta_depth_3 = np.random.randn(3*n) # initial controls
cost_plus_depth_1=np.zeros(max_trials)
cost_minus_depth_1=np.zeros(max_trials)
cost_plus_depth_2=np.zeros(max_trials)
cost_minus_depth_2=np.zeros(max_trials)
cost_plus_depth_3=np.zeros(max_trials)
cost_minus_depth_3=np.zeros(max_trials)
for k in range(max_trials):
print('trial ' + str(k) + " of " + str(max_trials))
a_spsa = float(SPSA_parameters[0])/np.power(k+1+SPSA_parameters[2], SPSA_parameters[1])
c_spsa = float(SPSA_parameters[3])/np.power(k+1, SPSA_parameters[4])
Delta_depth_1 = 2*np.random.randint(2,size=n*1)-1 # \pm 1 random distribution
Delta_depth_2 = 2*np.random.randint(2,size=n*2)-1 # \pm 1 random distribution
Delta_depth_3 = 2*np.random.randint(2,size=n*3)-1 # \pm 1 random distribution
theta_plus_depth_1 = theta_depth_1 + c_spsa*Delta_depth_1
theta_minus_depth_1 = theta_depth_1 - c_spsa*Delta_depth_1
theta_plus_depth_2 = theta_depth_2 + c_spsa*Delta_depth_2
theta_minus_depth_2 = theta_depth_2 - c_spsa*Delta_depth_2
theta_plus_depth_3 = theta_depth_3 + c_spsa*Delta_depth_3
theta_minus_depth_3 = theta_depth_3 - c_spsa*Delta_depth_3
trial_circuit_plus_depth_1 = trial_funtion_optimization(n,1,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_1 = trial_funtion_optimization(n,1,theta_minus_depth_1,entangler_map)
trial_circuit_plus_depth_2 = trial_funtion_optimization(n,2,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_2 = trial_funtion_optimization(n,2,theta_minus_depth_2,entangler_map)
trial_circuit_plus_depth_3 = trial_funtion_optimization(n,3,theta_plus_depth_3,entangler_map)
trial_circuit_minus_depth_3 = trial_funtion_optimization(n,3,theta_minus_depth_3,entangler_map)
program = [trial_circuit_plus_depth_1,trial_circuit_minus_depth_1,trial_circuit_plus_depth_2
,trial_circuit_minus_depth_2,trial_circuit_plus_depth_3,trial_circuit_minus_depth_3]
out = run_program(program,api,device,shots,max_credits=5)
results=combine_jobs([out['id']], api, wait=20, timeout=480)
cost_plus_depth_1[k] = cost_classical(get_data(results,0),n,alpha,beta)
cost_minus_depth_1[k] = cost_classical(get_data(results,1),n,alpha,beta)
cost_plus_depth_2[k] = cost_classical(get_data(results,2),n,alpha,beta)
cost_minus_depth_2[k] = cost_classical(get_data(results,3),n,alpha,beta)
cost_plus_depth_3[k] = cost_classical(get_data(results,4),n,alpha,beta)
cost_minus_depth_3[k] = cost_classical(get_data(results,5),n,alpha,beta)
g_spsa_depth_1 = (cost_plus_depth_1[k]-cost_minus_depth_1[k])*Delta_depth_1/(2.0*c_spsa)
g_spsa_depth_2 = (cost_plus_depth_2[k]-cost_minus_depth_2[k])*Delta_depth_2/(2.0*c_spsa)
g_spsa_depth_3 = (cost_plus_depth_3[k]-cost_minus_depth_3[k])*Delta_depth_3/(2.0*c_spsa)
theta_depth_1 = theta_depth_1 - a_spsa*g_spsa_depth_1
theta_depth_2 = theta_depth_2 - a_spsa*g_spsa_depth_2
theta_depth_3 = theta_depth_3 - a_spsa*g_spsa_depth_3
trial_circuit_depth_1 = trial_funtion_optimization(n,1,theta_depth_1,entangler_map)
trial_circuit_depth_2 = trial_funtion_optimization(n,2,theta_depth_2,entangler_map)
trial_circuit_depth_3 = trial_funtion_optimization(n,3,theta_depth_3,entangler_map)
program = [trial_circuit_depth_1,trial_circuit_depth_2,trial_circuit_depth_3]
out = run_program(program,api,device,shots,max_credits=5)
results=combine_jobs([out['id']], api, wait=20, timeout=240)
cost_depth_1 = cost_classical(get_data(results,0),n,alpha,beta)
cost_depth_2 = cost_classical(get_data(results,1),n,alpha,beta)
cost_depth_3 = cost_classical(get_data(results,2),n,alpha,beta)
print('m=1 ' + str(cost_depth_1) + ' m=2 ' + str(cost_depth_2) + 'm=3 ' + str(cost_depth_3))
.. code:: python
# plotting data
plt.plot(range(max_trials), cost_plus_depth_1, range(max_trials), cost_minus_depth_1)
plot_histogram(get_data(results,0),n)
plt.plot(range(max_trials), cost_plus_depth_2, range(max_trials), cost_minus_depth_2)
plot_histogram(get_data(results,1),n)
plt.plot(range(max_trials), cost_plus_depth_3, range(max_trials), cost_minus_depth_3)
plot_histogram(get_data(results,2),n)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -1,300 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# qiskit-sdk-py-dev documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 30 00:56:35 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon', #support numpy and google style docstrings
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'nbsphinx',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'qiskit-sdk-py-dev'
copyright = '2017, IBM'
#author = 'Antonio Córcoles, Jerry Chow, Abigail Cross, Andrew Cross, Ismael Faro, Andreas Fuhrer, Jay Gambetta'
author = 'Antonio Córcoles'
author = 'Jerry Chow'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = ''
# The full version, including alpha/beta/rc tags.
release = ''
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#html_theme = 'alabaster'
html_theme = 'agogo'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#html_title = 'qiskit-sdk-py-dev v1.0'
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = '../images/QISKit-c.gif'
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#html_last_updated_fmt = None
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'qiskit-sdk-py-devdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'qiskit-sdk-py-dev.tex', 'qiskit-sdk-py-dev Documentation',
'Antonio Córcoles, Jerry Chow, Abigail Cross, Andrew Cross, Ismael Faro, Andreas Fuhrer, Jay Gambetta', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = '../images/QISKit.gif'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'qiskit-sdk-py-dev', 'qiskit-sdk-py-dev Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'qiskit-sdk-py-dev', 'qiskit-sdk-py-dev Documentation',
author, 'qiskit-sdk-py-dev', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

View File

@ -1,936 +0,0 @@
==========================
Entanglement Revisited
==========================
For more information about how to use the IBM Q experience (QX), consult
the
`tutorials <https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=c59b3710b928891a1420190148a72cce&pageIndex=0>`__,
or check out the
`community <https://quantumexperience.ng.bluemix.net/qstage/#/community>`__.
Contributors
============
Jay Gambetta, Antonio Córcoles
Entanglement
============
In :doc:`superposition and entanglement
<superposition_and_entanglement>`, we introduced you to the quantum
concept of entanglement. We made the quantum state
:math:`|\psi\rangle= (|00\rangle+|11\rangle)/\sqrt{2}` and showed that
(accounting for experimental noise) the system has perfect
correlations in both the computational and the superposition
bases. This means if :math:`q_0` is measured in state
:math:`|0\rangle`, we know :math:`q_1` is in the same state; likewise,
if :math:`q_0` is measured in state :math:`|+\rangle`, we know
:math:`q_1` is also in the same state.
To understand the implications of this in more detail, we will look at
the following topics in this notebook: \* `Two-Qubit Correlated
Observables <#section1>`__ \* `CHSH Inequality <#section2>`__ \* `Two-,
Three-, and Four-Qubit GHZ States <#section3>`__ \* `Mermin's Test and
the Three Box Game <#section4>`__
Two-Qubit Correlated Observables
================================
An observable is a Hermitian matrix where the real eigenvalues represent
the outcome of the experiment, and the eigenvectors are the states to
which the system is projected under measurement. That is, an observable
:math:`A` is given by
.. math:: A = \sum_j a_j|a_j\rangle\langle a_j|
where :math:`|a_j\rangle` is the eigenvector of the observable with
result :math:`a_j`. The expectation value of this observable is given by
.. math:: \langle A \rangle = \sum_j a_j |\langle \psi |a_j\rangle|^2 = \sum_j a_j \mathrm{Pr}(a_j|\psi).
We can see there is the standard relationship between average
(expectation value) and probability.
For a two-qubit system, the following are important two-outcome
(:math:`\pm1`) single-qubit observables:
.. math:: Z= |0\rangle\langle 0| - |1\rangle\langle 1|
.. math:: X= |+\rangle\langle +| - |-\rangle\langle -|
These are also commonly referred to as the Pauli :math:`Z` and :math:`X`
operators. These can be further extended to the two-qubit space to give
.. math:: \langle I\otimes Z\rangle =\mathrm{Pr}(00|\psi) - \mathrm{Pr}(01|\psi) + \mathrm{Pr}(10|\psi)- \mathrm{Pr}(11|\psi)
.. math:: \langle Z\otimes I\rangle =\mathrm{Pr}(00|\psi) + \mathrm{Pr}(01|\psi) - \mathrm{Pr}(10|\psi)- \mathrm{Pr}(11|\psi)
.. math:: \langle Z\otimes Z\rangle =\mathrm{Pr}(00|\psi) - \mathrm{Pr}(01|\psi) - \mathrm{Pr}(10|\psi)+ \mathrm{Pr}(11|\psi)
.. math:: \langle I\otimes X\rangle =\mathrm{Pr}(++|\psi) - \mathrm{Pr}(+-|\psi) + \mathrm{Pr}(-+|\psi)- \mathrm{Pr}(--|\psi)
.. math:: \langle X\otimes I\rangle =\mathrm{Pr}(++|\psi) + \mathrm{Pr}(+-|\psi) - \mathrm{Pr}(-+|\psi)- \mathrm{Pr}(--|\psi)
.. math:: \langle X\otimes X\rangle =\mathrm{Pr}(++|\psi) - \mathrm{Pr}(+-|\psi) - \mathrm{Pr}(-+|\psi)+ \mathrm{Pr}(--|\psi)
.. math:: \langle Z\otimes X\rangle =\mathrm{Pr}(0+|\psi) - \mathrm{Pr}(0-|\psi) - \mathrm{Pr}(1+|\psi)+ \mathrm{Pr}(1-|\psi)
.. math:: \langle X\otimes Z\rangle =\mathrm{Pr}(+0|\psi) - \mathrm{Pr}(+1|\psi) - \mathrm{Pr}(-0|\psi)+ \mathrm{Pr}(-1|\psi)
.. code:: ipython3
# Checking the version of PYTHON; we only support 3 at the moment
import sys
if sys.version_info < (3,0):
raise Exception("Please use Python version 3 or greater.")
# useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import sys
sys.path.append("../../")
# importing the QISKit
from qiskit import QuantumCircuit, QuantumProgram
import Qconfig
# import basic plot tools
from qiskit.basicplotter import plot_histogram
Recall that to make the Bell state
:math:`|\psi\rangle= (|00\rangle+|11\rangle)/\sqrt{2}` from the initial
state :math:`|00\rangle`, the quantum circuit first applies a Hadamard
on :math:`q_0`, followed by a CNOT from :math:`q_0` to :math:`q_1`. On
the IBM Q experience, this can done by using the script below to measure
the above expectation values; we run four different experiments with
measurements in the standard basis, superposition basis, and a
combination of both.
.. code:: ipython3
device = 'ibmqx2' # the device to run on
shots = 1024 # the number of shots in the experiment
# device = 'simulator' # the device test purpose
QPS_SPECS = {
"name": "Entanglement",
"circuits": [{
"name": "bell",
"quantum_registers": [{
"name":"q",
"size":2
}],
"classical_registers": [{
"name":"c",
"size":2
}]}],
}
Q_program = QuantumProgram(specs=QPS_SPECS)
Q_program.set_api(Qconfig.APItoken, Qconfig.config["url"])
# quantum circuit to make Bell state
bell = Q_program.get_circuit("bell")
q = Q_program.get_quantum_registers("q")
c = Q_program.get_classical_registers('c')
bell.h(q[0])
bell.cx(q[0],q[1])
# quantum circuit to measure q in standard basis
measureZZ = Q_program.create_circuit("measureZZ", ["q"], ["c"])
measureZZ.measure(q[0], c[0])
measureZZ.measure(q[1], c[1])
# quantum circuit to measure q in superposition basis
measureXX = Q_program.create_circuit("measureXX", ["q"], ["c"])
measureXX.h(q[0])
measureXX.h(q[1])
measureXX.measure(q[0], c[0])
measureXX.measure(q[1], c[1])
# quantum circuit to measure ZX
measureZX = Q_program.create_circuit("measureZX", ["q"], ["c"])
measureZX.h(q[0])
measureZX.measure(q[0], c[0])
measureZX.measure(q[1], c[1])
# quantum circuit to measure XZ
measureXZ = Q_program.create_circuit("measureXZ", ["q"], ["c"])
measureXZ.h(q[1])
measureXZ.measure(q[0], c[0])
measureXZ.measure(q[1], c[1])
.. parsed-literal::
>> quantum_registers created: q 2
>> classical_registers created: c 2
.. parsed-literal::
<qiskit._measure.Measure at 0x10da47e10>
.. code:: ipython3
Q_program.add_circuit("bell_measureZX", bell+measureZX )
Q_program.add_circuit("bell_measureXZ", bell+measureXZ )
Q_program.add_circuit("bell_measureZZ", bell+measureZZ )
Q_program.add_circuit("bell_measureXX", bell+measureXX )
circuits = ["bell_measureZZ", "bell_measureZX", "bell_measureXX", "bell_measureXZ"]
Q_program.get_qasms(circuits)
.. parsed-literal::
['OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nh q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nh q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n']
.. code:: ipython3
Q_program.execute(circuits, device, shots, max_credits=3, wait=10, timeout=240)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
.. code:: ipython3
### THIS IS A KNOWN BUG AND WHEN WE FIX THE RETURN FROM THE REAL DEVICE WE WILL ONLY HAVE ONE SET OF OBSERVABLES
observable_first ={'00000': 1, '00001': -1, '00010': 1, '00011': -1}
observable_second ={'00000': 1, '00001': 1, '00010': -1, '00011': -1}
observable_correlated ={'00000': 1, '00001': -1, '00010': -1, '00011': 1}
observable_first_ideal ={'00': 1, '01': -1, '10': 1, '11': -1}
observable_second_ideal ={'00': 1, '01': 1, '10': -1, '11': -1}
observable_correlated_ideal ={'00': 1, '01': -1, '10': -1, '11': 1}
.. code:: ipython3
print("IZ = " + str(Q_program.average_data("bell_measureZZ",observable_first)))
print("ZI = " + str(Q_program.average_data("bell_measureZZ",observable_second)))
print("ZZ = " + str(Q_program.average_data("bell_measureZZ",observable_correlated)))
print("IX = " + str(Q_program.average_data("bell_measureXX",observable_first)))
print("XI = " + str(Q_program.average_data("bell_measureXX",observable_second)))
print("XX = " + str(Q_program.average_data("bell_measureXX",observable_correlated)))
print("ZX = " + str(Q_program.average_data("bell_measureZX",observable_correlated)))
print("XZ = " + str(Q_program.average_data("bell_measureXZ",observable_correlated)))
.. parsed-literal::
IZ = 0.025390625
ZI = 0.015625
ZZ = 0.857421875
IX = 0.05859375
XI = 0.07421875
XX = 0.875
ZX = 0.0
XZ = 0.025390625
Here we see that for the state
:math:`|\psi\rangle= (|00\rangle+|11\rangle)/\sqrt{2}`, expectation
values (within experimental errors) are
+--------------+------------------+--------------+------------------+--------------+------------------+
| Observable | Expected value | Observable | Expected value | Observable | Expected value |
+==============+==================+==============+==================+==============+==================+
| ZZ | 1 | XX | 1 | ZX | 0 |
+--------------+------------------+--------------+------------------+--------------+------------------+
| ZI | 0 | XI | 0 | XZ | 0 |
+--------------+------------------+--------------+------------------+--------------+------------------+
| IZ | 0 | IX | 0 | | |
+--------------+------------------+--------------+------------------+--------------+------------------+
How do we explain this situation? Here we introduce the concept of a
*hidden variable model*. If we assume there is a hidden variable
:math:`\lambda` and follow these two assumptions:
- *Locality*: No information can travel faster than the speed of light.
There is a hidden variable :math:`\lambda` that defines all the
correlations so that
.. math:: \langle A\otimes B\rangle = \sum_\lambda P(\lambda) A(\lambda) B(\lambda)
- *Realism*: All observables have a definite value independent of the
measurement (:math:`A(\lambda)=\pm1` etc.).
then can we describe these observations? --- The answer is yes!
Assume :math:`\lambda` has two bits, each occurring randomly with
probably 1/4. The following predefined table would then explain all the
above observables:
+-------------------+---------------+---------------+---------------+---------------+
| :math:`\lambda` | Z (qubit 1) | Z (qubit 2) | X (qubit 1) | X (qubit 2) |
+===================+===============+===============+===============+===============+
| 00 | 1 | 1 | 1 | 1 |
+-------------------+---------------+---------------+---------------+---------------+
| 01 | 1 | 1 | -1 | -1 |
+-------------------+---------------+---------------+---------------+---------------+
| 10 | -1 | -1 | -1 | -1 |
+-------------------+---------------+---------------+---------------+---------------+
| 11 | -1 | -1 | 1 | 1 |
+-------------------+---------------+---------------+---------------+---------------+
Thus, with a purely classical hidden variable model, we are able to
reconcile the measured observations we had for this particular Bell
state. However, there are some states for which this model will not
hold. This was first observed by John Stewart Bell in 1964. He proposed
a theorem that suggests that there are no hidden variables in quantum
mechanics. At the core of Bell's theorem is the famous Bell inequality.
Here, we'll use a refined version of this inequality (known as the CHSH
inequality, derived by John Clauser, Michael Horne, Abner Shimony, and
Richard Holt in 1969) to demonstrate Bell's proposal.
CHSH Inequality
===============
In the CHSH inequality, we measure the correlator of four observables:
:math:`A` and :math:`A'` on :math:`q_0`, and :math:`B` and :math:`B'` on
:math:`q_1`, which have eigenvalues :math:`\pm 1`. The CHSH inequality
says that no local hidden variable theory can have
.. math:: |C|>2
where
.. math:: C = \langle B\otimes A\rangle + \langle B\otimes A'\rangle+\langle B'\otimes A'\rangle-\langle B'\otimes A\rangle.
What would this look like with some hidden variable model under the
locality and realism assumptions from above? :math:`C` then becomes
.. math:: C = \sum_\lambda P(\lambda) \{ B(\lambda) [ A(\lambda)+A'(\lambda)] + B'(\lambda) [ A'(\lambda)-A(\lambda)]
and :math:`[A(\lambda)+A'(\lambda)]=2` (or 0) while
:math:`[A'(\lambda)-A(\lambda)]=0` (or 2) respectively. That is,
:math:`|C|=2`, and noise will only make this smaller.
If we measure a number greater than 2, the above assumptions cannot be
valid. (This is a perfect example of one of those astonishing
counterintuitive ideas one must accept in the quantum world.) For
simplicity, we choose these observables to be
.. math:: C = \langle Z\otimes Z\rangle + \langle Z\otimes X\rangle+\langle X\otimes X\rangle-\langle X\otimes Z\rangle.
:math:`Z` is measured in the computational basis, and :math:`X` in the
superposition basis (:math:`H` is applied before measurement). The input
state
.. math:: |\psi(\theta)\rangle = I\otimes Y(\theta)\frac{|00\rangle + |11\rangle}{\sqrt(2)} = \frac{\cos(\theta/2)|00\rangle + \cos(\theta/2)|11\rangle+\sin(\theta/2)|01\rangle-\sin(\theta/2)|10\rangle}{\sqrt{2}}
is swept vs. :math:`\theta` (think of this as allowing us to prepare a
varying set of states varying in the angle :math:`\theta`).
Note that the following demonstration of CHSH is not loophole-free.
.. code:: ipython3
CHSH = lambda x : x[0]+x[1]+x[2]-x[3]
.. code:: ipython3
device = 'local_qasm_simulator'
shots = 8192
program = []
xdata=[]
program_end = [measureZZ, measureZX, measureXX, measureXZ]
k = 0
for jj in range(30):
theta = 2.0*np.pi*jj/30
bell_middle = QuantumCircuit(q,c)
bell_middle.ry(theta,q[0])
for i in range(4):
program.append("circuit"+str(k))
Q_program.add_circuit("circuit"+str(k), bell+bell_middle+program_end[i] )
k += 1
xdata.append(theta)
.. code:: ipython3
Q_program.get_qasms(program[0:8])
.. parsed-literal::
['OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nh q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nh q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.209439510239320) q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.209439510239320) q[0];\nh q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.209439510239320) q[0];\nh q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.209439510239320) q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n']
.. code:: ipython3
Q_program.execute(program, device, shots, max_credits=3, wait=10, timeout=240)
.. parsed-literal::
running on backend: local_qasm_simulator
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
.. code:: ipython3
CHSH_data_sim = []
k = 0
for j in range(len(xdata)):
temp=[]
for i in range(4):
temp.append(Q_program.average_data("circuit"+str(k),observable_correlated_ideal))
k += 1
CHSH_data_sim.append(CHSH(temp))
.. code:: ipython3
device = 'ibmqx2'
shots = 1024
program_real = []
xdata_real=[]
k = 0
for jj in range(10):
theta = 2.0*np.pi*jj/10
bell_middle = QuantumCircuit(q,c)
bell_middle.ry(theta,q[0])
for i in range(4):
program_real.append("circuit_real"+str(k))
Q_program.add_circuit("circuit_real"+str(k), bell+bell_middle+program_end[i] )
k += 1
xdata_real.append(theta)
.. code:: ipython3
Q_program.execute(program_real, device, shots, max_credits=3, wait=10, timeout=240)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
status = RUNNING (30 seconds)
status = RUNNING (40 seconds)
status = RUNNING (50 seconds)
status = RUNNING (60 seconds)
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
.. code:: ipython3
Q_program.get_qasms(program_real[0:8])
.. parsed-literal::
['OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nh q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nh q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.000000000000000) q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.628318530717959) q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.628318530717959) q[0];\nh q[0];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.628318530717959) q[0];\nh q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg c[2];\nh q[0];\ncx q[0],q[1];\nry(0.628318530717959) q[0];\nh q[1];\nmeasure q[0] -> c[0];\nmeasure q[1] -> c[1];\n']
.. code:: ipython3
CHSH_data_real = []
k = 0
for j in range(len(xdata_real)):
temp=[]
for i in range(4):
temp.append(Q_program.average_data("circuit_real"+str(k),observable_correlated))
k += 1
CHSH_data_real.append(CHSH(temp))
.. code:: ipython3
plt.plot(xdata, CHSH_data_sim, 'r-', xdata_real, CHSH_data_real, 'bo')
plt.plot([0, 2*np.pi], [2, 2], 'b-')
plt.plot([0, 2*np.pi], [-2, -2], 'b-')
plt.grid()
plt.ylabel('CHSH', fontsize=20)
plt.xlabel(r'$Y(\theta)$', fontsize=20)
plt.show()
.. image:: entanglement_revisited_files/entanglement_revisited_22_0.png
The resulting graph created by running the previous cell compares the
simulated data (sinusoidal line) and the data from the real experiment.
The graph also gives lines at :math:`\pm 2` for reference. Did you
violate the hidden variable model?
Here is the saved CHSH data.
.. code:: ipython3
print(CHSH_data_real)
.. parsed-literal::
[1.74609375, 2.462890625, 2.138671875, 1.15234375, -0.349609375, -1.736328125, -2.39453125, -2.123046875, -1.123046875, 0.365234375]
Despite the presence of loopholes in our demonstration, we can see that
this experiment is compatible with quantum mechanics as a theory with no
local hidden variables. See the original experimental demonstrations of
this test with superconducting qubits
`here <https://arstechnica.com/science/2017/05/quantum-volume-one-number-to-benchmark-a-quantum-computer/>`__
and
`here <https://journals.aps.org/pra/abstract/10.1103/PhysRevA.81.062325>`__.
Two-, Three-, and Four-Qubit GHZ States
=======================================
What does entanglement look like beyond two qubits? An important set of
maximally entangled states are known as GHZ states (named after
Greenberger, Horne, and Zeilinger). These are the states of the form
:math:`|\psi\rangle = \left (|0...0\rangle+|1...1\rangle\right)/\sqrt{2}`.
The Bell state previously described is merely a two-qubit version of a
GHZ state. The next cells prepare GHZ states of two, three, and four
qubits.
.. code:: ipython3
# 2 - qubits
shots = 8192
device = 'ibmqx2'
# device = 'simulator' # the device test purpose
# quantum circuit to make GHZ state
q = Q_program.create_quantum_registers("q", 2)
c = Q_program.create_classical_registers("c", 2)
ghz = Q_program.create_circuit("ghz", ["q"], ["c"])
ghz.h(q[0])
ghz.cx(q[0],q[1])
# quantum circuit to measure q in standard basis
measureZZ = Q_program.create_circuit("measureZZ", ["q"], ["c"])
measureZZ.measure(q[0], c[0])
measureZZ.measure(q[1], c[1])
measureXX = Q_program.create_circuit("measureXX", ["q"], ["c"])
measureXX.h(q[0])
measureXX.h(q[1])
measureXX.measure(q[0], c[0])
measureXX.measure(q[1], c[1])
Q_program.add_circuit("ghz_measureZZ", ghz+measureZZ )
Q_program.add_circuit("ghz_measureXX", ghz+measureXX )
circuits = ["ghz_measureZZ", "ghz_measureXX"]
Q_program.get_qasms(circuits)
Q_program.execute(circuits, device, shots, max_credits=5, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("ghz_measureZZ"))
plot_histogram(Q_program.get_counts("ghz_measureXX"))
.. parsed-literal::
>> quantum_registers created: q 2
>> classical_registers created: c 2
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
status = RUNNING (30 seconds)
status = RUNNING (40 seconds)
status = RUNNING (50 seconds)
status = RUNNING (60 seconds)
status = RUNNING (70 seconds)
status = RUNNING (80 seconds)
status = RUNNING (90 seconds)
.. image:: entanglement_revisited_files/entanglement_revisited_28_1.png
.. image:: entanglement_revisited_files/entanglement_revisited_28_2.png
.. code:: ipython3
# 3 - qubits
shots = 8192
# quantum circuit to make GHZ state
q = Q_program.create_quantum_registers("q", 3)
c = Q_program.create_classical_registers("c", 3)
ghz = Q_program.create_circuit("ghz", ["q"], ["c"])
ghz.h(q[0])
ghz.cx(q[0],q[1])
ghz.cx(q[1],q[2])
# quantum circuit to measure q in standard basis
measureZZZ = Q_program.create_circuit("measureZZZ", ["q"], ["c"])
measureZZZ.measure(q[0], c[0])
measureZZZ.measure(q[1], c[1])
measureZZZ.measure(q[2], c[2])
measureXXX = Q_program.create_circuit("measureXXX", ["q"], ["c"])
measureXXX.h(q[0])
measureXXX.h(q[1])
measureXXX.h(q[2])
measureXXX.measure(q[0], c[0])
measureXXX.measure(q[1], c[1])
measureXXX.measure(q[2], c[2])
Q_program.add_circuit("ghz_measureZZZ", ghz+measureZZZ )
Q_program.add_circuit("ghz_measureXXX", ghz+measureXXX )
circuits = ["ghz_measureZZZ", "ghz_measureXXX"]
Q_program.get_qasms(circuits)
Q_program.execute(circuits, device, shots, max_credits=5, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("ghz_measureZZZ"))
plot_histogram(Q_program.get_counts("ghz_measureXXX"))
.. parsed-literal::
>> quantum_registers created: q 3
>> classical_registers created: c 3
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
status = RUNNING (30 seconds)
status = RUNNING (40 seconds)
status = RUNNING (50 seconds)
status = RUNNING (60 seconds)
status = RUNNING (70 seconds)
status = RUNNING (80 seconds)
status = RUNNING (90 seconds)
status = RUNNING (100 seconds)
status = RUNNING (110 seconds)
status = RUNNING (120 seconds)
.. image:: entanglement_revisited_files/entanglement_revisited_29_1.png
.. image:: entanglement_revisited_files/entanglement_revisited_29_2.png
.. code:: ipython3
# 4 - qubits
shots = 8192
# quantum circuit to make GHZ state
q = Q_program.create_quantum_registers("q", 4)
c = Q_program.create_classical_registers("c", 4)
ghz = Q_program.create_circuit("ghz", ["q"], ["c"])
ghz.h(q[0])
ghz.cx(q[0],q[1])
ghz.cx(q[1],q[2])
ghz.h(q[3])
ghz.h(q[2])
ghz.cx(q[3],q[2])
ghz.h(q[3])
ghz.h(q[2])
# quantum circuit to measure q in standard basis
measureZZZZ = Q_program.create_circuit("measureZZZZ", ["q"], ["c"])
measureZZZZ.measure(q[0], c[0])
measureZZZZ.measure(q[1], c[1])
measureZZZZ.measure(q[2], c[2])
measureZZZZ.measure(q[3], c[3])
measureXXXX = Q_program.create_circuit("measureXXXX", ["q"], ["c"])
measureXXXX.h(q[0])
measureXXXX.h(q[1])
measureXXXX.h(q[2])
measureXXXX.h(q[3])
measureXXXX.measure(q[0], c[0])
measureXXXX.measure(q[1], c[1])
measureXXXX.measure(q[2], c[2])
measureXXXX.measure(q[3], c[3])
Q_program.add_circuit("ghz_measureZZZZ", ghz+measureZZZZ )
Q_program.add_circuit("ghz_measureXXXX", ghz+measureXXXX )
circuits = ["ghz_measureZZZZ", "ghz_measureXXXX"]
Q_program.get_qasms(circuits)
Q_program.execute(circuits, device, shots, max_credits=5, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("ghz_measureZZZZ"))
plot_histogram(Q_program.get_counts("ghz_measureXXXX"))
.. parsed-literal::
>> quantum_registers created: q 4
>> classical_registers created: c 4
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
status = RUNNING (30 seconds)
status = RUNNING (40 seconds)
status = RUNNING (50 seconds)
status = RUNNING (60 seconds)
status = RUNNING (70 seconds)
status = RUNNING (80 seconds)
status = RUNNING (90 seconds)
status = RUNNING (100 seconds)
status = RUNNING (110 seconds)
status = RUNNING (120 seconds)
status = RUNNING (130 seconds)
status = RUNNING (140 seconds)
status = RUNNING (150 seconds)
status = RUNNING (160 seconds)
status = RUNNING (170 seconds)
status = RUNNING (180 seconds)
status = RUNNING (190 seconds)
.. image:: entanglement_revisited_files/entanglement_revisited_30_1.png
.. image:: entanglement_revisited_files/entanglement_revisited_30_2.png
Mermin's Test and the Three Box Game
====================================
In case the violation of Bell's inequality (CHSH) by two qubits is not
enough to convince you to believe in quantum mechanics, we can
generalize to a more stringent set of tests with three qubits, which can
give a single-shot violation (rather than taking averaged statistics). A
well-known three-qubit case is Mermin's inequality, which is a test we
can perform on GHZ states.
An example of a three-qubit GHZ state is
:math:`|\psi\rangle = \left (|000\rangle+|111\rangle\right)/\sqrt{2}`.
You can see this is a further generalization of a Bell state and, if
measured, should give :math:`|000\rangle` half the time and
:math:`|111 \rangle` the other half of the time.
.. code:: ipython3
# quantum circuit to make GHZ state
q = Q_program.create_quantum_registers("q", 3)
c = Q_program.create_classical_registers("c", 3)
ghz = Q_program.create_circuit("ghz", ["q"], ["c"])
ghz.h(q[0])
ghz.cx(q[0],q[1])
ghz.cx(q[0],q[2])
# quantum circuit to measure q in standard basis
measureZZZ = Q_program.create_circuit("measureZZZ", ["q"], ["c"])
measureZZZ.measure(q[0], c[0])
measureZZZ.measure(q[1], c[1])
measureZZZ.measure(q[2], c[2])
Q_program.add_circuit("ghz_measureZZZ", ghz+measureZZZ )
circuits = ["ghz_measureZZZ"]
Q_program.get_qasms(circuits)
Q_program.execute(circuits, device, shots, max_credits=5, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("ghz_measureZZZ"))
.. parsed-literal::
>> quantum_registers created: q 3
>> classical_registers created: c 3
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
status = RUNNING (30 seconds)
status = RUNNING (40 seconds)
status = RUNNING (50 seconds)
status = RUNNING (60 seconds)
status = RUNNING (70 seconds)
status = RUNNING (80 seconds)
status = RUNNING (90 seconds)
status = RUNNING (100 seconds)
status = RUNNING (110 seconds)
.. image:: entanglement_revisited_files/entanglement_revisited_33_1.png
Suppose we have three independent systems, :math:`\{A, B, C\}`, for
which we can query two particular questions (observables) :math:`X` and
:math:`Y`. In each case, either query can give :math:`+1` or :math:`-1`.
Consider whether it is possible to choose some state of the three boxes
such that we can satisfy the following four conditions:
:math:`X_A Y_B Y_C = 1`, :math:`Y_A X_B Y_C =1`,
:math:`Y_A Y_B X_C = 1`, and :math:`X_A X_B X_C = -1`. Classically, this
can be shown to be impossible... but a three-qubit GHZ state can in fact
satisfy all four conditions.
.. code:: ipython3
MerminM = lambda x : x[0]*x[1]*x[2]*x[3]
.. code:: ipython3
observable ={'00000': 1, '00001': -1, '00010': -1, '00011': 1, '00100': -1, '00101': 1, '00110': 1, '00111': -1}
.. code:: ipython3
# quantum circuit to measure q XXX
measureXXX = Q_program.create_circuit("measureXXX", ["q"], ["c"])
measureXXX.h(q[0])
measureXXX.h(q[1])
measureXXX.h(q[2])
measureXXX.measure(q[0], c[0])
measureXXX.measure(q[1], c[1])
measureXXX.measure(q[2], c[2])
# quantum circuit to measure q XYY
measureXYY = Q_program.create_circuit("measureXYY", ["q"], ["c"])
measureXYY.s(q[1]).inverse()
measureXYY.s(q[2]).inverse()
measureXYY.h(q[0])
measureXYY.h(q[1])
measureXYY.h(q[2])
measureXYY.measure(q[0], c[0])
measureXYY.measure(q[1], c[1])
measureXYY.measure(q[2], c[2])
# quantum circuit to measure q YXY
measureYXY = Q_program.create_circuit("measureYXY", ["q"], ["c"])
measureYXY.s(q[0]).inverse()
measureYXY.s(q[2]).inverse()
measureYXY.h(q[0])
measureYXY.h(q[1])
measureYXY.h(q[2])
measureYXY.measure(q[0], c[0])
measureYXY.measure(q[1], c[1])
measureYXY.measure(q[2], c[2])
# quantum circuit to measure q YYX
measureYYX = Q_program.create_circuit("measureYYX", ["q"], ["c"])
measureYYX.s(q[0]).inverse()
measureYYX.s(q[1]).inverse()
measureYYX.h(q[0])
measureYYX.h(q[1])
measureYYX.h(q[2])
measureYYX.measure(q[0], c[0])
measureYYX.measure(q[1], c[1])
measureYYX.measure(q[2], c[2])
Q_program.add_circuit("ghz_measureXXX", ghz+measureXXX )
Q_program.add_circuit("ghz_measureYYX", ghz+measureYYX )
Q_program.add_circuit("ghz_measureYXY", ghz+measureYXY )
Q_program.add_circuit("ghz_measureXYY", ghz+measureXYY )
circuits = ["ghz_measureXXX", "ghz_measureYYX", "ghz_measureYXY", "ghz_measureXYY"]
Q_program.get_qasms(circuits)
Q_program.execute(circuits, device, shots, max_credits=5, wait=10, timeout=240)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
status = RUNNING (30 seconds)
status = RUNNING (40 seconds)
status = RUNNING (50 seconds)
status = RUNNING (60 seconds)
status = RUNNING (70 seconds)
status = RUNNING (80 seconds)
status = RUNNING (90 seconds)
status = RUNNING (100 seconds)
status = RUNNING (110 seconds)
status = RUNNING (120 seconds)
status = RUNNING (130 seconds)
status = RUNNING (140 seconds)
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
.. code:: ipython3
temp=[]
temp.append(Q_program.average_data("ghz_measureXXX",observable))
temp.append(Q_program.average_data("ghz_measureYYX",observable))
temp.append(Q_program.average_data("ghz_measureYXY",observable))
temp.append(Q_program.average_data("ghz_measureXYY",observable))
print(MerminM(temp))
.. parsed-literal::
-0.1933898929106448
The above shows that the average statistics are not consistent with a
local hidden variable theory. To demonstrate with single shots, we can
run 50 single experiments, with each experiment chosen randomly, and the
outcomes saved. If there was a local hidden variable theory, all the
outcomes would be :math:`+1`.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,28 +0,0 @@
.. qiskit-sdk-py-dev documentation master file, created by
sphinx-quickstart on Fri Jun 30 00:56:35 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to qiskit-sdk-py-dev's documentation!
=============================================
Contents:
.. toctree::
:maxdepth: 2
intro
tutorial4developer
superposition_and_entanglement
entanglement_revisited
tomography
classical_optimization
Quantum Chemistry <quantum_chemistry>
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,129 +0,0 @@
#########################################
QISKit (Quantum Information Software Kit)
#########################################
The latest version of this notebook is available on
https://github.com/IBM/qiskit-sdk-py/tree/master/scripts.
For more information about how to use the IBM Q experience (QX), consult
the
`tutorials <https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=c59b3710b928891a1420190148a72cce&pageIndex=0>`__,
or check out the
`community <https://quantumexperience.ng.bluemix.net/qstage/#/community>`__.
Contributors (alphabetical)
===========================
Jerry Chow, Antonio Córcoles, Abigail Cross, Andrew Cross, Ismael Faro,
Andreas Fuhrer, Jay Gambetta
In future releases, anyone who contributes to the tutorial can include
their name here.
Introduction
============
Welcome to QISKit! Interested in quantum computing and programming a
real live quantum processor? QISKit is a simple set of tools for anyone
interested in exploring quantum information science. We have put
together a set of Jupyter notebooks to demonstrate how to use our tools
and explore the quantum world.
The notebooks are organized into the following topics:
:ref:`introducing-the-tools`
:ref:`exploring-quantum-information-concepts`
:ref:`verification_tools_for_quantum_science`
:ref:`applications_of_short_depth_quantum_circuits_on_quantum_computers`
:ref:`quantum-games`
.. _introducing-the-tools:
Introducing the tools
=====================
In this first topic, we break down the tools in this QISKit SDK, and
introduce all the different parts to make this useful. Our list of
introductory notebooks:
- :doc:`Getting Started with QISKit SDK <tutorial4developer>` shows how to use the QISKit SDK tools.
- Compiling and Running a Quantum Progam [coming soon]
- Loading and Saving a Quantum Program [coming soon]
- Visualizing a Quantum State [coming soon]
.. _exploring-quantum-information-concepts:
Exploring quantum information concepts
======================================
The next set of notebooks shows how you can explore some simple concepts
of quantum information science.
- :doc:`Superposition and Entanglement <superposition_and_entanglement>`
illustrates how to make simple quantum states on one and two qubits,
and demonstrates concepts such as quantum superpositions and
entanglement.
- Single-qubit states: amplitude and phase [coming soon] illustrates
more complicated single-qubit states.
- :doc:`Entanglement revisited <entanglement_revisited>` -
illustrates the CHSH inequality, and extensions for three qubits
(Mermin).
- Quantum teleportation [coming soon]
- Quantum superdense coding [coming soon]
.. _verification_tools_for_quantum_science:
Verification tools for quantum information science
==================================================
The third set of notebooks allows you to explore tools for verification
of quantum systems with commonly-used techniques such as tomography and
randomized benchmarking.
- Quantum coherence studies [coming soon]
- Quantum state tomography [coming soon]
- Quantum process tomography [coming soon]
- Pauli randomized benchmarking [coming soon]
- Standard randomized benchmarking [coming soon]
- Purity randomized benchmarking [coming soon]
- Leakage randomized benchmarking [coming soon]
- Simultaneous randomized benchmarking [coming soon]
- Gate set tomography [coming soon]
.. _applications_of_short_depth_quantum_circuits_on_quantum_computers:
Applications of quantum information science
===========================================
To fully grasp the possibilities, this set of notebooks shows how you
can explore applications of short-depth quantum computers.
Sampling
--------
- :doc:`Quantum optimization <classical_optimization>` -
illustrates how to use a quantum computer to look at optimization
problems.
- :doc:`Quantum chemistry by variational quantum eigensolver method <quantum_chemistry>` [coming
soon] - illustrates how to use a quantum computer to look at
chemistry problems.
Non-Sampling
------------
- Iterative phase estimation [coming soon]
.. _quantum-games:
Quantum Games
=============
[coming soon]

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,664 +0,0 @@
################################
Superposition and Entanglemen
################################
For more information about how to use the IBM Q experience (QX), consult
the
`tutorials <https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=c59b3710b928891a1420190148a72cce&pageIndex=0>`__,
or check out the
`community <https://quantumexperience.ng.bluemix.net/qstage/#/community>`__.
Contributors
============
Jay Gambetta, Antonio Córcoles, Andrew Cross
Introduction
============
Many people tend to think quantum physics is hard math, but this is not
actually true. Quantum concepts are very similar to those seen in the
linear algebra classes you may have taken as a freshman in college, or
even in high school. The challenge of quantum physics is the necessity
to accept counter-intuitive ideas, and its lack of a simple underlying
theory. We believe that if you can grasp the following two Principles,
you have will have a good start:
1. :ref:`A physical system in a perfectly definite state can still behave randomly. <quantum_states-basis_states_and_superpositions>`
2. :ref:`Two systems that are too far apart to influence each other can nevertheless behave in ways that, though individually random, are somehow strongly correlated. <entanglement>`
Getting Started
===============
Please see :doc:`Getting Started with QISKit <tutorial4developer>` if
you would like to understand how to get started with the QISKit SDK. For
this script, simply work your way though the tutorial to learn about
superposition and entanglement.
.. code:: python
# Checking the version of PYTHON; we only support 3 at the moment
import sys
if sys.version_info < (3,0):
raise Exception("Please use Python version 3 or greater.")
# useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
sys.path.append("../../")
# importing the QISKit
from qiskit import QuantumProgram
import Qconfig
# import basic plot tools
from qiskit.basicplotter import plot_histogram
.. _quantum_states-basis_states_and_superpositions:
Quantum States - Basis States and Superpositions
================================================
The first Principle above tells us that the results of measuring a
quantum state may be random or deterministic, depending on what basis is
used. To demonstrate, we will first introduce the computational (or
standard) basis for a qubit.
The computational basis is the set containing the ground and excited
state :math:`\{|0\rangle,|1\rangle\}`, which also corresponds to the
following vectors:
.. math:: |0\rangle =\begin{pmatrix} 1 \\ 0 \end{pmatrix}
.. math:: |1\rangle =\begin{pmatrix} 0 \\ 1 \end{pmatrix}
In Python these are represented by
.. code:: python
zero = np.array([[1],[0]])
one = np.array([[0],[1]])
In our quantum processor system (and many other physical quantum
processors) it is natural for all qubits to start in the
:math:`|0\rangle` state, known as the ground state. To make the
:math:`|1\rangle` (or excited) state, we use the operator
.. math:: X =\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.
This :math:`X` operator is often called a bit-flip because it exactly
implements the following:
.. math:: X: |0\rangle \rightarrow |1\rangle
.. math:: X: |1\rangle \rightarrow |0\rangle.
In Python this can be represented by the following:
.. code:: python
X = np.array([[0,1],[1,0]])
print(np.dot(X,zero))
print(np.dot(X,one))
.. parsed-literal::
[[0]
[1]]
[[1]
[0]]
Next, we give the two quantum circuits for preparing a single qubit in
the ground and excited states using the IBM Q experience. The first part
uses QISKit to make the two circuits.
.. code:: python
device = 'ibmqx2' # the device to run on
shots = 1024 # the number of shots in the experiment
Q_program = QuantumProgram()
Q_program.set_api(Qconfig.APItoken, Qconfig.config["url"]) # set the APIToken and API url
# Creating registers
qr = Q_program.create_quantum_registers("qr", 1)
cr = Q_program.create_classical_registers("cr", 1)
# Quantum circuit ground
qc_ground = Q_program.create_circuit("ground", ["qr"], ["cr"])
qc_ground.measure(qr[0], cr[0])
# Quantum circuit excited
qc_excited = Q_program.create_circuit("excited", ["qr"], ["cr"])
qc_excited.x(qr)
qc_excited.measure(qr[0], cr[0])
circuits = ['ground', 'excited']
Q_program.get_qasms(circuits)
.. parsed-literal::
>> quantum_registers created: qr 1
>> classical_registers created: cr 1
.. parsed-literal::
['OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg qr[1];\ncreg cr[1];\nmeasure qr[0] -> cr[0];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg qr[1];\ncreg cr[1];\nx qr[0];\nmeasure qr[0] -> cr[0];\n']
Here we have created two jobs with different quantum circuits; the first
to prepare the ground state, and the second to prepare the excited
state. Now we can run the batched jobs on the QX.
.. code:: python
Q_program.execute(circuits, device, shots, max_credits=3, wait=10, timeout=240)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
After the run has been completed, the data can be extracted from the API
output and plotted.
.. code:: python
plot_histogram(Q_program.get_counts("ground"))
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_14_0.png
.. code:: python
plot_histogram(Q_program.get_counts("excited"))
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_15_0.png
Here we see that with high probability the qubit is in the
:math:`|0\rangle` state for the first circuit and in the
:math:`|1\rangle` state for the second circuit. The difference from an
ideal perfect answer in both cases is due to a combination of
measurement error, preparation error, and gate error (for the
:math:`|1\rangle` state).
Up to this point, nothing is different from a classical system of a bit.
To go beyond, we must explore what it means to make a superposition. The
operation in the quantum circuit language for generating a superposition
is the Hadamard gate, :math:`H`. Let's assume for now that this gate is
like flipping a fair coin. The result of a flip has two possible
outcomes, heads or tails, each occurring with equal probability. If we
repeat this simple thought experiment many times, we would expect that
on average we will measure as many heads as we do tails. Let heads be
:math:`|0\rangle` and tails be :math:`|1\rangle`.
Let's run the quantum version of this experiment. First we prepare the
qubit in the ground state :math:`|0\rangle`. We then apply the Hadamard
gate (coin flip). Finally, we measure the state of the qubit. Repeat the
experiment 1024 times (shots). As you likely predicted, half the
outcomes will be in the :math:`|0\rangle` state and half will be in the
:math:`|1\rangle` state.
Try the program below.
.. code:: python
# Quantum circuit superposition
qc_superposition = Q_program.create_circuit("superposition", ["qr"], ["cr"])
qc_superposition.h(qr)
qc_superposition.measure(qr[0], cr[0])
circuits = ["superposition"]
Q_program.execute(circuits, device, shots, max_credits=3, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("superposition"))
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_17_1.png
Indeed, much like a coin flip, the results are close to 50/50 with some
non-ideality due to errors (again due to state preparation, measurement,
and gate errors). So far, this is still not unexpected. Let's run the
experiment again, but this time with two :math:`H` gates in succession.
If we consider the :math:`H` gate to be analog to a coin flip, here we
would be flipping it twice, and still expecting a 50/50 distribution.
.. code:: python
# Quantum circuit two Hadamards
qc_twohadamard = Q_program.create_circuit("twohadamard", ["qr"], ["cr"])
qc_twohadamard.h(qr)
qc_twohadamard.barrier()
qc_twohadamard.h(qr)
qc_twohadamard.measure(qr[0], cr[0])
circuits = ["twohadamard"]
Q_program.execute(circuits, device, shots, max_credits=3, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("twohadamard"))
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_19_1.png
This time, the results are surprising. Unlike the classical case, with
high probability the outcome is not random, but in the :math:`|0\rangle`
state. *Quantum randomness* is not simply like a classical random coin
flip. In both of the above experiments, the system (without noise) is in
a definite state, but only in the first case does it behave randomly.
This is because, in the first case, via the :math:`H` gate, we make a
uniform superposition of the ground and excited state,
:math:`(|0\rangle+|1\rangle)/\sqrt{2}`, but then follow it with a
measurement in the computational basis. The act of measurement in the
computational basis forces the system to be in either the
:math:`|0\rangle` state or the :math:`|1\rangle` state with an equal
probability (due to the uniformity of the superposition). In the second
case, we can think of the second :math:`H` gate as being a part of the
final measurement operation; it changes the measurement basis from the
computational basis to a *superposition* basis. The following equations
illustrate the action of the :math:`H` gate on the computational basis
states:
.. math:: H: |0\rangle \rightarrow |+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt{2}}
.. math:: H: |1\rangle \rightarrow |-\rangle=\frac{|0\rangle-|1\rangle}{\sqrt{2}}.
We can redefine this new transformed basis, the superposition basis, as
the set
{:math:`|+\rangle`, :math:`|-\rangle`}.
We now have a different
way of looking at the second experiment above. The first :math:`H` gate
prepares the system into a superposition state, namely the
:math:`|+\rangle` state. The second :math:`H` gate followed by the
standard measurement changes it into a measurement in the superposition
basis. If the measurement gives 0, we can conclude that the system was
in the :math:`|+\rangle` state before the second :math:`H` gate, and if
we obtain 1, it means the system was in the :math:`|-\rangle` state. In
the above experiment we see that the outcome is mainly 0, suggesting
that our system was in the :math:`|+\rangle` superposition state before
the second :math:`H` gate.
The math is best understood if we represent the quantum superposition
state :math:`|+\rangle` and :math:`|-\rangle` by:
.. math:: |+\rangle =\frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix}
.. math:: |-\rangle =\frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix}
A standard measurement, known in quantum mechanics as a projective or
von Neumann measurement, takes any superposition state of the qubit and
projects it to either the state :math:`|0\rangle` or the state
:math:`|1\rangle` with a probability determined by:
.. math:: P(i|\psi) = |\langle i|\psi\rangle|^2
where :math:`P(i|\psi)` is the probability of measuring the system in
state :math:`i` given preparation :math:`\psi`.
We have written the Python function StateOverlap to return this:
.. code:: python
state_overlap = lambda state1, state2: np.absolute(np.dot(state1.conj().T,state2))**2
Now that we have a simple way of going from a state to the probability
distribution of a standard measurement, we can go back to the case of a
superposition made from the Hadamard gate. The Hadamard gate is defined
by the matrix:
.. math:: H =\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}
The :math:`H` gate acting on the state :math:`|0\rangle` gives:
.. code:: python
Hadamard = np.array([[1,1],[1,-1]],dtype=complex)/np.sqrt(2)
psi1 = np.dot(Hadamard,zero)
P0 = state_overlap(zero,psi1)
P1 = state_overlap(one,psi1)
plot_histogram({'0' : P0, '1' : P1})
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_23_0.png
which is the ideal version of the first experiment.
The second experiment involves applying the Hadamard gate twice. While
matrix multiplication shows that the product of two Hadamards is the
identity operator (meaning that the state :math:`|0\rangle` remains
unchanged), here (as previously mentioned) we prefer to interpret this
as doing a measurement in the superposition basis. Using the above
definitions, you can show that :math:`H` transforms the computational
basis to the superposition basis.
.. code:: python
print(np.dot(Hadamard,zero))
print(np.dot(Hadamard,one))
.. parsed-literal::
[[ 0.70710678+0.j]
[ 0.70710678+0.j]]
[[ 0.70710678+0.j]
[-0.70710678+0.j]]
.. _entanglement:
Entanglement
============
The core idea behind the second Principle is *entanglement*. Upon
reading the Principle, one might be inclined to think that entanglement
is simply strong correlation between two entitities -- but entanglement
goes well beyond mere perfect (classical) correlation. If you and I read
the same paper, we will have learned the same information. If a third
person comes along and reads the same paper they also will have learned
this information. All three persons in this case are perfectly
correlated, and they will remain correlated even if they are separated
from each other.
The situation with quantum entanglement is a bit more subtle. In the
quantum world, you and I could read the same quantum paper, and yet we
will not learn what information is actually contained in the paper until
we get together and share our information. However, when we are
together, we find that we can unlock more information from the paper
than we initially thought possible. Thus, quantum entanglement goes much
further than perfect correlation.
To demonstrate this, we will define the controlled-NOT (CNOT) gate and
the composition of two systems. The convention we use in the Quantum
Experience is to label states by writing the first qubit's name in the
rightmost position, thereby allowing us to easily convert from binary to
decimal. As a result, we define the tensor product between operators
:math:`q_0` and :math:`q_1` by :math:`q_1\otimes q_0`.
Taking :math:`q_0` as the control and :math:`q_1` as the target, the
CNOT with this representation is given by
.. math:: CNOT =\begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1\\0& 0& 1 & 0\\0 & 1 & 0 & 0 \end{pmatrix},
which is non-standard in the quantum community, but more easily connects
to classical computing, where the least significant bit (LSB) is
typically on the right. An entangled state of the two qubits can be made
via an :math:`H` gate on the control qubit, followed by the CNOT gate.
This generates a particular maximally entangled two-qubit state known as
a Bell state, named after John Stewart Bell (`learn more about Bell and
his contributions to quantum physics and
entanglement <https://en.wikipedia.org/wiki/John_Stewart_Bell>`__.
To explore this, we can prepare an entangled state of two qubits, and
then ask questions about the qubit states. The questions we can ask are:
\* What is the state of the first qubit in the standard basis? \* What
is the state of the first qubit in the superposition basis? \* What is
the state of the second qubit in the standard basis? \* What is the
state of the second qubit in the superposition basis? \* What is the
state of both qubits in the standard basis? \* what is the state of both
qubits in the superposition basis?
Below is a program with six such circuits for these six questions.
.. code:: python
# Creating registers
q2 = Q_program.create_quantum_registers("q2", 2)
c2 = Q_program.create_classical_registers("c2", 2)
# quantum circuit to make an entangled bell state
bell = Q_program.create_circuit("bell", ["q2"], ["c2"])
bell.h(q2[0])
bell.cx(q2[0], q2[1])
# quantum circuit to measure q0 in the standard basis
measureIZ = Q_program.create_circuit("measureIZ", ["q2"], ["c2"])
measureIZ.measure(q2[0], c2[0])
# quantum circuit to measure q0 in the superposition basis
measureIX = Q_program.create_circuit("measureIX", ["q2"], ["c2"])
measureIX.h(q2[0])
measureIX.measure(q2[0], c2[0])
# quantum circuit to measure q1 in the standard basis
measureZI = Q_program.create_circuit("measureZI", ["q2"], ["c2"])
measureZI.measure(q2[1], c2[1])
# quantum circuit to measure q1 in the superposition basis
measureXI = Q_program.create_circuit("measureXI", ["q2"], ["c2"])
measureXI.h(q2[1])
measureXI.measure(q2[1], c2[1])
# quantum circuit to measure q in the standard basis
measureZZ = Q_program.create_circuit("measureZZ", ["q2"], ["c2"])
measureZZ.measure(q2[0], c2[0])
measureZZ.measure(q2[1], c2[1])
# quantum circuit to measure q in the superposition basis
measureXX = Q_program.create_circuit("measureXX", ["q2"], ["c2"])
measureXX.h(q2[0])
measureXX.h(q2[1])
measureXX.measure(q2[0], c2[0])
measureXX.measure(q2[1], c2[1])
.. parsed-literal::
>> quantum_registers created: q2 2
>> classical_registers created: c2 2
.. parsed-literal::
<qiskit._measure.Measure at 0x11590f3c8>
.. code:: python
Q_program.add_circuit("bell_measureIZ", bell+measureIZ )
Q_program.add_circuit("bell_measureIX", bell+measureIX )
Q_program.add_circuit("bell_measureZI", bell+measureZI )
Q_program.add_circuit("bell_measureXI", bell+measureXI )
Q_program.add_circuit("bell_measureZZ", bell+measureZZ )
Q_program.add_circuit("bell_measureXX", bell+measureXX )
circuits = ["bell_measureIZ", "bell_measureIX", "bell_measureZI", "bell_measureXI", "bell_measureZZ", "bell_measureXX"]
Q_program.get_qasms(circuits)
.. parsed-literal::
['OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q2[2];\ncreg c2[2];\nh q2[0];\ncx q2[0],q2[1];\nmeasure q2[0] -> c2[0];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q2[2];\ncreg c2[2];\nh q2[0];\ncx q2[0],q2[1];\nh q2[0];\nmeasure q2[0] -> c2[0];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q2[2];\ncreg c2[2];\nh q2[0];\ncx q2[0],q2[1];\nmeasure q2[1] -> c2[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q2[2];\ncreg c2[2];\nh q2[0];\ncx q2[0],q2[1];\nh q2[1];\nmeasure q2[1] -> c2[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q2[2];\ncreg c2[2];\nh q2[0];\ncx q2[0],q2[1];\nmeasure q2[0] -> c2[0];\nmeasure q2[1] -> c2[1];\n',
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q2[2];\ncreg c2[2];\nh q2[0];\ncx q2[0],q2[1];\nh q2[0];\nh q2[1];\nmeasure q2[0] -> c2[0];\nmeasure q2[1] -> c2[1];\n']
Let's begin by running just the first two questions, looking at the
results of the first qubit (:math:`q_0`) using a computational and then
a superposition measurement.
.. code:: python
Q_program.execute(circuits[0:2], device, shots, max_credits=3, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("bell_measureIZ"))
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_31_1.png
We find that the result is random. Half the time :math:`q_0` is in
:math:`|0\rangle`, and the other half it is in the :math:`|1\rangle`
state. You may wonder whether this is like the superposition from
earlier in the tutorial. Maybe the qubit has a perfectly definite state,
and we are simply measuring in another basis. What would you expect if
you did the experiment and measured in the superposition basis? Recall
we do this by adding an :math:`H` gate before the measurement...which is
exactly what we have checked with the second question.
.. code:: python
plot_histogram(Q_program.get_counts("bell_measureIX"))
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_33_0.png
In this case, we see that the result is still random, regardless of
whether we measure in the computational or the superposition basis. This
tells us that we actually know nothing about the first qubit. What about
the second qubit, :math:`q_1`? The next lines will run experiments
measuring the second qubit in both the computational and superposition
bases.
.. code:: python
Q_program.execute(circuits[2:4], device, shots, max_credits=3, wait=10, timeout=240)
plot_histogram(Q_program.get_counts("bell_measureZI"))
plot_histogram(Q_program.get_counts("bell_measureXI"))
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_35_1.png
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_35_2.png
Once again, all the experiments give random outcomes. It seems we know
nothing about either qubit in our system! In our previous analogy, this
is equivalent to two readers separately reading a quantum paper and
extracting no information whatsoever from it on their own.
What do you expect, however, when the readers get together? Below we
will measure both in the joint computational basis.
.. code:: python
Q_program.execute(circuits[4:6], device, shots, max_credits=3, wait=10, timeout=240)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
.. code:: python
plot_histogram(Q_program.get_counts("bell_measureZZ"))
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_38_0.png
Here we see that with high probability, if :math:`q_0` is in state 0,
:math:`q_1` will be in 0 as well; the same goes if :math:`q_0` is in
state 1. They are perfectly correlated.
What about if we measure both in the superposition basis?
.. code:: python
plot_histogram(Q_program.get_counts("bell_measureXX"))
.. image:: superposition_and_entanglement_files/superposition_and_entanglement_40_0.png
Here we see that the system **also** has perfect correlations
(accounting for experimental noise). Therefore, if :math:`q_0` is
measured in state :math:`|0\rangle`, we know :math:`q_1` is in this
state as well; likewise, if :math:`q_0` is measured in state
:math:`|+\rangle`, we know :math:`q_1` is also in this state. These
correlations have led to much confusion in science, because any attempt
to relate the unusual behavior of quantum entanglement to our everyday
experiences is a fruitless endeavor.
This is just a taste of what happens in the quantum world. Please
continue to :doc:`Entanglement revisited <entanglement_revisited>` to
explore further!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -1,443 +0,0 @@
============================
Quantum State Tomography
============================
Contributors
============
Christopher J. Wood `(cjwood@us.ibm.com) <mailto:cjwood@us.ibm.com>`__
Introduction
============
In this notebook we demonstrate how to design and run experiments to
perform quantum state tomography using QISKit, and demonstrate this
using both simulators, and the IBM Quantum Experience. After going
through this notebook you may also look at additional examples of
tomgoraphy of GHZ and 5-qubit Cat-states in the
:doc:`cat-state-tomography <cat-state-tomography>` workbook.
We implement quantum state tomography using simple maximum likelihood
constrained least-squares fitting of a tomographically complete set of
measurement data. For details of this method see `J Smolin, JM Gambetta,
G Smith, Phys. Rev. Lett. 108,
070502 <https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.108.070502>`__
`(open access: arXiv: 1106.5458) <https://arxiv.org/abs/1106.5458>`__.
Getting Started
===============
Please see :doc:`Getting Started with QISKit <tutorial4developer>` if
you would like to understand how to get started with the QISKit SDK.
.. code:: python
# Checking the version of PYTHON; we only support 3 at the moment
import sys
if sys.version_info < (3,0):
raise Exception("Please use Python version 3 or greater.")
# useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import sys
sys.path.append("../../")
# importing the QISKit
from qiskit import QuantumProgram
import Qconfig
# import state tomography functions
from statetomo import *
# function using QuTip to visualize density matrices
import qutip as qt
def plot_state(rho, fidelity=None):
# plot real part of rho
fig1, ax = qt.matrix_histogram(rho.real, limits=[-1,1])
ax.view_init(azim=-55, elev=45)
# Set fidelity as plot label
if fidelity != None:
# Fidelity to 4 decimal places
ax.set_title("F = %.4f" %fidelity)
# Plot imaginary part
fig2, ax = qt.matrix_histogram(rho.imag, limits=[-1,1])
ax.view_init(azim=-55, elev=45)
# display plot
plt.show()
Designing tomography experiments in QISKit
==========================================
We now demonstrate how to use the QISKit developer toolkit to design
tomography experiments. As an example we will prepare and measure a
2-qubit entangled Bell-state
:math:`\frac{1}{\sqrt2}\left(|00\rangle+|11\rangle\right)`.
Initializing a quantum program
------------------------------
We state by defining a ``QuantumProgram`` and adding a quantum and
classical register. The quantum register is the state of our quantum
system, and the classical register records outcomes of measurements of
the quantum state.
.. code:: python
# Initialize a new quantum program
QP = QuantumProgram()
# Add a 2-qubit quantum register "qr"
qr = QP.create_quantum_registers("qr", 2)
# Add a 2-bit register "cr" to record results
cr = QP.create_classical_registers("cr", 2)
.. parsed-literal::
>> quantum_registers created: qr 2
>> classical_registers created: cr 2
Setting up initial state preparation
------------------------------------
Next we define a *state preparation circuit* to prepare our system in a
desired quantum state. For our example we will apply a Hadamard gate to
prepare the first qubit in a :math:`|+\rangle` state, followed by a CNOT
gate to entangle the two qubits:
.. code:: python
# Create a circuit named 'prep'
prep = QP.create_circuit("prep", ["qr"], ["cr"])
# Add H gate of first qubit to 'prep' circuit
prep.h(qr[0])
# Add CNOT gate between qubits to 'prep' circuit
prep.cx(qr[0], qr[1])
.. parsed-literal::
<qiskit.extensions.standard.cx.CnotGate at 0x10339e0f0>
Building tomography measurement circuits
----------------------------------------
Next we must construct a family of circuits which implement a
tomographically complete set of measurements of the qubit. The
``statetomo.py`` example library contains functions to generate these
measurement circuits for general n-qubit systems. We do this by
measuring in the X, Y, and Z for each qubit. This results in :math:`3^n`
measurement circuits which must be executed to gather count statistics
for the tomographic reconstruction.
The function to build the circuits is:
::
build_tomo_circuits(QP, 'prep', 'qr', 'cr', qubits)
The function to construct an array of the the corresponding labels for
these circuits is:
::
build_tomo_keys('prep', qubits)
| where - ``QP`` is the quantum program. - ``'prep'`` is the name of the
preparation circuit
| - ``'qr'`` is the name of the quantum registers to be measured -
``'cr'`` is the name of the classical registers to store outcomes -
``qubits`` is a list of the qubits to be measured. Eg ``[i,j]`` for
``qr[i]``, and ``qr[j]``.
.. code:: python
# Qubits being measured
meas_qubits = [0,1]
# Construct the state tomography measurement circuits in QP
build_tomo_circuits(QP, "prep", "qr", "cr", meas_qubits)
# construct list of tomo circuit labels
circuits = build_tomo_keys("prep", meas_qubits)
print(circuits)
::
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-744cf6cbfc8d> in <module>()
2 meas_qubits = [0,1]
3 # Construct the state tomography measurement circuits in QP
----> 4 build_tomo_circuits(QP, "prep", "qr", "cr", meas_qubits)
5 # construct list of tomo circuit labels
6 circuits = build_tomo_keys("prep", meas_qubits)
/Users/cjwood/Documents/IBM-Git/qiskit-sdk-py-dev/tutorial/sections/statetomo.py in build_tomo_circuits(Q_program, circuit, qreg, creg, qubit_list)
166 circ = [circuit]
167 for j in sorted(qubit_list, reverse=True):
--> 168 build_tomo_circuit_helper(Q_program, circ, qreg, creg, j)
169 circ = build_keys_helper(circ, j)
170
/Users/cjwood/Documents/IBM-Git/qiskit-sdk-py-dev/tutorial/sections/statetomo.py in build_tomo_circuit_helper(Q_program, circuits, qreg, creg, qubit)
150 meas = b+str(qubit)
151 tmp = Q_program.create_circuit(meas, [qreg],[creg])
--> 152 qr = Q_program.get_quantum_registers(qreg)
153 cr = Q_program.get_classical_registers(creg)
154 if b == "X":
AttributeError: 'QuantumProgram' object has no attribute 'get_quantum_registers'
Testing experiments on a simulator
==================================
Now that we have prepared the required circuits for state preparation
and measurement, we should test them on a simulator before trying to run
them on the real device.
We specify the device, and a number of experiment shots to perform to
gather measurement statistics. The larger the number of shots, the more
accurate our measurmeent probabilities will be compared to the *true*
value.
.. code:: python
# Use the local simulator
device = 'local_qasm_simulator'
# Take 1000 shots for each measurement basis
shots = 1000
# Run the simulation
result = QP.execute(circuits, device, shots)
print(result)
.. parsed-literal::
running on backend: local_qasm_simulator
{'status': 'COMPLETED', 'result': 'all done'}
Before doing the tomographic reconstruction we can view the count
statistics from the simulation:
.. code:: python
for c in circuits:
print('Circuit:', c)
print('Counts:', QP.get_counts(c))
.. parsed-literal::
Circuit: prepX1X0
Counts: {'00': 533, '11': 467}
Circuit: prepX1Y0
Counts: {'10': 256, '00': 252, '11': 238, '01': 254}
Circuit: prepX1Z0
Counts: {'01': 253, '10': 280, '11': 232, '00': 235}
Circuit: prepY1X0
Counts: {'11': 249, '10': 242, '01': 244, '00': 265}
Circuit: prepY1Y0
Counts: {'10': 495, '01': 505}
Circuit: prepY1Z0
Counts: {'10': 260, '01': 242, '11': 257, '00': 241}
Circuit: prepZ1X0
Counts: {'00': 266, '10': 244, '01': 234, '11': 256}
Circuit: prepZ1Y0
Counts: {'10': 237, '01': 282, '11': 269, '00': 212}
Circuit: prepZ1Z0
Counts: {'11': 478, '00': 522}
Reconstructing state from count data
------------------------------------
To reconstruct the maximum likelihod estimate of the measured quantum
state we use the following function:
::
state_tomography(QP, circuits, shots, total_qubits, meas_qubits)
where - ``QP`` is the quantum program containing the measurement results
- ``circuits`` is the array of tomographic measurement circuits measured
- ``shots`` is the total number of shots for each measurement circuit -
``total_qubits`` is the total number of qubits in the system (the length
of shot outcome bitstrings) - ``meas_qubits`` is an array of the
measurement qubit indices
.. code:: python
total_qubits = 2
rho_fit = state_tomography(QP, circuits, shots, total_qubits, meas_qubits)
print('rho =', rho_fit)
.. parsed-literal::
rho = [[ 5.05919257e-01+0.j 1.97270901e-02+0.00971077j
-6.76802859e-03+0.0017145j 4.95913187e-01-0.00164784j]
[ 1.97270901e-02-0.00971077j 3.48839871e-03+0.j
9.24584857e-05-0.00230115j 1.99663499e-02-0.00802739j]
[ -6.76802859e-03-0.0017145j 9.24584857e-05+0.00230115j
2.88747465e-03+0.j -7.72694247e-03-0.00085422j]
[ 4.95913187e-01+0.00164784j 1.99663499e-02+0.00802739j
-7.72694247e-03+0.00085422j 4.87704870e-01+0.j ]]
We can compare the reconstructed state to the target state vector. We
use the Fidelity function, which for a comparing a density matrix
:math:`\rho` to a pure state :math:`|\psi\rangle` is given by
:math:`F = \sqrt{\langle \psi| \rho |\psi\rangle}`. This may be done by
the function ``fidelity(rho, psi)``. Finally we may wish to visualize
the reconstructed state. This can be done by using various plotting
libraries. One conveient one is the following which uses the `QuTiP
(Quantum Toolbox in Python) <http://qutip.org/>`__ library.
.. code:: python
# target state is (|00>+|11>)/sqrt(2)
target = np.array([1., 0., 0., 1.]/np.sqrt(2.))
# calculate fidelity
F_fit = fidelity(rho_fit, target)
# visualize the state
plot_state(rho_fit, F_fit)
.. image:: tomography_files/tomography_19_0.png
.. image:: tomography_files/tomography_19_1.png
Note that since our simulator is *perfect* the output state should be
*exactly* the Bell-state, so we should obtain F = 1. Why is it not in
our case? Since we can never directly *see* the final state we must
obtain information about it via measurements. We would only obtain the
*true* probabilities for the state in the limit of infinite measurement
shots. Hence we have statistical error in our reconstruction due to
having imperfect information about the state itself. Try running with
different number of shots on the simulator and see how it effects the
fidelity of the reconstruction.
Running on a real device
========================
Now that we've checked our simple tomography experiment worked, lets try
it out on the IBM Quantum Experience! To do this we must have attached
our API key, and it is good practice to set a limit on the number of
credits to use:
.. code:: python
# Use the IBM Quantum Experience
device = 'ibmqx2'
# Take 1000 shots for each measurement basis
# Note: reduce this number for larger number of qubits
shots = 1000
# set max credits
max_credits = 5
# set API token and url
QP.set_api(Qconfig.APItoken, Qconfig.config["url"])
# Run the simulation
result = QP.execute(circuits, device, shots, max_credits, wait=20, timeout=240)
print(result)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (20 seconds)
status = RUNNING (40 seconds)
{'status': 'COMPLETED', 'result': 'all done'}
As before we can check our results, and check our tomographically
reconstructed state.
.. code:: python
# print measurement results
for c in circuits:
print('Circuit:', c)
print('Counts:', QP.get_counts(c))
.. parsed-literal::
Circuit: prepX1X0
Counts: {'00000': 569, '00001': 24, '00010': 19, '00011': 388}
Circuit: prepX1Y0
Counts: {'00000': 337, '00001': 281, '00010': 212, '00011': 170}
Circuit: prepX1Z0
Counts: {'00000': 312, '00001': 253, '00010': 230, '00011': 205}
Circuit: prepY1X0
Counts: {'00000': 283, '00001': 221, '00010': 281, '00011': 215}
Circuit: prepY1Y0
Counts: {'00000': 64, '00001': 444, '00010': 485, '00011': 7}
Circuit: prepY1Z0
Counts: {'00000': 283, '00001': 245, '00010': 252, '00011': 220}
Circuit: prepZ1X0
Counts: {'00000': 291, '00001': 240, '00010': 274, '00011': 195}
Circuit: prepZ1Y0
Counts: {'00000': 286, '00001': 223, '00010': 260, '00011': 231}
Circuit: prepZ1Z0
Counts: {'00000': 468, '00001': 36, '00010': 31, '00011': 465}
Notice that for measurement results the bitstrings are now actually
those for 5 qubits, even though we only measured one. This is because
the QX is a 5-qubit quantum processor. To reconstruct the single qubit
state from these results we use ``total_qubits=5``. Note also that the
qubit ordering in this bitstrings is ``q[4]q[3]q[2]q[1]q[0]``
.. code:: python
rho_fit_real = state_tomography(QP, circuits, shots, 5, meas_qubits)
F_fit_real = fidelity(rho_fit_real, target)
plot_state(rho_fit_real, F_fit_real)
.. image:: tomography_files/tomography_25_0.png
.. image:: tomography_files/tomography_25_1.png
The fidelity of our reconstructed state if 94%, not bad!
Further examples
================
To see further examples of performing tomography on up to 5-qubit
entangled state see the
:doc:`cat-state-tomography <cat-state-tomography>` workbook.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,526 +0,0 @@
###############################
Getting Started with QISKit SDK
###############################
For more information about how to use the IBM Q experience (QX), consult
the
`tutorials <https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=c59b3710b928891a1420190148a72cce&pageIndex=0>`__,
or check out the
`community <https://quantumexperience.ng.bluemix.net/qstage/#/community>`__.
Contributors
============
Ismael Faro, Jay Gambetta, Andrew Cross
QISKit SDK Tutorial
===================
This tutorial aims to explain how to use the QISKit SDK from a
developer's point of view. We review the steps it takes to install and
start to use the SDK tools.
QISKit is a Python software development kit (SDK) that you can use to
create your quantum computing programs based on circuits defined through
the `OpenQASM 2.0
specification <https://github.com/IBM/qiskit-openqasm>`__, compile them,
and execute them on several backends (Real Quantum Processors online,
Simulators online, and Simulators on local). For the online backends,
QISKit uses our `python API
connector <https://github.com/IBM/qiskit-api-py>`__ to the `IBM Q
experience project <http://quantumexperience.ng.bluemix.net/>`__.
In addition to this tutorial, we have other tutorials that introduce you
to more complex concepts directly related to quantum computing.
More examples: - Familiarize yourself with the important concepts of
:doc:`superposition and entanglement <superposition_and_entanglement>`. - Go beyond and
explore a bit more in-depth in :doc:`entanglement revisited <entanglement_revisited>`.
Install QISKit
==============
The easiest way to install QISKit is with the Anaconda Python
distribution.
- Install Anaconda: https://www.continuum.io/downloads
Next, install QISKit from the git repository
- Clone the repo:
.. code:: sh
git clone https://github.ibm.com/IBMQuantum/qiskit-sdk-py-dev
cd qiskit-sdk-py-dev
- Create the environment with the dependencies:
.. code:: sh
make env
Use QISKit Python SDK
=====================
You can try out the examples easily with Jupyter or Python.
Add your personal API token to the file "Qconfig.py" (get it from your
`IBM Q experience <https://quantumexperience.ng.bluemix.net>`__ >
Account):
.. code:: sh
cp tutorial/Qconfig.py.default Qconfig.py
Run Jupyter notebook.
.. code:: sh
make run
Basic Concept
-------------
The basic concept of our quantum program is an array of quantum
circuits. The program workflow consists of three stages: :ref:`Build
<building_your_program>`, :ref:`Compile <compile_and_run>`, and
:ref:`Run <execute_on_real_device>`. Build allows you to make
different quantum circuits that represent the problem you are solving;
Compile allows you to rewrite them to run on different backends
(simulators/real chips of different `quantum volumes
<http://ibm.biz/qiskit-quantum-volume>`__, sizes, fidelity, etc); and
Run launches the jobs.  After the jobs have been run, the data is
collected. There are methods for putting this data together, depending
on the program. This either gives you the answer you wanted or allows
you to make a better program for the next instance.
.. _building_your_program:
Building your program: Create it
--------------------------------
First you need to import the QuantumProgram package from QISKit.
.. code:: python
import sys
sys.path.append("../../") # solve the relative dependencies if you clone QISKit from the Git repo and use like a global.
from qiskit import QuantumProgram
import Qconfig
The basic elements needed for your first program are the QuantumProgram,
a Circuit, a Quantum Register, and a Classical Register.
.. code:: python
# Creating Programs
# create your first QuantumProgram object instance.
Q_program = QuantumProgram()
# Creating Registers
# create your first Quantum Register called "qr" with 2 qubits
qr = Q_program.create_quantum_registers("qr", 2)
# create your first Classical Register called "cr" with 2 bits
cr = Q_program.create_classical_registers("cr", 2)
# Creating Circuits
# create your first Quantum Circuit called "qc" involving your Quantum Register "qr"
# and your Classical Register "cr"
qc = Q_program.create_circuit("qc", ["qr"], ["cr"])
.. parsed-literal::
>> quantum_registers created: qr 2
>> classical_registers created: cr 2
Another option for creating your QuantumProgram instance is to define a
dictionary with all the necessary components of your program.
.. code:: python
Q_SPECS = {
"circuits": [{
"name": "Circuit",
"quantum_registers": [{
"name": "qr",
"size": 4
}],
"classical_registers": [{
"name": "cr",
"size": 4
}]}],
}
The required element for a Program is a "circuits" array. Within
"circuits", the required field is "name"; it can have several Quantum
Registers and Classical Registers. Every register must have a name and
the number of each element (qubits or bits).
After that, you can use this dictionary definition as the specs of one
QuantumProgram object to initialize it.
.. code:: python
Q_program = QuantumProgram(specs=Q_SPECS)
.. parsed-literal::
>> quantum_registers created: qr 4
>> classical_registers created: cr 4
You can also get every component from your new Q\_program to use.
.. code:: python
# Get the components.
# get the circuit by Name
circuit = Q_program.get_circuit("Circuit")
# get the Quantum Register by Name
quantum_r = Q_program.get_quantum_registers("qr")
# get the Classical Register by Name
classical_r = Q_program.get_classical_registers('cr')
Building your program: Add Gates to your Circuit
------------------------------------------------
After you create the circuit with its registers, you can add gates to
manipulate the registers. Below is a list of the gates you can use in
the QX.
You can find extensive information about these gates and how use them in
our `Quantum Experience User
Guide <https://quantumexperience.ng.bluemix.net/qstage/#/tutorial?sectionId=71972f437b08e12d1f465a8857f4514c&pageIndex=2>`__.
.. code:: python
# H (Hadamard) gate to the qubit 0 in the Quantum Register "qr"
circuit.h(quantum_r[0])
# Pauli X gate to the qubit 1 in the Quantum Register "qr"
circuit.x(quantum_r[1])
# Pauli Y gate to the qubit 2 in the Quantum Register "qr"
circuit.y(quantum_r[2])
# Pauli Z gate to the qubit 3 in the Quantum Register "qr"
circuit.z(quantum_r[3])
# CNOT (Controlled-NOT) gate from qubit 0 to the Qbit 2
circuit.cx(quantum_r[0], quantum_r[2])
# add a barrier to your circuit
circuit.barrier()
# first physical gate: u1(lambda) to qubit 0
circuit.u1(0.3, quantum_r[0])
# second physical gate: u2(phi,lambda) to qubit 1
circuit.u2(0.3, 0.2, quantum_r[1])
# second physical gate: u3(theta,phi,lambda) to qubit 2
circuit.u3(0.3, 0.2, 0.1, quantum_r[2])
# S Phase gate to qubit 0
circuit.s(quantum_r[0])
# T Phase gate to qubit 1
circuit.t(quantum_r[1])
# identity gate to qubit 1
circuit.iden(quantum_r[1])
# Note: "if" is not implemented in the local simulator right now,
# so we comment it out here. You can uncomment it and
# run in the online simulator if you'd like.
# Classical if, from qubit2 gate Z to classical bit 1
# circuit.z(quantum_r[2]).c_if(classical_r, 0)
# measure gate from the qubit 0 to classical bit 0
circuit.measure(quantum_r[0], classical_r[0])
.. parsed-literal::
<qiskit._measure.Measure at 0x112c72518>
Extract QASM
------------
You can obtain a QASM representation of your code.
.. code:: python
# QASM from a program
QASM_source = Q_program.get_qasm("Circuit")
print(QASM_source)
.. parsed-literal::
OPENQASM 2.0;
include "qelib1.inc";
qreg qr[4];
creg cr[4];
h qr[0];
x qr[1];
y qr[2];
z qr[3];
cx qr[0],qr[2];
barrier qr[0],qr[1],qr[2],qr[3];
u1(0.300000000000000) qr[0];
u2(0.300000000000000,0.200000000000000) qr[1];
u3(0.300000000000000,0.200000000000000,0.100000000000000) qr[2];
s qr[0];
t qr[1];
id qr[1];
measure qr[0] -> cr[0];
.. _compile_and_run:
Compile and Run or Execute
--------------------------
.. code:: python
device = 'ibmqx_qasm_simulator' # Backend to execute your program, in this case it is the online simulator
circuits = ["Circuit"] # Group of circuits to execute
Q_program.set_api(Qconfig.APItoken, Qconfig.config["url"]) # set the APIToken and API url
.. parsed-literal::
True
.. code:: python
Q_program.compile(circuits, device) # Compile your program
# Run your program in the device and check the execution result every 2 seconds
result = Q_program.run(wait=2, timeout=240)
print(result)
.. parsed-literal::
running on backend: ibmqx_qasm_simulator
{'status': 'COMPLETED', 'result': 'all done'}
When you run a program, the possible results will be:
::
JOB_STATUS = {
inProgress: 'RUNNING',
errorOnCreate: 'ERROR_CREATING_JOB',
errorExecuting: 'ERROR_RUNNING_JOB',
completed: 'COMPLETED'
};
The *run()* command waits until the job either times out, returns an
error message, or completes successfully.
.. code:: python
Q_program.get_counts("Circuit")
.. parsed-literal::
{'0000': 529, '0001': 495}
In addition to getting the number of times each output was seen, you can
get the compiled QASM. For this simulation, the compiled circuit is not
much different from the input circuit. Each single-qubit gate has been
expressed as a u1, u2, or u3 gate.
.. code:: python
compiled_qasm = Q_program.get_compiled_qasm("Circuit")
print(compiled_qasm)
.. parsed-literal::
OPENQASM 2.0;
include "qelib1.inc";
qreg qr[4];
creg cr[4];
u1(3.141592653589793) qr[3];
u3(3.141592653589793,1.5707963267948966,1.5707963267948966) qr[2];
u3(3.141592653589793,0.0,3.141592653589793) qr[1];
u2(0.0,3.141592653589793) qr[0];
cx qr[0],qr[2];
barrier qr[0],qr[1],qr[2],qr[3];
u1(0.3) qr[0];
u1(1.5707963267948966) qr[0];
measure qr[0] -> cr[0];
u2(0.3,0.2) qr[1];
u1(0.7853981633974483) qr[1];
id qr[1];
u3(0.3,0.2,0.1) qr[2];
You can use *execute()* to combine the compile and run in a single step.
.. code:: python
Q_program.execute(circuits, device, wait=2, timeout=240)
.. parsed-literal::
running on backend: ibmqx_qasm_simulator
.. parsed-literal::
{'result': 'all done', 'status': 'COMPLETED'}
Compile Parameters
^^^^^^^^^^^^^^^^^^
Q\_program.compile(circuits, device="simulator", shots=1024,
max\_credits=3, basis\_gates=None, coupling\_map=None, seed=None)
* ``circuits`` array of circuits to compile
* ``device`` specifies the backend which is one of,
- ``simulator`` online default simulator links to ibmqx\_qasm\_simulator
- ``real`` online default real chip links to ibmqx2
- ``ibmqx_qasm_simulator`` qasm simulator
- ``ibmqx2`` online real chip with 5 qubits
- ``ibmqx3`` online real chip with 16 qubits
- ``local_unitary_simulator`` local unitary simulator
- ``local_qasm_simulator`` local simulator
* ``shots`` number of shots, only for real chips and qasm simulators
* ``max_credits`` Maximum number of the credits to spend in the executions. If the executions cost
more than your available credits, the job is aborted
* ``basis_gates``: the base gates by default are: u1, u2, u3, cx, id
* ``coupling_map``: object that represents the physical/topological layout of a chip.
* ``seed`` for the qasm simulator if you want to set the initial seed.
Run Parameters
^^^^^^^^^^^^^^
Q\_program.run(wait=5, timeout=60)
* ``wait`` time to wait before checking if the execution is COMPLETED.
* ``timeout`` timeout of the execution.
Execute Parameters
^^^^^^^^^^^^^^^^^^
*Execute has the combined parameters of compile and run.*
Q\_program.execute(circuits, device, shots=1024, max\_credits=3,
basis\_gates=None, wait=5, timeout=60, basis\_gates=None,
coupling\_map=None,)
.. _execute_on_real_device:
Execute on a Real Device
------------------------
.. code:: python
device = 'ibmqx2' # Backend where you execute your program; in this case, on the Real Quantum Chip online
circuits = ["Circuit"] # Group of circuits to execute
shots = 1024 # Number of shots to run the program (experiment); maximum is 8192 shots.
max_credits = 3 # Maximum number of credits to spend on executions.
result = Q_program.execute(circuits, device, shots, max_credits=3, wait=10, timeout=240)
.. parsed-literal::
running on backend: ibmqx2
status = RUNNING (10 seconds)
status = RUNNING (20 seconds)
Result
^^^^^^
You can access the result via the function
*get\_counts("circuit\_name")*. By default, the last device is used, but
you can be more specific by using *get\_counts("circuit\_name",
device="device\_name")*.
.. code:: python
Q_program.get_counts("Circuit")
.. parsed-literal::
{'00000': 516, '00001': 508}
Execute on a local simulator
----------------------------
.. code:: python
Q_program.compile(circuits, "local_qasm_simulator") # Compile your program
# Run your program in the device and check the execution result every 2 seconds
result = Q_program.run(wait=2, timeout=240)
Q_program.get_counts("Circuit")
.. parsed-literal::
running on backend: local_qasm_simulator
.. parsed-literal::
{'0000': 511, '0001': 513}

View File

@ -1,10 +0,0 @@
ZZ
0.011279956224107712
II
-1.0523760606256514
ZI
0.39793570529466216
IZ
0.39793570529466227
XX
0.18093133934472627

View File

@ -1,10 +0,0 @@
II
-0.63444908367400488
ZI
0.93039460801675888
IZ
0.93039460801675911
ZZ
0.013526988052545402
XX
0.15797133539098221

View File

@ -1,10 +0,0 @@
II
-1.0526705559236769
ZI
0.20019027140892859
IZ
0.20019027140892867
ZZ
0.006963127832254612
XX
0.20979164336117823

View File

@ -1,10 +0,0 @@
II
-1.0399157708520572
ZI
-0.17310902665470002
IZ
-0.17310902665470002
ZZ
0.0059630046462814668
XX
0.21641761379277691

View File

@ -1,10 +0,0 @@
II
-1.0253589912520973
ZI
0.14956828171611936
IZ
0.14956828171611924
ZZ
0.0050307009830743155
XX
0.22302208221006781

View File

@ -1,10 +0,0 @@
II
-1.0096438533439631
ZI
0.12910132587794909
IZ
0.12910132587794898
ZZ
0.0041884054836630602
XX
0.22953587766748473

View File

@ -1,10 +0,0 @@
II
-0.99329888855095949
ZI
0.11130900085876314
IZ
0.11130900085876311
ZZ
0.0034480791742557138
XX
0.23590135756835237

View File

@ -1,10 +0,0 @@
II
-0.97673754121163714
ZI
0.0958445077110293
IZ
0.09584450771102912
ZZ
0.0028075358894698588
XX
0.24207289860816317

View File

@ -1,10 +0,0 @@
II
-0.96028037695211821
ZI
0.082409875704290592
IZ
0.082409875704290647
ZZ
0.00226469518310915
XX
0.24801715568418908

View File

@ -1,10 +0,0 @@
II
-0.94416429519529532
ZI
-0.070745812247514167
IZ
-0.070745812247513917
ZZ
0.0018086261883964172
XX
0.25371023338888415

View File

@ -1,10 +0,0 @@
II
-0.92855622812007999
ZI
0.060627278815774371
IZ
0.060627278815774455
ZZ
0.0014306027093105578
XX
0.25913855677496928

View File

@ -1,10 +0,0 @@
II
-0.91356793017320581
ZI
0.051860405681753784
IZ
0.051860405681753555
ZZ
0.0011211091024976305
XX
0.26429356984596153

View File

@ -1,10 +0,0 @@
II
-0.75369816321016647
ZI
0.80869539252831746
IZ
0.80869539252831713
ZZ
0.013335957448084163
XX
0.16081913496899852

View File

@ -1,10 +0,0 @@
II
-0.89926678358045664
ZI
0.04426960867862928
IZ
0.044269608678628974
ZZ
0.00086875625704091464
XX
0.26917399037233819

View File

@ -1,10 +0,0 @@
II
-0.88568855350119358
ZI
0.037704116778690441
IZ
0.037704116778690219
ZZ
0.00066572919094462502
XX
0.27378229302959728

View File

@ -1,10 +0,0 @@
II
-0.8728425776341735
ZI
0.032031034230833422
IZ
0.032031034230833463
ZZ
0.00050473600488434855
XX
0.27812424290623572

View File

@ -1,10 +0,0 @@
II
-0.86072160433622635
ZI
0.027134243458475878
IZ
0.027134243458476148
ZZ
0.00037744302072370561
XX
0.28221001603069706

View File

@ -1,10 +0,0 @@
II
-0.84930627058408348
ZI
0.022915060526454471
IZ
0.022915060526454575
ZZ
0.00027922550406937752
XX
0.28605015479247536

View File

@ -1,10 +0,0 @@
II
-0.83856589736311293
ZI
-0.019284805366273042
IZ
-0.019284805366273097
ZZ
0.00020410556745388553
XX
0.28965647949032908

View File

@ -1,10 +0,0 @@
II
-0.82846736706522262
ZI
0.016169986158359448
IZ
0.016169986158359545
ZZ
0.00014697602504364082
XX
0.29304330955876917

View File

@ -1,10 +0,0 @@
II
-0.8189736688603495
ZI
0.013505530227536519
IZ
0.013505530227536366
ZZ
0.00010420235495178787
XX
0.29622352981967115

View File

@ -1,10 +0,0 @@
II
-0.81004364017976838
ZI
0.011235404219805664
IZ
0.011235404219806164
ZZ
7.3617879044654555e-05
XX
0.29921179825612171

View File

@ -1,10 +0,0 @@
II
-0.80164235500056935
ZI
0.0093091158747921898
IZ
0.0093091158747922315
ZZ
5.1260273735170836e-05
XX
0.30202072620467607

View File

@ -1,10 +0,0 @@
II
-0.86255555442966614
ZI
0.68884421476604474
IZ
0.68884421476604529
ZZ
0.012939824667879019
XX
0.16451415502766348

View File

@ -1,10 +0,0 @@
II
-0.7937327867754288
ZI
0.0076801030443120755
IZ
0.0076801030443118257
ZZ
3.4820082292705279e-05
XX
0.30466387558149721

View File

@ -1,10 +0,0 @@
II
-0.78627811357200206
ZI
-0.0063112535739077713
IZ
-0.0063112535739077436
ZZ
2.3776105216685717e-05
XX
0.30715370895162086

View File

@ -1,10 +0,0 @@
II
-0.77924328504411911
ZI
0.005166173843327973
IZ
0.0051661738433280702
ZZ
1.5986550513130693e-05
XX
0.3095012359373755

View File

@ -1,10 +0,0 @@
II
-0.7725998923231493
ZI
0.0042117216124792772
IZ
0.0042117216124794021
ZZ
1.0251686055257059e-05
XX
0.31171775178391858

View File

@ -1,10 +0,0 @@
II
-0.76632003182029862
ZI
0.0034198790623681391
IZ
0.0034198790623682362
ZZ
6.7505803121176156e-06
XX
0.31381357147784428

View File

@ -1,10 +0,0 @@
II
-0.76037182858767305
ZI
0.0027680062734257577
IZ
0.0027680062734258687
ZZ
4.1973777251680389e-06
XX
0.31579690307916536

View File

@ -1,10 +0,0 @@
II
-0.75473345175604556
ZI
0.0022304734583572794
IZ
0.0022304734583571822
ZZ
3.0129361196229443e-06
XX
0.31767721792714781

View File

@ -1,10 +0,0 @@
II
-0.74938182586787261
ZI
0.0017925745111192354
IZ
0.0017925745111193464
ZZ
1.4704462543424501e-06
XX
0.31946166068949688

View File

@ -1,10 +0,0 @@
II
-0.74429692505207301
ZI
0.0014336017482368263
IZ
0.0014336017482368679
ZZ
7.2141802516523246e-07
XX
0.32115700615278464

View File

@ -1,10 +0,0 @@
II
-0.94770459608367519
ZI
0.58308174372535082
IZ
0.58308174372535082
ZZ
0.012517946865163054
XX
0.16887019746635745

View File

@ -1,10 +0,0 @@
II
-1.0071247114292199
ZI
0.49401763712332147
IZ
0.49401763712332125
ZZ
0.012069257058235333
XX
0.17373018777655092

View File

@ -1,10 +0,0 @@
II
-1.0439137050560034
ZI
0.42045411460602022
IZ
0.42045411460602017
ZZ
0.011506018027931303
XX
0.17900008076954921

View File

@ -1,10 +0,0 @@
II
-1.0632129583259569
ZI
-0.35995882041428146
IZ
-0.35995882041428157
ZZ
0.01080970752866689
XX
0.18462735929236296

View File

@ -1,10 +0,0 @@
II
-1.0702821121186525
ZI
0.30978862893702735
IZ
0.30978862893702758
ZZ
0.0099707920334989042
XX
0.19057124394815306

View File

@ -1,10 +0,0 @@
II
-1.0692425120891662
ZI
0.26752894034608155
IZ
0.2675289403460821
ZZ
0.0090152041695621687
XX
0.19679094828429972

View File

@ -1,10 +0,0 @@
II
-1.0628131426642062
ZI
0.23139519597162184
IZ
0.23139519597162203
ZZ
0.0079944786943387247
XX
0.20322234234589942

View File

@ -1,200 +0,0 @@
IIII
-0.20665748323683217
ZIII
-0.096022179507889355
XZII
-0.012585096432460004
XIII
0.012585096432460002
XXII
-0.029639606309848882
YYII
0.029639606309848882
ZZII
-0.20612801807987652
ZXII
0.0027917513494058743
IXII
0.0027917513494058743
IZII
0.36474560607027956
IIZI
0.096022179507889077
IIXZ
0.012585096432460008
IIXI
0.012585096432460006
IIXX
-0.029639606309848868
IIYY
0.029639606309848868
IIZZ
-0.20612801807987641
IIZX
-0.0027917513494058726
IIIX
0.0027917513494058743
IIIZ
-0.36474560607027956
ZIZI
-0.14543788191435422
ZIXZ
-0.011962198277325331
ZIXI
-0.011962198277325331
ZIXX
0.039154818592760203
ZIYY
-0.039154818592760203
ZIZZ
0.056040328985617657
ZIZX
-0.016781393784256322
ZIIX
0.016781393784256322
ZIIZ
0.11081066572357191
XZZI
-0.011962198277325331
XIZI
0.011962198277325331
XZXZ
-0.0026669416291266101
XZXI
-0.0026669416291266101
XIXZ
0.0026669416291266101
XIXI
0.0026669416291266101
XZXX
0.0081947444613071196
XZYY
-0.0081947444613071196
XIXX
-0.0081947444613071196
XIYY
0.0081947444613071196
XZZZ
-0.00024654966581589405
XIZZ
0.00024654966581589405
XZZX
-0.0012708408559466877
XZIX
0.0012708408559466877
XIZX
0.0012708408559466877
XIIX
-0.0012708408559466877
XZIZ
0.0072647375176923996
XIIZ
-0.0072647375176923996
XXZI
-0.03915481859276021
YYZI
0.03915481859276021
XXXZ
-0.0081947444613071196
XXXI
-0.0081947444613071196
YYXZ
0.0081947444613071196
YYXI
0.0081947444613071196
XXXX
0.02892604472017965
XXYY
-0.02892604472017965
YYXX
-0.02892604472017965
YYYY
0.02892604472017965
XXZZ
-0.0028953260749665956
YYZZ
0.0028953260749665956
XXZX
-0.0074989926703520624
XXIX
0.0074989926703520624
YYZX
0.0074989926703520624
YYIX
-0.0074989926703520624
XXIZ
0.024279988585959714
YYIZ
-0.024279988585959714
ZZZI
-0.056040328985617643
ZZXZ
0.000246549665815894
ZZXI
0.000246549665815894
ZZXX
-0.0028953260749665956
ZZYY
0.0028953260749665956
ZZZZ
0.080333850925909334
ZZZX
0.009769353678915493
ZZIX
-0.009769353678915493
ZZIZ
0.063672720404946023
ZXZI
-0.016781393784256322
IXZI
-0.016781393784256322
ZXXZ
-0.001270840855946688
ZXXI
-0.001270840855946688
IXXZ
-0.001270840855946688
IXXI
-0.001270840855946688
ZXXX
0.0074989926703520624
ZXYY
-0.0074989926703520624
IXXX
0.0074989926703520624
IXYY
-0.0074989926703520624
ZXZZ
-0.0097693536789154965
IXZZ
-0.0097693536789154965
ZXZX
-0.0093271960584065342
ZXIX
0.0093271960584065342
IXZX
-0.0093271960584065342
IXIX
0.0093271960584065342
ZXIZ
0.0080251584900907554
IXIZ
0.0080251584900907554
IZZI
0.11081066572357193
IZXZ
0.0072647375176923988
IZXI
0.0072647375176923988
IZXX
-0.02427998858595971
IZYY
0.02427998858595971
IZZZ
-0.063672720404946037
IZZX
0.0080251584900907554
IZIX
-0.0080251584900907554
IZIZ
-0.095215796658694896

View File

@ -1,200 +0,0 @@
IIII
-9.22747640580127104
ZIII
-0.271642466757865464
XZII
0.00882048807637014418
XIII
-0.00882048807637014765
XXII
0.167021021024272326
YYII
-0.167021021024272326
ZZII
-0.18742472133760385
ZXII
-0.0334425395332740225
IXII
-0.0334425395332740225
IZII
0.333552403114851792
IIZI
0.271642466757865297
IIXZ
-0.00882048807637014591
IIXI
-0.00882048807637014591
IIXX
0.167021021024272326
IIYY
-0.167021021024272326
IIZZ
-0.187424721337603906
IIZX
0.0334425395332740086
IIIX
-0.0334425395332740155
IIIZ
-0.333552403114851792
ZIZI
-0.209828154063180838
ZIXZ
-0.00547912760623860649
ZIXI
-0.00547912760623860649
ZIXX
-0.0293094096280056872
ZIYY
0.0293094096280056872
ZIZZ
0.0722202430427330844
ZIZX
0.00191110704979651001
ZIIX
-0.00191110704979651001
ZIIZ
0.0941097957715853195
XZZI
-0.00547912760623860649
XIZI
0.00547912760623860649
XZXZ
-0.00119013033200719969
XZXI
-0.00119013033200719969
XIXZ
0.00119013033200719969
XIXI
0.00119013033200719969
XZXX
-0.00157099793743996482
XZYY
0.00157099793743996482
XIXX
0.00157099793743996482
XIYY
-0.00157099793743996482
XZZZ
-0.00208692654508463565
XIZZ
0.00208692654508463565
XZZX
0.000450141311706680743
XZIX
-0.000450141311706680743
XIZX
-0.000450141311706680743
XIIX
0.000450141311706680743
XZIZ
0.000679501237718285593
XIIZ
-0.000679501237718285593
XXZI
0.0293094096280056872
YYZI
-0.0293094096280056872
XXXZ
0.00157099793743996504
XXXI
0.00157099793743996504
YYXZ
-0.00157099793743996504
YYXI
-0.00157099793743996504
XXXX
0.0110441958216364391
XXYY
-0.0110441958216364391
YYXX
-0.0110441958216364391
YYYY
0.0110441958216364391
XXZZ
-0.00421965465395699336
YYZZ
0.00421965465395699336
XXZX
4.70150199415193183e-05
XXIX
-4.70150199415193183e-05
YYZX
-4.70150199415193183e-05
YYIX
4.70150199415193183e-05
XXIZ
-0.00385207115738250665
YYIZ
0.00385207115738250665
ZZZI
-0.0722202430427330844
ZZXZ
0.00208692654508463565
ZZXI
0.00208692654508463565
ZZXX
-0.00421965465395699249
ZZYY
0.00421965465395699249
ZZZZ
0.0863728838335302562
ZZZX
-0.00815637765859752138
ZZIX
0.00815637765859752138
ZZIZ
0.054624371134464493
ZXZI
0.00191110704979651023
IXZI
0.00191110704979651023
ZXXZ
0.000450141311706680688
ZXXI
0.000450141311706680688
IXXZ
0.000450141311706680688
IXXI
0.000450141311706680688
ZXXX
-4.70150199415193183e-05
ZXYY
4.70150199415193183e-05
IXXX
-4.70150199415193183e-05
IXYY
4.70150199415193183e-05
ZXZZ
0.00815637765859752138
IXZZ
0.00815637765859752138
ZXZX
-0.00345767314176723649
ZXIX
0.00345767314176723649
IXZX
-0.00345767314176723649
IXIX
0.00345767314176723649
ZXIZ
-0.00082933858595588461
IXIZ
-0.00082933858595588461
IZZI
0.0941097957715853195
IZXZ
0.000679501237718285701
IZXI
0.000679501237718285701
IZXX
0.00385207115738250708
IZYY
-0.00385207115738250708
IZZZ
-0.0546243711344645
IZZX
-0.000829338585955884501
IZIX
0.000829338585955884501
IZIZ
-0.0702438532988372971

View File

@ -1,200 +0,0 @@
IIII
-8.03282163861994825
ZIII
-0.0965131799980513683
XZII
-0.0128701587150876658
XIII
0.0128701587150876658
XXII
-0.035550598580279931
YYII
0.035550598580279931
ZZII
-0.206201386287444777
ZXII
0.00429036398350390088
IXII
0.00429036398350390088
IZII
0.369118093951366799
IIZI
0.0965131799980513128
IIXZ
0.0128701587150876692
IIXI
0.0128701587150876692
IIXX
-0.0355505985802799448
IIYY
0.0355505985802799448
IIZZ
-0.20620138628744461
IIZX
-0.00429036398350390522
IIIX
0.00429036398350390522
IIIZ
-0.369118093951366855
ZIZI
-0.149245815297903345
ZIXZ
-0.0116900158438091924
ZIXI
-0.0116900158438091924
ZIXX
0.0402388841485031012
ZIYY
-0.0402388841485031012
ZIZZ
0.0560274330439167328
ZIZX
-0.0160577658776281489
ZIIX
0.0160577658776281489
ZIIZ
0.111043571972836208
XZZI
-0.0116900158438091907
XIZI
0.0116900158438091907
XZXZ
-0.00240906021967101681
XZXI
-0.00240906021967101681
XIXZ
0.00240906021967101681
XIXI
0.00240906021967101681
XZXX
0.00772492045445325858
XZYY
-0.00772492045445325858
XIXX
-0.00772492045445325858
XIYY
0.00772492045445325858
XZZZ
-0.000228395138553035606
XIZZ
0.000228395138553035606
XZZX
-0.00105436585264024251
XZIX
0.00105436585264024251
XIZX
0.00105436585264024251
XIIX
-0.00105436585264024251
XZIZ
0.00675919278909287678
XIIZ
-0.00675919278909287678
XXZI
-0.0402388841485031082
YYZI
0.0402388841485031082
XXXZ
-0.00772492045445325771
XXXI
-0.00772492045445325771
YYXZ
0.00772492045445325771
YYXI
0.00772492045445325771
XXXX
0.0285396359178743605
XXYY
-0.0285396359178743605
YYXX
-0.0285396359178743605
YYYY
0.0285396359178743605
XXZZ
-0.00268279385594006117
YYZZ
0.00268279385594006117
XXZX
-0.00690485983171506418
XXIX
0.00690485983171506418
YYZX
0.00690485983171506418
YYIX
-0.00690485983171506418
XXIZ
0.0239482477322536455
YYIZ
-0.0239482477322536455
ZZZI
-0.0560274330439167259
ZZXZ
0.000228395138553035579
ZZXI
0.000228395138553035579
ZZXX
-0.00268279385594006074
ZZYY
0.00268279385594006074
ZZZZ
0.0807617091512029678
ZZZX
0.00981629428518284927
ZZIX
-0.00981629428518284927
ZZIZ
0.0633722672781616841
ZXZI
-0.0160577658776281489
IXZI
-0.0160577658776281489
ZXXZ
-0.00105436585264024251
ZXXI
-0.00105436585264024251
IXXZ
-0.00105436585264024251
IXXI
-0.00105436585264024251
ZXXX
0.00690485983171506591
ZXYY
-0.00690485983171506591
IXXX
0.00690485983171506591
IXYY
-0.00690485983171506591
ZXZZ
-0.00981629428518284927
IXZZ
-0.00981629428518284927
ZXZX
-0.00890939325472856966
ZXIX
0.00890939325472856966
IXZX
-0.00890939325472856966
IXIX
0.00890939325472856966
ZXIZ
0.00736071105889497465
IXIZ
0.00736071105889497465
IZZI
0.111043571972836208
IZXZ
0.00675919278909287505
IZXI
0.00675919278909287505
IZXX
-0.0239482477322536524
IZYY
0.0239482477322536524
IZZZ
-0.0633722672781616841
IZZX
0.00736071105889497378
IZIX
-0.00736071105889497378
IZIZ
-0.0938102930467319268

View File

@ -1,200 +0,0 @@
IIII
-7.99659202955374937
ZIII
-0.0956416148234459362
XZII
-0.012051376376774111
XIII
0.012051376376774111
XXII
-0.0225579244225890818
YYII
0.0225579244225890818
ZZII
-0.205878476983193059
ZXII
0.00104267346246310517
IXII
0.00104267346246310517
IZII
0.358664910257849856
IIZI
0.0956416148234459085
IIXZ
0.0120513763767741214
IIXI
0.0120513763767741214
IIXX
-0.0225579244225890888
IIYY
0.0225579244225890888
IIZZ
-0.205878476983193059
IIZX
-0.00104267346246309824
IIIX
0.00104267346246309824
IIIZ
-0.358664910257849801
ZIZI
-0.140920699539241329
ZIXZ
-0.0122947615355863821
ZIXI
-0.0122947615355863821
ZIXX
0.037712303226161592
ZIYY
-0.037712303226161592
ZIZZ
0.0561726886650049731
ZIZX
-0.0176922787338497089
ZIIX
0.0176922787338497089
ZIIZ
0.110326392436405601
XZZI
-0.0122947615355863821
XIZI
0.0122947615355863821
XZXZ
-0.00302548934229984919
XZXI
-0.00302548934229984919
XIXZ
0.00302548934229984919
XIXI
0.00302548934229984919
XZXX
0.00880128085967160287
XZYY
-0.00880128085967160287
XIXX
-0.00880128085967160287
XIYY
0.00880128085967160287
XZZZ
-0.000274967897334047221
XIZZ
0.000274967897334047221
XZZX
-0.00159138983175002055
XZIX
0.00159138983175002055
XIZX
0.00159138983175002055
XIIX
-0.00159138983175002055
XZIZ
0.00791219593328663234
XIIZ
-0.00791219593328663234
XXZI
-0.037712303226161599
YYZI
0.037712303226161599
XXXZ
-0.00880128085967160287
XXXI
-0.00880128085967160287
YYXZ
0.00880128085967160287
YYXI
0.00880128085967160287
XXXX
0.0292995211598307895
XXYY
-0.0292995211598307895
YYXX
-0.0292995211598307895
YYYY
0.0292995211598307895
XXZZ
-0.00308645521748432579
YYZZ
0.00308645521748432579
XXZX
-0.00826630503656382645
XXIX
0.00826630503656382645
YYZX
0.00826630503656382645
YYIX
-0.00826630503656382645
XXIZ
0.0245736986413936653
YYIZ
-0.0245736986413936653
ZZZI
-0.0561726886650049731
ZZXZ
0.000274967897334047221
ZZXI
0.000274967897334047221
ZZXX
-0.00308645521748432579
ZZYY
0.00308645521748432579
ZZZZ
0.0797658904550216791
ZZZX
0.00969528810296955111
ZZIX
-0.00969528810296955111
ZZIZ
0.0640574896300240282
ZXZI
-0.0176922787338497089
IXZI
-0.0176922787338497089
ZXXZ
-0.00159138983175002055
ZXXI
-0.00159138983175002055
IXXZ
-0.00159138983175002055
IXXI
-0.00159138983175002055
ZXXX
0.00826630503656382472
ZXYY
-0.00826630503656382472
IXXX
0.00826630503656382472
IXYY
-0.00826630503656382472
ZXZZ
-0.00969528810296954938
IXZZ
-0.00969528810296954938
ZXZX
-0.00991830974088280838
ZXIX
0.00991830974088280838
IXZX
-0.00991830974088280838
IXIX
0.00991830974088280838
ZXIZ
0.00888732807304021613
IXIZ
0.00888732807304021613
IZZI
0.110326392436405601
IZXZ
0.00791219593328663234
IZXI
0.00791219593328663234
IZXX
-0.0245736986413936653
IZYY
0.0245736986413936653
IZZZ
-0.0640574896300240421
IZZX
0.00888732807304021613
IZIX
-0.00888732807304021613
IZIZ
-0.0967313927605417956

View File

@ -1,200 +0,0 @@
IIII
-7.9675126007042234
ZIII
-0.0955408922034189645
XZII
-0.0105340976571084849
XIII
0.0105340976571084849
XXII
-0.0102366935960605965
YYII
0.0102366935960606104
ZZII
-0.20500647306659181
ZXII
-0.00177751569541872816
IXII
-0.00177751569541872816
IZII
0.346025429410681318
IIZI
0.0955408922034189922
IIXZ
0.0105340976571084797
IIXI
0.010534097657108478
IIXX
-0.0102366935960605879
IIYY
0.0102366935960605879
IIZZ
-0.205006473066591755
IIZX
0.00177751569541872816
IIIX
-0.00177751569541872816
IIIZ
-0.346025429410681484
ZIZI
-0.133071649364809086
ZIXZ
-0.0128601691193987733
ZIXI
-0.0128601691193987733
ZIXX
0.0347941887693862875
ZIYY
-0.0347941887693862875
ZIZZ
0.0567361946898492439
ZIZX
-0.0193776100861700155
ZIIX
0.0193776100861700155
ZIIZ
0.108915972772082398
XZZI
-0.0128601691193987733
XIZI
0.0128601691193987733
XZXZ
-0.00380760376261650739
XZXI
-0.00380760376261650739
XIXZ
0.00380760376261650739
XIXI
0.00380760376261650739
XZXX
0.00997672296372209902
XZYY
-0.00997672296372209902
XIXX
-0.00997672296372209902
XIYY
0.00997672296372209902
XZZZ
-0.000324000619737322023
XIZZ
0.000324000619737322023
XZZX
-0.00235212790199443344
XZIX
0.00235212790199443344
XIZX
0.00235212790199443344
XIIX
-0.00235212790199443344
XZIZ
0.00915981068458441954
XIIZ
-0.00915981068458441954
XXZI
-0.0347941887693862875
YYZI
0.0347941887693862875
XXXZ
-0.00997672296372209902
XXXI
-0.00997672296372209902
YYXZ
0.00997672296372209902
YYXI
0.00997672296372209902
XXXX
0.0296975689403408509
XXYY
-0.0296975689403408509
YYXX
-0.0296975689403408509
YYYY
0.0296975689403408509
XXZZ
-0.00321277913628606644
YYZZ
0.00321277913628606644
XXZX
-0.00976575304046331354
XXIX
0.00976575304046331354
YYZX
0.00976575304046331354
YYIX
-0.00976575304046331354
XXIZ
0.0248280137219595923
YYIZ
-0.0248280137219595923
ZZZI
-0.0567361946898492439
ZZXZ
0.000324000619737322023
ZZXI
0.000324000619737322023
ZZXX
-0.00321277913628606644
ZZYY
0.00321277913628606644
ZZZZ
0.0786187967181663505
ZZZX
0.00948714965735077478
ZZIX
-0.00948714965735077478
ZZIZ
0.0648400496302661417
ZXZI
-0.019377610086170019
IXZI
-0.019377610086170019
ZXXZ
-0.00235212790199443387
ZXXI
-0.00235212790199443387
IXXZ
-0.00235212790199443387
IXXI
-0.00235212790199443387
ZXXX
0.0097657530404633118
ZXYY
-0.0097657530404633118
IXXX
0.0097657530404633118
IXYY
-0.0097657530404633118
ZXZZ
-0.00948714965735077305
IXZZ
-0.00948714965735077305
ZXZX
-0.0112497213424064737
ZXIX
0.0112497213424064737
IXZX
-0.0112497213424064737
IXIX
0.0112497213424064737
ZXIZ
0.0105764391530361324
IXIZ
0.0105764391530361324
IZZI
0.10891597277208237
IZXZ
0.0091598106845844178
IZXI
0.0091598106845844178
IZXX
-0.0248280137219595923
IZYY
0.0248280137219595923
IZZZ
-0.0648400496302661417
IZZX
0.0105764391530361289
IZIX
-0.0105764391530361289
IZIZ
-0.0989109758887622842

View File

@ -1,200 +0,0 @@
IIII
-7.94346091767414464
ZIII
-0.0961847065199558232
XZII
-0.00830397927476416581
XIII
0.00830397927476416407
XXII
0.00117772170253690155
YYII
-0.00117772170253690155
ZZII
-0.203639360951594767
ZXII
-0.00387529715225777213
IXII
-0.00387529715225777213
IZII
0.332032938847090675
IIZI
0.0961847065199558371
IIXZ
0.00830397927476416581
IIXI
0.00830397927476416407
IIXX
0.00117772170253691542
IIYY
-0.00117772170253691369
IIZZ
-0.203639360951594794
IIZX
0.0038752971522577704
IIIX
-0.0038752971522577704
IIIZ
-0.332032938847090675
ZIZI
-0.125657384487069868
ZIXZ
-0.0132829418113627612
ZIXI
-0.0132829418113627612
ZIXX
0.0315403138576153819
ZIYY
-0.0315403138576153819
ZIZZ
0.0576662897955091819
ZIZX
-0.0209796071873338784
ZIIX
0.0209796071873338784
ZIIZ
0.106895728551110708
XZZI
-0.0132829418113627595
XIZI
0.0132829418113627595
XZXZ
-0.00474993367005203948
XZXI
-0.00474993367005203948
XIXZ
0.00474993367005203948
XIXI
0.00474993367005203948
XZXX
0.0111848746778077796
XZYY
-0.0111848746778077796
XIXX
-0.0111848746778077796
XIYY
0.0111848746778077796
XZZZ
-0.000325828935749788756
XIZZ
0.000325828935749788756
XZZX
-0.00335683668581072828
XZIX
0.00335683668581072828
XIZX
0.00335683668581072828
XIIX
-0.00335683668581072828
XZIZ
0.0104601420250627006
XIIZ
-0.0104601420250627006
XXZI
-0.0315403138576153819
YYZI
0.0315403138576153819
XXXZ
-0.0111848746778077813
XXXI
-0.0111848746778077813
YYXZ
0.0111848746778077813
YYXI
0.0111848746778077813
XXXX
0.0297284952579890543
XXYY
-0.0297284952579890543
YYXX
-0.0297284952579890543
YYYY
0.0297284952579890543
XXZZ
-0.00302916958398716414
YYZZ
0.00302916958398716414
XXZX
-0.0113549818710374697
XXIX
0.0113549818710374697
YYZX
0.0113549818710374697
YYIX
-0.0113549818710374697
XXIZ
0.024780800804421528
YYIZ
-0.024780800804421528
ZZZI
-0.057666289795509168
ZZXZ
0.000325828935749788756
ZZXI
0.000325828935749788756
ZZXX
-0.00302916958398716414
ZZYY
0.00302916958398716414
ZZZZ
0.0773799761858043889
ZZZX
0.00913556087764309452
ZZIX
-0.00913556087764309452
ZZIZ
0.0657592479193777613
ZXZI
-0.0209796071873338784
IXZI
-0.0209796071873338784
ZXXZ
-0.00335683668581072785
ZXXI
-0.00335683668581072785
IXXZ
-0.00335683668581072785
IXXI
-0.00335683668581072785
ZXXX
0.0113549818710374697
ZXYY
-0.0113549818710374697
IXXX
0.0113549818710374697
IXYY
-0.0113549818710374697
ZXZZ
-0.00913556087764309452
IXZZ
-0.00913556087764309452
ZXZX
-0.0129211233505689312
ZXIX
0.0129211233505689312
IXZX
-0.0129211233505689312
IXIX
0.0129211233505689312
ZXIZ
0.0123759631430552901
IXIZ
0.0123759631430552901
IZZI
0.106895728551110722
IZXZ
0.0104601420250626988
IZXI
0.0104601420250626988
IZXX
-0.024780800804421528
IZYY
0.024780800804421528
IZZZ
-0.0657592479193777613
IZZX
0.0123759631430552866
IZIX
-0.0123759631430552866
IZIZ
-0.100383508794299053

View File

@ -1,200 +0,0 @@
IIII
-7.92288737068127613
ZIII
-0.097560654585631762
XZII
-0.00543585637294364665
XIII
0.00543585637294364838
XXII
0.011529121586409433
YYII
-0.011529121586409433
ZZII
-0.201773702249713027
ZXII
-0.00492671878379116746
IXII
-0.00492671878379116746
IZII
0.317359111764389856
IIZI
0.0975606545856318175
IIXZ
0.00543585637294365012
IIXI
0.00543585637294365012
IIXX
0.0115291215864094122
IIYY
-0.0115291215864094122
IIZZ
-0.201773702249712972
IIZX
0.00492671878379116572
IIIX
-0.00492671878379116572
IIIZ
-0.317359111764389856
ZIZI
-0.118652649871880303
ZIXZ
-0.0134370121689033062
ZIXI
-0.0134370121689033062
ZIXX
0.0279987525703975157
ZIYY
-0.0279987525703975157
ZIZZ
0.0588408143226525557
ZIZX
-0.0223114905740242932
ZIIX
0.0223114905740242932
ZIIZ
0.104387067809514913
XZZI
-0.0134370121689033062
XIZI
0.0134370121689033062
XZXZ
-0.00580210473364071826
XZXI
-0.00580210473364071826
XIXZ
0.00580210473364071826
XIXI
0.00580210473364071826
XZXX
0.0123195446171109613
XZYY
-0.0123195446171109613
XIXX
-0.0123195446171109613
XIYY
0.0123195446171109613
XZZZ
-0.000230201312705874948
XIZZ
0.000230201312705874948
XZZX
-0.0045859012843585097
XZIX
0.0045859012843585097
XIZX
0.0045859012843585097
XIIX
-0.0045859012843585097
XZIZ
0.0117513734821834831
XIIZ
-0.0117513734821834831
XXZI
-0.0279987525703975122
YYZI
0.0279987525703975122
XXXZ
-0.0123195446171109578
XXXI
-0.0123195446171109578
YYXZ
0.0123195446171109578
YYXI
0.0123195446171109578
XXXX
0.0294003297980109102
XXYY
-0.0294003297980109102
YYXX
-0.0294003297980109102
YYYY
0.0294003297980109102
XXZZ
-0.00254726053056983457
YYZZ
0.00254726053056983457
XXZX
-0.0129506546764466476
XXIX
0.0129506546764466476
YYZX
0.0129506546764466476
YYIX
-0.0129506546764466476
XXIZ
0.0245208241308795677
YYIZ
-0.0245208241308795677
ZZZI
-0.0588408143226525696
ZZXZ
0.000230201312705874948
ZZXI
0.000230201312705874948
ZZXX
-0.002547260530569835
ZZYY
0.002547260530569835
ZZZZ
0.0761499732004193991
ZZZX
0.00860306940197843976
ZZIX
-0.00860306940197843976
ZZIZ
0.066795820145277171
ZXZI
-0.0223114905740242932
IXZI
-0.0223114905740242932
ZXXZ
-0.0045859012843585097
ZXXI
-0.0045859012843585097
IXXZ
-0.0045859012843585097
IXXI
-0.0045859012843585097
ZXXX
0.0129506546764466476
ZXYY
-0.0129506546764466476
IXXX
0.0129506546764466476
IXYY
-0.0129506546764466476
ZXZZ
-0.00860306940197843976
IXZZ
-0.00860306940197843976
ZXZX
-0.0148903163280011651
ZXIX
0.0148903163280011651
IXZX
-0.0148903163280011651
IXIX
0.0148903163280011651
ZXIZ
0.0142258790797011991
IXIZ
0.0142258790797011991
IZZI
0.104387067809514913
IZXZ
0.0117513734821834831
IZXI
0.0117513734821834831
IZXX
-0.0245208241308795712
IZYY
0.0245208241308795712
IZZZ
-0.066795820145277171
IZZX
0.0142258790797012008
IZIX
-0.0142258790797012008
IZIZ
-0.101296997085396301

View File

@ -1,200 +0,0 @@
IIII
-7.90470563621429001
ZIII
-0.0996613005079874659
XZII
-0.00212705333565675484
XIII
0.00212705333565675484
XXII
0.0207287103724417762
YYII
-0.0207287103724417762
ZZII
-0.199359656912530853
ZXII
-0.00466555889282156688
IXII
-0.00466555889282156688
IZII
0.302516146491264681
IIZI
0.0996613005079874104
IIXZ
0.00212705333565675484
IIXI
0.00212705333565675484
IIXX
0.0207287103724417901
IIYY
-0.0207287103724417901
IIZZ
-0.199359656912530908
IIZX
0.00466555889282155647
IIIX
-0.00466555889282155301
IIIZ
-0.302516146491264792
ZIZI
-0.112064104841840373
ZIXZ
-0.0132032299323373032
ZIXI
-0.0132032299323373032
ZIXX
0.0242256459549213474
ZIYY
-0.0242256459549213474
ZIZZ
0.0600616831445434096
ZIZX
-0.0231709032073615373
ZIIX
0.0231709032073615373
ZIIZ
0.101555772421554003
XZZI
-0.0132032299323373015
XIZI
0.0132032299323373015
XZXZ
-0.00685742759212312758
XZXI
-0.00685742759212312758
XIXZ
0.00685742759212312758
XIXI
0.00685742759212312758
XZXX
0.0132497128419402626
XZYY
-0.0132497128419402626
XIXX
-0.0132497128419402626
XIYY
0.0132497128419402626
XZZZ
-9.62332125687911672e-06
XIZZ
9.62332125687911672e-06
XZZX
-0.00596535441615402527
XZIX
0.00596535441615402527
XIZX
0.00596535441615402527
XIIX
-0.00596535441615402527
XZIZ
0.0129687063675447394
XIIZ
-0.0129687063675447394
XXZI
-0.0242256459549213474
YYZI
0.0242256459549213474
XXXZ
-0.0132497128419402643
XXXI
-0.0132497128419402643
YYXZ
0.0132497128419402643
YYXI
0.0132497128419402643
XXXX
0.0287505079860750495
XXYY
-0.0287505079860750495
YYXX
-0.0287505079860750495
YYYY
0.0287505079860750495
XXZZ
-0.00183747796106882772
YYZZ
0.00183747796106882772
XXZX
-0.0144523363636329238
XXIX
0.0144523363636329238
YYZX
0.0144523363636329238
YYIX
-0.0144523363636329238
XXIZ
0.02417188337646042
YYIZ
-0.02417188337646042
ZZZI
-0.0600616831445434096
ZZXZ
9.62332125687911672e-06
ZZXI
9.62332125687911672e-06
ZZXX
-0.00183747796106882794
ZZYY
0.00183747796106882794
ZZZZ
0.0750559855050324659
ZZZX
0.00790345773274843746
ZZIX
-0.00790345773274843746
ZZIZ
0.067864068281549686
ZXZI
-0.0231709032073615338
IXZI
-0.0231709032073615338
ZXXZ
-0.0059653544161540244
ZXXI
-0.0059653544161540244
IXXZ
-0.0059653544161540244
IXXI
-0.0059653544161540244
ZXXX
0.0144523363636329238
ZXYY
-0.0144523363636329238
IXXX
0.0144523363636329238
IXYY
-0.0144523363636329238
ZXZZ
-0.00790345773274843573
IXZZ
-0.00790345773274843573
ZXZX
-0.0170530094058189557
ZXIX
0.0170530094058189557
IXZX
-0.0170530094058189557
IXIX
0.0170530094058189557
ZXIZ
0.0160981879868866001
IXIZ
0.0160981879868866001
IZZI
0.101555772421554003
IZXZ
0.0129687063675447394
IZXI
0.0129687063675447394
IZXX
-0.0241718833764604235
IZYY
0.0241718833764604235
IZZZ
-0.067864068281549686
IZZX
0.0160981879868866001
IZIX
-0.0160981879868866001
IZIZ
-0.101905964104279545

View File

@ -1,200 +0,0 @@
IIII
-7.88817561016891666
ZIII
-0.102478268730274213
XZII
0.00130628210129183145
XIII
-0.00130628210129183145
XXII
0.0287529245856122731
YYII
-0.0287529245856122731
ZZII
-0.196359703992800338
ZXII
-0.00294264606744627094
IXII
-0.00294264606744627441
IZII
0.287849326786274284
IIZI
0.102478268730274047
IIXZ
-0.00130628210129184186
IIXI
-0.00130628210129184186
IIXX
0.0287529245856122315
IIYY
-0.0287529245856122315
IIZZ
-0.196359703992800311
IIZX
0.00294264606744626053
IIIX
-0.002942646067446264
IIIZ
-0.287849326786274284
ZIZI
-0.105937131164366954
ZIXZ
-0.0125068915765676383
ZIXI
-0.0125068915765676383
ZIXX
0.020287168975866493
ZIYY
-0.020287168975866493
ZIZZ
0.0610843733997201016
ZIZX
-0.0233859478919769964
ZIIX
0.0233859478919769964
ZIIZ
0.0985860430601590843
XZZI
-0.0125068915765676417
XIZI
0.0125068915765676417
XZXZ
-0.00776220205190064974
XZXI
-0.00776220205190064974
XIXZ
0.00776220205190064974
XIXI
0.00776220205190064974
XZXX
0.0138450400554405231
XZYY
-0.0138450400554405231
XIXX
-0.0138450400554405231
XIYY
0.0138450400554405231
XZZZ
0.000312086258906581768
XIZZ
-0.000312086258906581768
XZZX
-0.00736939756187899274
XZIX
0.00736939756187899274
XIZX
0.00736939756187899274
XIIX
-0.00736939756187899274
XZIZ
0.0140667691838824924
XIIZ
-0.0140667691838824924
XXZI
-0.0202871689758664965
YYZI
0.0202871689758664965
XXXZ
-0.0138450400554405197
XXXI
-0.0138450400554405197
YYXZ
0.0138450400554405197
YYXI
0.0138450400554405197
XXXX
0.027840834627358077
XXYY
-0.027840834627358077
YYXX
-0.027840834627358077
YYYY
0.027840834627358077
XXZZ
-0.00102647662754709753
YYZZ
0.00102647662754709753
XXZX
-0.0157658969368307256
XXIX
0.0157658969368307256
YYZX
0.0157658969368307256
YYIX
-0.0157658969368307256
XXIZ
0.0238912964642606293
YYIZ
-0.0238912964642606293
ZZZI
-0.0610843733997201085
ZZXZ
-0.000312086258906581768
ZZXI
-0.000312086258906581768
ZZXX
-0.00102647662754709753
ZZYY
0.00102647662754709753
ZZZZ
0.0742113946003170183
ZZZX
0.00712806100928853326
ZZIX
-0.00712806100928853326
ZZIZ
0.06882879109726453
ZXZI
-0.0233859478919769895
IXZI
-0.0233859478919769895
ZXXZ
-0.00736939756187899361
ZXXI
-0.00736939756187899361
IXXZ
-0.00736939756187899361
IXXI
-0.00736939756187899361
ZXXX
0.0157658969368307256
ZXYY
-0.0157658969368307256
IXXX
0.0157658969368307256
IXYY
-0.0157658969368307256
ZXZZ
-0.00712806100928853499
IXZZ
-0.00712806100928853499
ZXZX
-0.0192595575718204348
ZXIX
0.0192595575718204348
IXZX
-0.0192595575718204348
IXIX
0.0192595575718204348
ZXIZ
0.0180264614888057673
IXIZ
0.0180264614888057673
IZZI
0.0985860430601590981
IZXZ
0.0140667691838824906
IZXI
0.0140667691838824906
IZXX
-0.0238912964642606293
IZYY
0.0238912964642606293
IZZZ
-0.06882879109726453
IZZX
0.0180264614888057638
IZIX
-0.0180264614888057638
IZIZ
-0.102570319596411955

View File

@ -1,200 +0,0 @@
IIII
-7.87279366735846775
ZIII
-0.105991019242805073
XZII
0.00447030504394265327
XIII
-0.00447030504394265501
XXII
0.035622415750953991
YYII
-0.035622415750953991
ZZII
-0.192844334883633395
ZXII
0.000224553250019538658
IXII
0.000224553250019545597
IZII
0.27351638834801284
IIZI
0.105991019242805101
IIXZ
-0.00447030504394265674
IIXI
-0.00447030504394265848
IIXX
0.035622415750953984
IIYY
-0.035622415750953984
IIZZ
-0.192844334883633256
IIZX
-0.00022455325001952478
IIIX
0.00022455325001952478
IIIZ
-0.273516388348012729
ZIZI
-0.100359921611598249
ZIXZ
-0.0113521167638305324
ZIXI
-0.0113521167638305324
ZIXX
0.0162573128090379333
ZIYY
-0.0162573128090379333
ZIZZ
0.0616796530307025595
ZIZX
-0.0228472943622540156
ZIIX
0.0228472943622540156
ZIIZ
0.0956260800132685274
XZZI
-0.0113521167638305324
XIZI
0.0113521167638305324
XZXZ
-0.0083500301510814768
XZXI
-0.0083500301510814768
XIXZ
0.0083500301510814768
XIXI
0.0083500301510814768
XZXX
0.0140016362997722309
XZYY
-0.0140016362997722309
XIXX
-0.0140016362997722309
XIYY
0.0140016362997722309
XZZZ
0.000650495549106393017
XIZZ
-0.000650495549106393017
XZZX
-0.00863900633543595968
XZIX
0.00863900633543595968
XIZX
0.00863900633543595968
XIIX
-0.00863900633543595968
XZIZ
0.0150266655386942366
XIIZ
-0.0150266655386942366
XXZI
-0.0162573128090379333
YYZI
0.0162573128090379333
XXXZ
-0.0140016362997722344
XXXI
-0.0140016362997722344
YYXZ
0.0140016362997722344
YYXI
0.0140016362997722344
XXXX
0.0267350921591014215
XXYY
-0.0267350921591014215
YYXX
-0.0267350921591014215
YYYY
0.0267350921591014215
XXZZ
-0.000270625356015804109
YYZZ
0.000270625356015804109
XXZX
-0.0168196364775766195
XXIX
0.0168196364775766195
YYZX
0.0168196364775766195
YYIX
-0.0168196364775766195
XXIZ
0.0238377441856716873
YYIZ
-0.0238377441856716873
ZZZI
-0.0616796530307025526
ZZXZ
-0.000650495549106393017
ZZXI
-0.000650495549106393017
ZZXX
-0.000270625356015804109
ZZYY
0.000270625356015804109
ZZZZ
0.0736838391509292284
ZZZX
0.00643387024139036902
ZZIX
-0.00643387024139036902
ZZIZ
0.0695406385081323991
ZXZI
-0.0228472943622540121
IXZI
-0.0228472943622540121
ZXXZ
-0.00863900633543596141
ZXXI
-0.00863900633543596141
IXXZ
-0.00863900633543596141
IXXI
-0.00863900633543596141
ZXXX
0.0168196364775766195
ZXYY
-0.0168196364775766195
IXXX
0.0168196364775766195
IXYY
-0.0168196364775766195
ZXZZ
-0.00643387024139036902
IXZZ
-0.00643387024139036902
ZXZX
-0.0213398832212755053
ZXIX
0.0213398832212755053
IXZX
-0.0213398832212755053
IXIX
0.0213398832212755053
ZXIZ
0.0201069128372161066
IXIZ
0.0201069128372161066
IZZI
0.0956260800132685274
IZXZ
0.0150266655386942366
IZXI
0.0150266655386942366
IZXX
-0.0238377441856716908
IZYY
0.0238377441856716908
IZZZ
-0.0695406385081323991
IZZX
0.02010691283721611
IZIX
-0.02010691283721611
IZIZ
-0.103701976010511704

View File

@ -1,200 +0,0 @@
IIII
-7.85823329949274729
ZIII
-0.11013664865272732
XZII
0.0069538784025759701
XIII
-0.00695387840257597704
XXII
0.0413723940431222487
YYII
-0.0413723940431222487
ZZII
-0.18903885146314503
ZXII
0.00465401863346975777
IXII
0.0046540186334697543
IZII
0.259465018487427201
IIZI
0.110136648652727182
IIXZ
-0.00695387840257596316
IIXI
-0.00695387840257595969
IIXX
0.0413723940431222348
IIYY
-0.0413723940431222348
IIZZ
-0.18903885146314503
IIZX
-0.00465401863346977251
IIIX
0.00465401863346977251
IIIZ
-0.259465018487427201
ZIZI
-0.0954499908900069277
ZIXZ
-0.00983726562610707893
ZIXI
-0.00983726562610707893
ZIXX
0.012217383322786015
ZIYY
-0.012217383322786015
ZIZZ
0.0617034312728341611
ZIZX
-0.0215175283720306816
ZIIX
0.0215175283720306816
ZIIZ
0.0927397736916669435
XZZI
-0.00983726562610707719
XIZI
0.00983726562610707719
XZXZ
-0.00849175298996503874
XZXI
-0.00849175298996503874
XIXZ
0.00849175298996503874
XIXI
0.00849175298996503874
XZXX
0.0136546268466454391
XZYY
-0.0136546268466454391
XIXX
-0.0136546268466454391
XIYY
0.0136546268466454391
XZZZ
0.00087949700344221453
XIZZ
-0.00087949700344221453
XZZX
-0.00961057651293473897
XZIX
0.00961057651293473897
XIZX
0.00961057651293473897
XIIX
-0.00961057651293473897
XZIZ
0.0158389338991015531
XIIZ
-0.0158389338991015531
XXZI
-0.0122173833227860167
YYZI
0.0122173833227860167
XXXZ
-0.0136546268466454391
XXXI
-0.0136546268466454391
YYXZ
0.0136546268466454391
YYXI
0.0136546268466454391
XXXX
0.0254711706570046777
XXYY
-0.0254711706570046777
YYXX
-0.0254711706570046777
YYYY
0.0254711706570046777
XXZZ
0.000272812079660216238
YYZZ
-0.000272812079660216238
XXZX
-0.0175538504435233979
XXIX
0.0175538504435233979
YYZX
0.0175538504435233979
YYIX
-0.0175538504435233979
XXIZ
0.0241276218308310829
YYIZ
-0.0241276218308310829
ZZZI
-0.0617034312728341611
ZZXZ
-0.00087949700344221453
ZZXI
-0.00087949700344221453
ZZXX
0.000272812079660216238
ZZYY
-0.000272812079660216238
ZZZZ
0.0734878819915239928
ZZZX
0.00600782929256795349
ZZIX
-0.00600782929256795349
ZZIZ
0.0698367420661364507
ZXZI
-0.0215175283720306781
IXZI
-0.0215175283720306781
ZXXZ
-0.00961057651293473897
ZXXI
-0.00961057651293473897
IXXZ
-0.00961057651293473897
IXXI
-0.00961057651293473897
ZXXX
0.0175538504435233944
ZXYY
-0.0175538504435233944
IXXX
0.0175538504435233944
IXYY
-0.0175538504435233944
ZXZZ
-0.00600782929256795349
IXZZ
-0.00600782929256795349
ZXZX
-0.0231130335413358666
ZXIX
0.0231130335413358666
IXZX
-0.0231130335413358666
IXIX
0.0231130335413358666
ZXIZ
0.0224520597523753737
IXIZ
0.0224520597523753737
IZZI
0.0927397736916669158
IZXZ
0.0158389338991015496
IZXI
0.0158389338991015496
IZXX
-0.0241276218308310829
IZYY
0.0241276218308310829
IZZZ
-0.0698367420661364507
IZZX
0.0224520597523753737
IZIX
-0.0224520597523753737
IZIZ
-0.10573730141027704

View File

@ -1,200 +0,0 @@
IIII
-7.84427959238081751
ZIII
-0.114803007999943946
XZII
0.00840772301171669595
XIII
-0.00840772301171669248
XXII
0.0460120444611950702
YYII
-0.0460120444611950702
ZZII
-0.185326304963195021
ZXII
0.0100204080316059346
IXII
0.0100204080316059364
IZII
0.245492493782740434
IIZI
0.114803007999943654
IIXZ
-0.0084077230117166786
IIXI
-0.0084077230117166786
IIXX
0.0460120444611950424
IIYY
-0.0460120444611950424
IIZZ
-0.185326304963195021
IIZX
-0.0100204080316059624
IIIX
0.0100204080316059641
IIIZ
-0.24549249378274049
ZIZI
-0.0913306964484826289
ZIXZ
-0.00814695303030834282
ZIXI
-0.00814695303030834282
ZIXX
0.00826378555632840787
ZIYY
-0.00826378555632840787
ZIZZ
0.0611457314764767695
ZIZX
-0.0194308688234599569
ZIIX
0.0194308688234599569
ZIIZ
0.0898831042201703456
XZZI
-0.00814695303030834456
XIZI
0.00814695303030834456
XZXZ
-0.008141680517636668
XZXI
-0.008141680517636668
XIXZ
0.008141680517636668
XIXI
0.008141680517636668
XZXX
0.0127870380402767721
XZYY
-0.0127870380402767721
XIXX
-0.0127870380402767721
XIYY
0.0127870380402767721
XZZZ
0.000874436518936163058
XIZZ
-0.000874436518936163058
XZZX
-0.0101398523588390535
XZIX
0.0101398523588390535
XIZX
0.0101398523588390535
XIIX
-0.0101398523588390535
XZIZ
0.0164740568299404158
XIIZ
-0.0164740568299404158
XXZI
-0.00826378555632840961
YYZI
0.00826378555632840961
XXXZ
-0.0127870380402767755
XXXI
-0.0127870380402767755
YYXZ
0.0127870380402767755
YYXI
0.0127870380402767755
XXXX
0.0240433304823563822
XXYY
-0.0240433304823563822
YYXX
-0.0240433304823563822
YYYY
0.0240433304823563822
XXZZ
0.000477536691536323624
YYZZ
-0.000477536691536323624
XXZX
-0.0179043792438446647
XXIX
0.0179043792438446647
YYZX
0.0179043792438446647
YYIX
-0.0179043792438446647
XXIZ
0.0247930137429090841
YYIZ
-0.0247930137429090841
ZZZI
-0.0611457314764767557
ZZXZ
-0.000874436518936163058
ZZXI
-0.000874436518936163058
ZZXX
0.000477536691536323624
ZZYY
-0.000477536691536323624
ZZZZ
0.0736130920981576953
ZZZX
0.00601113707876626928
ZZIX
-0.00601113707876626928
ZZIZ
0.0695389741090617353
ZXZI
-0.0194308688234599604
IXZI
-0.0194308688234599604
ZXXZ
-0.0101398523588390535
ZXXI
-0.0101398523588390535
IXXZ
-0.0101398523588390535
IXXI
-0.0101398523588390535
ZXXX
0.0179043792438446647
ZXYY
-0.0179043792438446647
IXXX
0.0179043792438446647
IXYY
-0.0179043792438446647
ZXZZ
-0.00601113707876627101
IXZZ
-0.00601113707876627101
ZXZX
-0.0243711862247169633
ZXIX
0.0243711862247169633
IXZX
-0.0243711862247169633
IXIX
0.0243711862247169633
ZXIZ
0.0251126223326813384
IXIZ
0.0251126223326813384
IZZI
0.0898831042201703456
IZXZ
0.0164740568299404158
IZXI
0.0164740568299404158
IZXX
-0.024793013742909091
IZYY
0.024793013742909091
IZZZ
-0.0695389741090617214
IZZX
0.0251126223326813419
IZIX
-0.0251126223326813419
IZIZ
-0.109094941060251846

View File

@ -1,200 +0,0 @@
IIII
-9.03247059754140658
ZIII
-0.216556458583506584
XZII
0.00529443315574606218
XIII
-0.00529443315574606218
XXII
0.142114991476646635
YYII
-0.142114991476646635
ZZII
-0.189069993568352218
ZXII
-0.0310546724224039367
IXII
-0.0310546724224039367
IZII
0.320962777873009364
IIZI
0.216556458583506556
IIXZ
-0.00529443315574606044
IIXI
-0.00529443315574606044
IIXX
0.142114991476646579
IIYY
-0.142114991476646579
IIZZ
-0.18906999356835219
IIZX
0.0310546724224039367
IIIX
-0.0310546724224039367
IIIZ
-0.320962777873009419
ZIZI
-0.214149964017854744
ZIXZ
-0.00641990148129960476
ZIXI
-0.00641990148129960476
ZIXX
-0.0305980248675343999
ZIYY
0.0305980248675343999
ZIZZ
0.0700261338696092084
ZIZX
0.00372916515112739835
ZIIX
-0.00372916515112739835
ZIIZ
0.094341254103032457
XZZI
-0.0064199014812996039
XIZI
0.0064199014812996039
XZXZ
-0.00104745470742469409
XZXI
-0.00104745470742469409
XIXZ
0.00104745470742469409
XIXI
0.00104745470742469409
XZXX
-0.00201913577349532641
XZYY
0.00201913577349532641
XIXX
0.00201913577349532641
XIYY
-0.00201913577349532641
XZZZ
-0.00175574988265663986
XIZZ
0.00175574988265663986
XZZX
0.000444612587488718092
XZIX
-0.000444612587488718092
XIZX
-0.000444612587488718092
XIIX
0.000444612587488718092
XZIZ
0.000831575696581609647
XIIZ
-0.000831575696581609647
XXZI
0.0305980248675343999
YYZI
-0.0305980248675343999
XXXZ
0.00201913577349532641
XXXI
0.00201913577349532641
YYXZ
-0.00201913577349532641
YYXI
-0.00201913577349532641
XXXX
0.0110506030693458893
XXYY
-0.0110506030693458893
YYXX
-0.0110506030693458893
YYYY
0.0110506030693458893
XXZZ
-0.00336471561025263044
YYZZ
0.00336471561025263044
XXZX
-0.000205791003099929231
XXIX
0.000205791003099929231
YYZX
0.000205791003099929231
YYIX
-0.000205791003099929231
XXIZ
-0.00434747065879758851
YYIZ
0.00434747065879758851
ZZZI
-0.0700261338696092084
ZZXZ
0.00175574988265663964
ZZXI
0.00175574988265663964
ZZXX
-0.00336471561025263044
ZZYY
0.00336471561025263044
ZZZZ
0.0855192574697131308
ZZZX
-0.00889214179421552592
ZZIX
0.00889214179421552592
ZZIZ
0.0551977587660193517
ZXZI
0.00372916515112739879
IXZI
0.00372916515112739879
ZXXZ
0.000444612587488718092
ZXXI
0.000444612587488718092
IXXZ
0.000444612587488718092
IXXI
0.000444612587488718092
ZXXX
0.000205791003099929203
ZXYY
-0.000205791003099929203
IXXX
0.000205791003099929203
IXYY
-0.000205791003099929203
ZXZZ
0.00889214179421552765
IXZZ
0.00889214179421552765
ZXZX
-0.00424242884795692984
ZXIX
0.00424242884795692984
IXZX
-0.00424242884795692984
IXIX
0.00424242884795692984
ZXIZ
-0.00142467086123127884
IXIZ
-0.00142467086123127884
IZZI
0.094341254103032457
IZXZ
0.000831575696581609647
IZXI
0.000831575696581609647
IZXX
0.00434747065879758764
IZYY
-0.00434747065879758764
IZZZ
-0.0551977587660193586
IZZX
-0.00142467086123127884
IZIX
0.00142467086123127884
IZIZ
-0.0691666064635285127

Some files were not shown because too many files have changed in this diff Show More