# Computation of the Gradients

    library(rwig) |> suppressPackageStartupMessages()

To set up the computation for the `sinkhorn()` and `barycenter()` algorithms, you will need to set `with_grad = TRUE` for `sinkhorn_control` and `barycenter_control`.

The exact formulae of gradients were given by Xie (2025), and have been checked by the Automatic Differentiation library `ForwardDiff` in Julia.

## See Also

See also `vignette("sinkhorn")`, `vignette("barycenter")`.

## References

Xie, F. (2025). Deriving the Gradients of Some Popular Optimal Transport Algorithms (No. arXiv:2504.08722). arXiv. https://doi.org/10.48550/arXiv.2504.08722