This package contains a variety of distance functions written in Futhark. They are heavily inspired by the corresponding functions in SciPy.
$ futhark pkg add github.com/athas/distance
$ futhark pkg sync
$ futhark repl
> import "lib/github.com/athas/distance/distance"
> module vector = any_vector { let length = 2 }
> module euclidean32 = mk_euclidean f32 vector
> euclidean32.distance (vector.from_array [0,0]) (vector.from_array [1,1])
1.4142135f32