2016-12-05 22:15:40 +01:00
|
|
|
vecl =: +/"1&.:*: NB. length of each vector
|
2013-04-10 21:29:02 -07:00
|
|
|
dist =: <@:vecl@:({: -"1 }:)\ NB. calculate all distances among vectors
|
|
|
|
|
minpair=: ({~ > {.@($ #: I.@,)@:= <./@;)dist NB. find one pair of the closest points
|
|
|
|
|
closestpairbf =: (; vecl@:-/)@minpair NB. the pair and their distance
|