From c48cd76235569ada98af6b1bba589510a2818906 Mon Sep 17 00:00:00 2001 From: Lin Hsu Date: Tue, 21 Mar 2023 00:12:48 -0700 Subject: [MRG] Remove redundant abs() (#448) * Remove redundant abs() * Update RELEASES.md --- RELEASES.md | 4 ++-- ot/lp/solver_1d.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index b6e12d9..5d966c2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -17,8 +17,8 @@ - Backend version of `ot.partial` and `ot.smooth` (PR #388) - Added argument for warmstart of dual potentials in Sinkhorn-based methods in `ot.bregman` (PR #437) - Add parameters method in `ot.da.SinkhornTransport` (PR #440) -- `ot.dr` now uses the new Pymanopt API and POT is compatible with current - Pymanopt (PR #443) +- `ot.dr` now uses the new Pymanopt API and POT is compatible with current Pymanopt (PR #443) +- Remove the redundant `nx.abs()` at the end of `wasserstein_1d()` (PR #448) #### Closed issues diff --git a/ot/lp/solver_1d.py b/ot/lp/solver_1d.py index e7add89..bcfc920 100644 --- a/ot/lp/solver_1d.py +++ b/ot/lp/solver_1d.py @@ -129,7 +129,7 @@ def wasserstein_1d(u_values, v_values, u_weights=None, v_weights=None, p=1, requ diff_quantiles = nx.abs(u_quantiles - v_quantiles) if p == 1: - return nx.sum(delta * nx.abs(diff_quantiles), axis=0) + return nx.sum(delta * diff_quantiles, axis=0) return nx.sum(delta * nx.power(diff_quantiles, p), axis=0) -- cgit v1.2.3