-
Notifications
You must be signed in to change notification settings - Fork 29
/
01_overview.html
412 lines (283 loc) · 22.8 KB
/
01_overview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Krotov Python Package — Krotov 1.2.0 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
<link rel="stylesheet" href="_static/copybutton.css" type="text/css" />
<link rel="stylesheet" href="_static/mycss.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script src="_static/clipboard.min.js"></script>
<script src="_static/copybutton.js"></script>
<script src="_static/doctr-versions-menu.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"extensions": ["tex2jax.js"], "jax": ["input/TeX", "output/SVG"], "TeX": {"extensions": ["AMSmath.js", "AMSsymbols.js"], "Macros": {"tr": ["{\\operatorname{tr}}", 0], "diag": ["{\\operatorname{diag}}", 0], "abs": ["{\\operatorname{abs}}", 0], "pop": ["{\\operatorname{pop}}", 0], "ee": ["{\\text{e}}", 0], "ii": ["{\\text{i}}", 0], "aux": ["{\\text{aux}}", 0], "opt": ["{\\text{opt}}", 0], "tgt": ["{\\text{tgt}}", 0], "init": ["{\\text{init}}", 0], "lab": ["{\\text{lab}}", 0], "rwa": ["{\\text{rwa}}", 0], "bra": ["{\\langle#1\\vert}", 1], "ket": ["{\\vert#1\\rangle}", 1], "Bra": ["{\\left\\langle#1\\right\\vert}", 1], "Braket": ["{\\left\\langle #1\\vphantom{#2} \\mid #2\\vphantom{#1}\\right\\rangle}", 2], "ketbra": ["{\\vert#1\\rangle\\!\\langle#2\\vert}", 2], "Ket": ["{\\left\\vert#1\\right\\rangle}", 1], "mat": ["{\\mathbf{#1}}", 1], "op": ["{\\hat{#1}}", 1], "Op": ["{\\hat{#1}}", 1], "dd": ["{\\,\\text{d}}", 0], "daggered": ["{^{\\dagger}}", 0], "transposed": ["{^{\\text{T}}}", 0], "Liouville": ["{\\mathcal{L}}", 0], "DynMap": ["{\\mathcal{E}}", 0], "identity": ["{\\mathbf{1}}", 0], "Norm": ["{\\left\\lVert#1\\right\\rVert}", 1], "norm": ["{\\lVert#1\\rVert}", 1], "Abs": ["{\\left\\vert#1\\right\\vert}", 1], "avg": ["{\\langle#1\\rangle}", 1], "Avg": ["{\\left\\langle#1\\right\\rangle}", 1], "AbsSq": ["{\\left\\vert#1\\right\\vert^2}", 1], "Re": ["{\\operatorname{Re}}", 0], "Im": ["{\\operatorname{Im}}", 0], "Real": ["{\\mathbb{R}}", 0], "Complex": ["{\\mathbb{C}}", 0], "Integer": ["{\\mathbb{N}}", 0]}}, "tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Contributing" href="02_contributing.html" />
<link rel="prev" title="Welcome to the Krotov package’s documentation!" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home" alt="Documentation Home"> Krotov
</a>
<div class="version">
1.2.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Krotov Python Package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#purpose">Purpose</a></li>
<li class="toctree-l2"><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="#installation">Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="#citing-the-krotov-package">Citing the Krotov Package</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="02_contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="03_authors.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="04_features.html">Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="05_history.html">History</a></li>
<li class="toctree-l1"><a class="reference internal" href="06_introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="07_krotovs_method.html">Krotov’s Method</a></li>
<li class="toctree-l1"><a class="reference internal" href="08_qutip_usage.html">Using Krotov with QuTiP</a></li>
<li class="toctree-l1"><a class="reference internal" href="09_examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="10_howto.html">How-Tos</a></li>
<li class="toctree-l1"><a class="reference internal" href="11_other_methods.html">Other Optimization Methods</a></li>
<li class="toctree-l1"><a class="reference internal" href="12_related_software.html">Related Software</a></li>
<li class="toctree-l1"><a class="reference internal" href="99_bibliography.html">References</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="API/krotov.html">API of the Krotov package</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Krotov</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Krotov Python Package</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<style>
/* CSS overrides for sphinx_rtd_theme */
/* 24px margin */
.nbinput.nblast.container,
.nboutput.nblast.container {
margin-bottom: 19px; /* padding has already 5px */
}
/* ... except between code cells! */
.nblast.container + .nbinput.container {
margin-top: -19px;
}
.admonition > p:before {
margin-right: 4px; /* make room for the exclamation icon */
}
/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
text-align: unset;
}
</style>
<div class="section" id="krotov-python-package">
<h1>Krotov Python Package<a class="headerlink" href="#krotov-python-package" title="Permalink to this headline">¶</a></h1>
<a class="reference external image-reference" href="https://github.com/qucontrol/krotov"><img alt="Source code on Github" src="https://img.shields.io/badge/github-qucontrol/krotov-blue.svg" /></a>
<a class="reference external image-reference" href="https://qucontrol.github.io/krotov"><img alt="Documentation" src="https://img.shields.io/badge/docs-doctr-blue.svg" /></a>
<a class="reference external image-reference" href="https://pypi.python.org/pypi/krotov"><img alt="Krotov on the Python Package Index" src="https://img.shields.io/pypi/v/krotov.svg" /></a>
<a class="reference external image-reference" href="https://gitter.im/qucontrol_krotov/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img alt="Join the chat at https://gitter.im/qucontrol_krotov/Lobby" src="https://badges.gitter.im/qucontrol_krotov/Lobby.svg" /></a>
<a class="reference external image-reference" href="https://travis-ci.org/qucontrol/krotov"><img alt="Travis Continuous Integration" src="https://img.shields.io/travis/qucontrol/krotov.svg" /></a>
<a class="reference external image-reference" href="https://ci.appveyor.com/project/goerz/krotov"><img alt="AppVeyor Continuous Integration" src="https://ci.appveyor.com/api/projects/status/1cbm24w04jmxjpjh?svg=true" /></a>
<a class="reference external image-reference" href="https://codecov.io/gh/qucontrol/krotov"><img alt="Codecov" src="https://codecov.io/gh/qucontrol/krotov/branch/master/graph/badge.svg" /></a>
<a class="reference external image-reference" href="https://opensource.org/licenses/BSD-3-Clause"><img alt="BSD License" src="https://img.shields.io/badge/License-BSD-green.svg" /></a>
<a class="reference external image-reference" href="https://mybinder.org/v2/gh/qucontrol/krotov/v1.2.0?filepath=docs%2Fnotebooks"><img alt="Launch Binder" src="https://mybinder.org/badge_logo.svg" /></a>
<a class="reference external image-reference" href="https://doi.org/10.21468/SciPostPhys.7.6.080"><img alt="DOI" src="https://img.shields.io/badge/DOI-10.21468/SciPostPhys.7.6.080-blue.svg" /></a>
<p>Python implementation of Krotov’s method for quantum optimal control.</p>
<p>This implementation follows the original implementation in the <a class="reference external" href="https://www.qdyn-library.net">QDYN Fortran library</a>.</p>
<p>The <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package is built on top of <a class="reference external" href="http://qutip.org">QuTiP</a>.</p>
<p>Development happens on <a class="reference external" href="https://github.com/qucontrol/krotov">Github</a>. You can read the full documentation <a class="reference external" href="https://qucontrol.github.io/krotov">online</a> or <a class="reference external" href="https://github.com/qucontrol/krotov/tree/master/docs/pdf">download a PDF version</a>.</p>
<p>If you use the <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package in your research, please <a class="reference internal" href="#citingkrotov"><span class="std std-ref">cite it</span></a>.</p>
<div class="section" id="purpose">
<h2>Purpose<a class="headerlink" href="#purpose" title="Permalink to this headline">¶</a></h2>
<p>Optimal control is a cornerstone of quantum technology: relying not
just on a passive understanding of quantum mechanics, but on the <em>active</em>
utilization of the quantum properties of matter. Quantum optimal control asks
how to manipulate the dynamics of a quantum system in some desired
way. This is essential for the realization of quantum computers and
related technologies such as quantum sensing.</p>
<p>Krotov’s method and GRAPE are the two leading gradient-based optimization
algorithms used in numerical quantum optimal control. Krotov’s method
distinguishes itself by guaranteeing monotonic convergence for near-continuous
control fields. This makes is particularly useful for exploring the limits of
controllability in a physical system.
While GRAPE is found in various software packages, there has not been an open
source implementation of Krotov’s method to date. Our package provides that
missing implementation.</p>
<p>The Krotov package targets both students wishing to enter the field
of quantum control and researchers in the field. It was designed towards
the following goals:</p>
<ul class="simple">
<li><p>Leverage the <a class="reference external" href="http://qutip.org">QuTiP</a> library as a platform for numerically describing
quantum systems.</p></li>
<li><p>Provide a collection of examples inspired by recent publications in
the <a class="reference external" href="https://jupyter.org">Jupyter notebook</a> format, allowing for interactive exploration of the
method.</p></li>
<li><p>Define a general interface for formulating <em>any</em> quantum control problem,
which may extend to other optimization methods in the future.</p></li>
<li><p>Serve as a reference implementation of Krotov’s method, and as a foundation
against which to test other implementations.</p></li>
<li><p>Enable the more widespread use of Krotov’s method, for example in the design
of experiments.</p></li>
</ul>
</div>
<div class="section" id="prerequisites">
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2>
<p>The Krotov package is available for Python versions >= 3.5. Its main dependency is <a class="reference external" href="http://qutip.org">QuTiP</a>
(apart from the <a class="reference external" href="https://www.scipy.org">core packages of the Python scientific ecosystem</a>).
Thus, you should consider <a class="reference external" href="http://qutip.org/docs/latest/installation.html">QuTiP’s installation instructions</a>.</p>
<p>In any case, using some sort of <a class="reference external" href="https://docs.python.org/3/glossary.html#term-virtual-environment">virtual environment</a> is strongly encouraged.
Most packages in the Python scientific ecosystem are now available as
<a class="reference external" href="https://packaging.python.org/tutorials/installing-packages/#source-distributions-vs-wheels">wheels</a>, making installation via <a class="reference external" href="https://pip.pypa.io">pip</a> easy. However, <a class="reference external" href="https://github.com/qutip/qutip/issues/933">QuTiP currently does
not provide wheels</a>. Thus, on systems that do not have the necessary compilers
installed (Windows, macOS), the <a class="reference external" href="https://conda.io/docs/index.html">conda</a> package manager provides a good solution.</p>
<p>Assuming <code class="docutils literal notranslate"><span class="pre">conda</span></code> is installed (e.g. through <a class="reference external" href="https://conda.io/miniconda.html">Miniconda</a>), the following
commands set up a virtual (conda) environment into which the Krotov package can
then be installed:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>conda create -n qucontrolenv <span class="s2">"python=3.7"</span>
conda activate qucontrolenv
conda config --append channels conda-forge
conda install qutip
</pre></div>
</div>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
<p>To install the latest released version of <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> into your current (conda)
environment, run this command in your terminal:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>python -m pip install krotov
</pre></div>
</div>
<p>This is the preferred method to install the <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package, as it will always install the most recent stable release.</p>
<p>You may also do</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>python -m pip install krotov<span class="o">[</span>dev,extras<span class="o">]</span>
</pre></div>
</div>
<p>to install additional development dependencies, including packages required to run the example notebooks.</p>
<p>If you don’t have <a class="reference external" href="https://pip.pypa.io">pip</a> installed, the <a class="reference external" href="http://docs.python-guide.org/en/latest/starting/installation/">Python installation guide</a>, respectively the <a class="reference external" href="https://packaging.python.org/tutorials/installing-packages/">Python Packaging User Guide</a> can guide
you through the process.</p>
<p>To install the latest development version of <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> from <a class="reference external" href="https://github.com/qucontrol/krotov">Github</a>:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>python -m pip install git+https://github.com/qucontrol/krotov.git@master#egg<span class="o">=</span>krotov
</pre></div>
</div>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>To use Krotov’s method for quantum optimal control in a Python script or
<a class="reference external" href="https://jupyter.org">Jupyter notebook</a>, start with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">krotov</span>
<span class="kn">import</span> <span class="nn">qutip</span>
</pre></div>
</div>
<p>Then,</p>
<ol class="arabic simple">
<li><p>define the necessary quantum operators and states using <a class="reference external" href="http://qutip.org">QuTiP</a>.</p></li>
<li><p>create a list of objectives, as instances of <a class="reference internal" href="API/krotov.objectives.html#krotov.objectives.Objective" title="krotov.objectives.Objective"><code class="xref py py-class docutils literal notranslate"><span class="pre">krotov.Objective</span></code></a>.</p></li>
<li><p>call <a class="reference internal" href="API/krotov.optimize.html#krotov.optimize.optimize_pulses" title="krotov.optimize.optimize_pulses"><code class="xref py py-func docutils literal notranslate"><span class="pre">krotov.optimize_pulses</span></code></a> to perform an optimization of an arbitrary
number of control fields over all the objectives.</p></li>
</ol>
<p>See <a class="reference internal" href="08_qutip_usage.html#using-krotov-with-qutip"><span class="std std-ref">Using Krotov with QuTiP</span></a> and <a class="reference internal" href="09_examples.html#krotov-example-notebooks"><span class="std std-ref">Examples</span></a> for details.</p>
</div>
<div class="section" id="citing-the-krotov-package">
<span id="citingkrotov"></span><h2>Citing the Krotov Package<a class="headerlink" href="#citing-the-krotov-package" title="Permalink to this headline">¶</a></h2>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Please cite the <a class="reference internal" href="API/krotov.html#module-krotov" title="krotov"><code class="xref py py-mod docutils literal notranslate"><span class="pre">krotov</span></code></a> package as</p>
<ul class="simple">
<li><p>M. H. Goerz <em>et al</em>., <em>Krotov: A Python implementation of Krotov’s method for quantum optimal control</em>, <a class="reference external" href="https://scipost.org/SciPostPhys.7.6.080">SciPost Phys. 7, 080</a> (2019)</p></li>
</ul>
</div>
<p>You can also print this from <code class="docutils literal notranslate"><span class="pre">krotov.__citation__</span></code>:</p>
<div class="highlight-pycon3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">krotov</span><span class="o">.</span><span class="n">__citation__</span><span class="p">)</span>
<span class="go">M. H. Goerz et al., Krotov: A Python implementation of Krotov's method for quantum optimal control, SciPost Phys. 7, 080 (2019)</span>
</pre></div>
</div>
<p>The corresponding BibTeX entry is available in <code class="docutils literal notranslate"><span class="pre">krotov.__bibtex__</span></code>:</p>
<div class="highlight-pycon3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">krotov</span><span class="o">.</span><span class="n">__bibtex__</span><span class="p">)</span>
<span class="go">@article{GoerzSPP2019,</span>
<span class="go"> author = {Michael H. Goerz and Daniel Basilewitsch and Fernando Gago-Encinas and Matthias G. Krauss and Karl P. Horn and Daniel M. Reich and Christiane P. Koch},</span>
<span class="go"> title = {Krotov: A {Python} implementation of {Krotov's} method for quantum optimal control},</span>
<span class="go"> journal={SciPost Phys.},</span>
<span class="go"> volume={7},</span>
<span class="go"> pages={80},</span>
<span class="go"> year={2019},</span>
<span class="go"> doi={10.21468/SciPostPhys.7.6.080},</span>
<span class="go">}</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="02_contributing.html" class="btn btn-neutral float-right" title="Contributing" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral float-left" title="Welcome to the Krotov package’s documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2020, Michael Goerz et al.
<span class="lastupdated">
Last updated on Aug 17, 2020.
</span>
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>