Mercurial > hg > GlobalNeighbors
comparison globalneighbors/distance.py @ 6:316e1d54ffd4
move to jinja templates
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 24 Jun 2017 15:47:59 -0700 |
parents | 7e27e874655b |
children | 254195d0bac2 |
comparison
equal
deleted
inserted
replaced
5:7e27e874655b | 6:316e1d54ffd4 |
---|---|
45 if len(distances) == k+1: | 45 if len(distances) == k+1: |
46 distances.pop() | 46 distances.pop() |
47 break | 47 break |
48 else: | 48 else: |
49 distances.append((i, new_distance)) | 49 distances.append((i, new_distance)) |
50 | |
51 # def insert_distance(distances, i, new_distance, k): | |
52 # if not distances: | |
53 # distances.append((i, new_distance)) | |
54 # return | |
55 # if new_distance >= distances[-1][-1]: | |
56 # if len(distances) < k: | |
57 # distances.append((i, new_distance)) | |
58 # return | |
50 | 59 |
51 | 60 |
52 def calculate_distances(locations, r=Rearth): | 61 def calculate_distances(locations, r=Rearth): |
53 """ | 62 """ |
54 WARNING! This is an N-squared approach | 63 WARNING! This is an N-squared approach |