@@ -13,7 +13,7 @@ export sinkhorn, sinkhorn2
1313export emd, emd2
1414export sinkhorn_stabilized, sinkhorn_stabilized_epsscaling, sinkhorn_barycenter
1515export sinkhorn_unbalanced, sinkhorn_unbalanced2
16- export ot_reg_plan
16+ export ot_reg_plan, ot_reg_cost
1717
1818const MOI = MathOptInterface
1919
@@ -534,6 +534,25 @@ function ot_reg_plan(mu, nu, C, eps; reg_func="L2", method="lorenz", kwargs...)
534534 end
535535end
536536
537+ """
538+ ot_reg_cost(mu, nu, C, eps; reg_func = "L2", method = "lorenz", kwargs...)
539+
540+ Compute the optimal transport cost between `mu` and `nu` for optimal transport with a
541+ general choice of regulariser `math Ω(γ)`.
542+
543+ See also: [`ot_reg_plan`](@ref)
544+
545+ """
546+ function ot_reg_cost (mu, nu, C, eps; reg_func= " L2" , method= " lorenz" , kwargs... )
547+ γ = if (reg_func == " L2" ) && (method == " lorenz" )
548+ quadreg (mu, nu, C, eps; kwargs... )
549+ else
550+ @warn " Unimplemented"
551+ nothing
552+ end
553+ return dot (γ, C)
554+ end
555+
537556
538557"""
539558 quadreg(mu, nu, C, ϵ; θ = 0.1, tol = 1e-5,maxiter = 50,κ = 0.5,δ = 1e-5)
0 commit comments