Open MuellerSeb opened 4 years ago
Hi,
Thanks !
If your issue is with performance, #26 added the haversine_vector
function to optimize performance.
You can see how to use it in the documentation
If that's not performance-related, can you explain why you need this ?
cdist is constructing a n times m matrix for two input arrays with n and m points respectively. The vector version does not do this.
OK so let me rephrase to make sure I understand your needs :
You have a list of geopoints, and you need to calculate the distance between every points :
pseudo-code :
LYON = (45.7597, 4.8422)
PARIS = (48.8567, 2.3508)
NEW_YORK = (40.7033962, -74.2351462)
calculate_each_distances([LYON, PARIS, NEW_YORK])
and the output should be something like that :
[
[ 0, 392, 6163],
[ 392, 0, 5853],
[ 6163, 5853, 0],
]
Is that it ?
Almost. This is the pdist functionality.
One step further is, to provide two lists of points for rows and cols in the resulting matrix.
This already exists, see https://github.com/mapado/haversine/blob/0b47ac417d82c4ae15ba49c7856453bf81afa1b9/tests/test_haversine_vector.py#L21-L30
However, I believe the comb
parameter is not clear from the docstring (one needs to read the implementation).
@jdeniau do you mind if I rework the docstring a bit?
@Noezor help yourself! Every improvement in the documentation is helpful 👍
Hey there,
nice package! I was wondering, if you could implement a routine to compute a pairwise distance matrix like
scipy.spatial.distance.cdist
does.Cheers, Sebastian