summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Hsu <linhsu0723@qq.com>2023-03-21 00:12:48 -0700
committerGitHub <noreply@github.com>2023-03-21 08:12:48 +0100
commitc48cd76235569ada98af6b1bba589510a2818906 (patch)
tree4268ca518b04f6b6bc2fdee1f6835ea7e2b629b1
parent583501652517c4f1dbd8572e9f942551a9e54a1f (diff)
[MRG] Remove redundant abs() (#448)
* Remove redundant abs() * Update RELEASES.md
-rw-r--r--RELEASES.md4
-rw-r--r--ot/lp/solver_1d.py2
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)