@@ -69,6 +69,78 @@ function emd2(μ, ν, C; kwargs...)
6969 return pot. lp. emd2 (μ, ν, PyCall. PyReverseDims (permutedims (C)); kwargs... )
7070end
7171
72+ """
73+ emd_1d(xsource, xtarget; kwargs...)
74+
75+ Compute the optimal transport plan for the Monge-Kantorovich problem with univariate
76+ discrete measures with support `xsource` and `xtarget` as source and target marginals.
77+
78+ This function is a wrapper of the function
79+ [`emd_1d`](https://pythonot.github.io/all.html#ot.emd_1d) in the Python Optimal Transport
80+ package. Keyword arguments are listed in the documentation of the Python function.
81+
82+ # Examples
83+
84+ ```jldoctest
85+ julia> xsource = [0.2, 0.5];
86+
87+ julia> xtarget = [0.8, 0.3];
88+
89+ julia> emd_1d(xsource, xtarget)
90+ 2×2 Matrix{Float64}:
91+ 0.0 0.5
92+ 0.5 0.0
93+
94+ julia> histogram_source = [0.8, 0.2];
95+
96+ julia> histogram_target = [0.7, 0.3];
97+
98+ julia> emd_1d(xsource, xtarget; a=histogram_source, b=histogram_target)
99+ 2×2 Matrix{Float64}:
100+ 0.5 0.3
101+ 0.2 0.0
102+ ```
103+
104+ See also: [`emd`](@ref), [`emd2_1d`](@ref)
105+ """
106+ function emd_1d (xsource, xtarget; kwargs... )
107+ return pot. lp. emd_1d (xsource, xtarget; kwargs... )
108+ end
109+
110+ """
111+ emd2_1d(xsource, xtarget; kwargs...)
112+
113+ Compute the optimal transport cost for the Monge-Kantorovich problem with univariate
114+ discrete measures with support `xsource` and `xtarget` as source and target marginals.
115+
116+ This function is a wrapper of the function
117+ [`emd2_1d`](https://pythonot.github.io/all.html#ot.emd2_1d) in the Python Optimal Transport
118+ package. Keyword arguments are listed in the documentation of the Python function.
119+
120+ # Examples
121+
122+ ```jldoctest
123+ julia> xsource = [0.2, 0.5];
124+
125+ julia> xtarget = [0.8, 0.3];
126+
127+ julia> round(emd2_1d(xsource, xtarget); sigdigits=6)
128+ 0.05
129+
130+ julia> histogram_source = [0.8, 0.2];
131+
132+ julia> histogram_target = [0.7, 0.3];
133+
134+ julia> round(emd2_1d(xsource, xtarget; a=histogram_source, b=histogram_target); sigdigits=6)
135+ 0.201
136+ ```
137+
138+ See also: [`emd2`](@ref), [`emd2_1d`](@ref)
139+ """
140+ function emd2_1d (xsource, xtarget; kwargs... )
141+ return pot. lp. emd2_1d (xsource, xtarget; kwargs... )
142+ end
143+
72144"""
73145 sinkhorn(μ, ν, C, ε; kwargs...)
74146
0 commit comments