Skip to content

Commit 9ac7601

Browse files
committed
Add doctest in mm_unbalanced function
1 parent 1ff7c02 commit 9ac7601

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/lib.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,27 @@ This function is a wrapper of the function
541541
[`mm_unbalanced`](https://pythonot.github.io/gen_modules/ot.unbalanced.html#ot.unbalanced.mm_unbalanced) in the
542542
Python Optimal Transport package. Keyword arguments are listed in the documentation of the
543543
Python function.
544+
545+
# Examples
546+
547+
```jldoctest
548+
julia> a=[.5, .5];
549+
550+
julia> b=[.5, .5];
551+
552+
julia> M=[1. 36.; 9. 4.];
553+
554+
julia> round.(mm_unbalanced(a, b, M, 5, div="kl"), digits=2)
555+
2×2 Matrix{Float64}:
556+
0.45 0.0
557+
0.0 0.34
558+
559+
julia> round.(mm_unbalanced(a, b, M, 5, div="l2"), digits=2)
560+
2×2 Matrix{Float64}:
561+
0.4 0.0
562+
0.0 0.1
563+
```
564+
544565
"""
545566
function mm_unbalanced(a, b, M, reg_m; kwargs...)
546567
return pot.unbalanced.mm_unbalanced(a, b, M, reg_m; kwargs...)

0 commit comments

Comments
 (0)