summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwreise <wojciech.reise@epfl.ch>2022-10-15 17:00:25 +0200
committerwreise <wojciech.reise@epfl.ch>2022-10-15 17:00:25 +0200
commit74617f0673aa13bce47833c366321a8838a7d123 (patch)
treead04bc8a575d6aeeeae1eaa83f3da0d6c2dbb2ad
parent80edbbaccc344abfa18ebc48a8493f747a775476 (diff)
Remove old lines
-rw-r--r--src/python/gudhi/representations/vector_methods.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py
index 3a91eccd..6267e077 100644
--- a/src/python/gudhi/representations/vector_methods.py
+++ b/src/python/gudhi/representations/vector_methods.py
@@ -179,10 +179,8 @@ class Landscape(BaseEstimator, TransformerMixin):
midpoints, heights = (diag[:, 0] + diag[:, 1]) / 2., (diag[:, 1] - diag[:, 0]) / 2.
tent_functions = np.maximum(heights[None, :] - np.abs(x_values[:, None] - midpoints[None, :]), 0)
n_points = diag.shape[0]
- # Get indices of largest elements: can't take more than n_points - 1 (the last ones are in the right position)
- argpartition = np.argpartition(-tent_functions, min(self.num_landscapes, n_points-1), axis=1)
- landscapes = np.take_along_axis(tent_functions, argpartition, axis=1)
- landscapes = landscapes[:, :min(self.num_landscapes, n_points)].T
+ tent_functions.partition(n_points-self.num_landscapes, axis=1)
+ landscapes = np.sort(tent_functions[:, -self.num_landscapes:], axis=1)[:, ::-1].T
# Complete the array with zeros to get the right number of landscapes
if self.num_landscapes > n_points: