Repository navigation
Expand file tree
/
Copy pathplot_screenkhorn_1D.html
More file actions
278 lines (232 loc) · 27.7 KB
/
Copy pathplot_screenkhorn_1D.html
File metadata and controls
278 lines (232 loc) · 27.7 KB
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
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>1D Screened optimal transport — POT Python Optimal Transport 0.8.2dev documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/sg_gallery.css" type="text/css" />
<link rel="stylesheet" href="../_static/sg_gallery-binder.css" type="text/css" />
<link rel="stylesheet" href="../_static/sg_gallery-dataframe.css" type="text/css" />
<link rel="stylesheet" href="../_static/sg_gallery-rendered-html.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" 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/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Regularized OT with generic solver" href="plot_optim_OTreg.html" />
<link rel="prev" title="1D optimal transport" href="plot_OT_1D.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"> POT Python Optimal Transport
<img src="../_static/logo_dark.svg" class="logo" alt="Logo"/>
</a>
<div class="version">
0.8.2dev
</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="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">POT: Python Optimal Transport</a></li>
<li class="toctree-l1"><a class="reference internal" href="../quickstart.html">Quick start guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../all.html">API and modules</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Examples gallery</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="index.html#ot-and-regularized-ot">OT and regularized OT</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="plot_OT_1D.html">1D optimal transport</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">1D Screened optimal transport</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#generate-data">Generate data</a></li>
<li class="toctree-l4"><a class="reference internal" href="#plot-distributions-and-loss-matrix">Plot distributions and loss matrix</a></li>
<li class="toctree-l4"><a class="reference internal" href="#solve-screenkhorn">Solve Screenkhorn</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="plot_optim_OTreg.html">Regularized OT with generic solver</a></li>
<li class="toctree-l3"><a class="reference internal" href="plot_OT_1D_smooth.html">1D smooth optimal transport</a></li>
<li class="toctree-l3"><a class="reference internal" href="plot_compute_emd.html">Plot multiple EMD</a></li>
<li class="toctree-l3"><a class="reference internal" href="plot_OT_2D_samples.html">2D Optimal transport between empirical distributions</a></li>
<li class="toctree-l3"><a class="reference internal" href="plot_stochastic.html">Stochastic examples</a></li>
<li class="toctree-l3"><a class="reference internal" href="plot_OT_L1_vs_L2.html">2D Optimal transport for different metrics</a></li>
<li class="toctree-l3"><a class="reference internal" href="plot_Intro_OT.html">Introduction to Optimal Transport with Python</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="index.html#pot-backend-examples">POT backend examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#wasserstein-barycenters">Wasserstein barycenters</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#domain-adaptation-examples">Domain adaptation examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#gromov-and-fused-gromov-wasserstein">Gromov and Fused-Gromov-Wasserstein</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#other-ot-problems">Other OT problems</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#sliced-wasserstein-distance">Sliced Wasserstein Distance</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#unbalanced-and-partial-ot">Unbalanced and Partial OT</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../releases.html">Releases</a></li>
<li class="toctree-l1"><a class="reference internal" href="../.github/CONTRIBUTING.html">Contributing to POT</a></li>
<li class="toctree-l1"><a class="reference internal" href="../.github/CODE_OF_CONDUCT.html">Code of Conduct</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">POT Python Optimal Transport</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> »</li>
<li><a href="index.html">Examples gallery</a> »</li>
<li>1D Screened optimal transport</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/auto_examples/plot_screenkhorn_1D.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="sphx-glr-download-link-note admonition note">
<p class="admonition-title">Note</p>
<p>Click <a class="reference internal" href="#sphx-glr-download-auto-examples-plot-screenkhorn-1d-py"><span class="std std-ref">here</span></a>
to download the full example code</p>
</div>
<section class="sphx-glr-example-title" id="d-screened-optimal-transport">
<span id="sphx-glr-auto-examples-plot-screenkhorn-1d-py"></span><h1>1D Screened optimal transport<a class="headerlink" href="#d-screened-optimal-transport" title="Permalink to this headline"></a></h1>
<p>This example illustrates the computation of Screenkhorn [26].</p>
<p>[26] Alaya M. Z., Bérar M., Gasso G., Rakotomamonjy A. (2019).
Screening Sinkhorn Algorithm for Regularized Optimal Transport,
Advances in Neural Information Processing Systems 33 (NeurIPS).</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Author: Mokhtar Z. Alaya <mokhtarzahdi.alaya@gmail.com></span>
<span class="c1">#</span>
<span class="c1"># License: MIT License</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">matplotlib.pylab</span> <span class="k">as</span> <span class="nn">pl</span>
<span class="kn">import</span> <span class="nn">ot.plot</span>
<span class="kn">from</span> <span class="nn">ot.datasets</span> <span class="kn">import</span> <span class="n">make_1D_gauss</span> <span class="k">as</span> <a href="../gen_modules/ot.datasets.html#ot.datasets.make_1D_gauss" title="ot.datasets.make_1D_gauss" class="sphx-glr-backref-module-ot-datasets sphx-glr-backref-type-py-function"><span class="n">gauss</span></a>
<span class="kn">from</span> <span class="nn">ot.bregman</span> <span class="kn">import</span> <a href="../gen_modules/ot.bregman.html#ot.bregman.screenkhorn" title="ot.bregman.screenkhorn" class="sphx-glr-backref-module-ot-bregman sphx-glr-backref-type-py-function"><span class="n">screenkhorn</span></a>
</pre></div>
</div>
<section id="generate-data">
<h2>Generate data<a class="headerlink" href="#generate-data" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">n</span></a> <span class="o">=</span> <span class="mi">100</span> <span class="c1"># nb bins</span>
<span class="c1"># bin positions</span>
<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">x</span></a> <span class="o">=</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.arange.html#numpy.arange" title="numpy.arange" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-function"><span class="n">np</span><span class="o">.</span><span class="n">arange</span></a><span class="p">(</span><a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">n</span></a><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><a href="https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.float64" title="numpy.float64" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-attribute"><span class="n">np</span><span class="o">.</span><span class="n">float64</span></a><span class="p">)</span>
<span class="c1"># Gaussian distributions</span>
<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">a</span></a> <span class="o">=</span> <a href="../gen_modules/ot.datasets.html#ot.datasets.make_1D_gauss" title="ot.datasets.make_1D_gauss" class="sphx-glr-backref-module-ot-datasets sphx-glr-backref-type-py-function"><span class="n">gauss</span></a><span class="p">(</span><a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">n</span></a><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="mi">20</span><span class="p">,</span> <span class="n">s</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> <span class="c1"># m= mean, s= std</span>
<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">b</span></a> <span class="o">=</span> <a href="../gen_modules/ot.datasets.html#ot.datasets.make_1D_gauss" title="ot.datasets.make_1D_gauss" class="sphx-glr-backref-module-ot-datasets sphx-glr-backref-type-py-function"><span class="n">gauss</span></a><span class="p">(</span><a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">n</span></a><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="mi">60</span><span class="p">,</span> <span class="n">s</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
<span class="c1"># loss matrix</span>
<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">M</span></a> <span class="o">=</span> <span class="n">ot</span><span class="o">.</span><span class="n">dist</span><span class="p">(</span><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">x</span></a><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">n</span></a><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">x</span></a><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">n</span></a><span class="p">,</span> <span class="mi">1</span><span class="p">)))</span>
<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">M</span></a> <span class="o">/=</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">M</span></a><span class="o">.</span><span class="n">max</span><span class="p">()</span>
</pre></div>
</div>
</section>
<section id="plot-distributions-and-loss-matrix">
<h2>Plot distributions and loss matrix<a class="headerlink" href="#plot-distributions-and-loss-matrix" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pl</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mf">6.4</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="n">pl</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">x</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">a</span></a><span class="p">,</span> <span class="s1">'b'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s1">'Source distribution'</span><span class="p">)</span>
<span class="n">pl</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">x</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">b</span></a><span class="p">,</span> <span class="s1">'r'</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s1">'Target distribution'</span><span class="p">)</span>
<span class="n">pl</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
<span class="c1"># plot distributions and loss matrix</span>
<span class="n">pl</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<a href="../gen_modules/ot.plot.html#ot.plot.plot1D_mat" title="ot.plot.plot1D_mat" class="sphx-glr-backref-module-ot-plot sphx-glr-backref-type-py-function"><span class="n">ot</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">plot1D_mat</span></a><span class="p">(</span><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">a</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">b</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">M</span></a><span class="p">,</span> <span class="s1">'Cost matrix M'</span><span class="p">)</span>
</pre></div>
</div>
<ul class="sphx-glr-horizontal">
<li><img src="../_images/sphx_glr_plot_screenkhorn_1D_001.png" srcset="../_images/sphx_glr_plot_screenkhorn_1D_001.png" alt="plot screenkhorn 1D" class = "sphx-glr-multi-img"/></li>
<li><img src="../_images/sphx_glr_plot_screenkhorn_1D_002.png" srcset="../_images/sphx_glr_plot_screenkhorn_1D_002.png" alt="Cost matrix M" class = "sphx-glr-multi-img"/></li>
</ul>
</section>
<section id="solve-screenkhorn">
<h2>Solve Screenkhorn<a class="headerlink" href="#solve-screenkhorn" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># Screenkhorn</span>
<a href="https://docs.python.org/3/library/functions.html#float" title="builtins.float" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">lambd</span></a> <span class="o">=</span> <span class="mf">2e-03</span> <span class="c1"># entropy parameter</span>
<a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">ns_budget</span></a> <span class="o">=</span> <span class="mi">30</span> <span class="c1"># budget number of points to be keeped in the source distribution</span>
<a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">nt_budget</span></a> <span class="o">=</span> <span class="mi">30</span> <span class="c1"># budget number of points to be keeped in the target distribution</span>
<a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">G_screen</span></a> <span class="o">=</span> <a href="../gen_modules/ot.bregman.html#ot.bregman.screenkhorn" title="ot.bregman.screenkhorn" class="sphx-glr-backref-module-ot-bregman sphx-glr-backref-type-py-function"><span class="n">screenkhorn</span></a><span class="p">(</span><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">a</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">b</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">M</span></a><span class="p">,</span> <a href="https://docs.python.org/3/library/functions.html#float" title="builtins.float" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">lambd</span></a><span class="p">,</span> <a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">ns_budget</span></a><span class="p">,</span> <a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">nt_budget</span></a><span class="p">,</span> <span class="n">uniform</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">restricted</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">verbose</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">pl</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<a href="../gen_modules/ot.plot.html#ot.plot.plot1D_mat" title="ot.plot.plot1D_mat" class="sphx-glr-backref-module-ot-plot sphx-glr-backref-type-py-function"><span class="n">ot</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">plot1D_mat</span></a><span class="p">(</span><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">a</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">b</span></a><span class="p">,</span> <a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray" class="sphx-glr-backref-module-numpy sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">G_screen</span></a><span class="p">,</span> <span class="s1">'OT matrix Screenkhorn'</span><span class="p">)</span>
<span class="n">pl</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
<img src="../_images/sphx_glr_plot_screenkhorn_1D_003.png" srcset="../_images/sphx_glr_plot_screenkhorn_1D_003.png" alt="OT matrix Screenkhorn" class = "sphx-glr-single-img"/><div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>/home/circleci/project/ot/bregman.py:3318: UserWarning: Bottleneck module is not installed. Install it from https://pypi.org/project/Bottleneck/ for better performance.
warnings.warn(
epsilon = 0.020986042861303855
kappa = 3.7476531411890917
Cardinality of selected points: |Isel| = 30 |Jsel| = 30
</pre></div>
</div>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.251 seconds)</p>
<div class="sphx-glr-footer class sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-screenkhorn-1d-py">
<div class="sphx-glr-download sphx-glr-download-python docutils container">
<p><a class="reference download internal" download="" href="../_downloads/73c2016cb9cdb2be0ad434512fdcf999/plot_screenkhorn_1D.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_screenkhorn_1D.py</span></code></a></p>
</div>
<div class="sphx-glr-download sphx-glr-download-jupyter docutils container">
<p><a class="reference download internal" download="" href="../_downloads/0b44922feb4f3003b50947c8876c0d76/plot_screenkhorn_1D.ipynb"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Jupyter</span> <span class="pre">notebook:</span> <span class="pre">plot_screenkhorn_1D.ipynb</span></code></a></p>
</div>
</div>
<p class="sphx-glr-signature"><a class="reference external" href="https://sphinx-gallery.github.io">Gallery generated by Sphinx-Gallery</a></p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="plot_OT_1D.html" class="btn btn-neutral float-left" title="1D optimal transport" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="plot_optim_OTreg.html" class="btn btn-neutral float-right" title="Regularized OT with generic solver" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2016-2021, Rémi Flamary, Nicolas Courty.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note"
aria-label="versions">
<!-- add shift_up to the class for force viewing -->
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Python Optimal Transport</span>
versions
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions"><!-- Inserted RTD Footer -->
<div class="injected">
<dl>
<dt>Versions</dt>
<dd><a href="https://pythonot.github.io/">Release</a></dd>
<dd><a href="https://pythonot.github.io/master">Development</a></dd>
</dl>
<dl>
<dt>On GitHub</dt>
<dd>
<a href="https://github.com/PythonOT/POT">Code on Github</a>
</dd>
</dl>
<hr>
</div>
</div>
</div><script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>