Distance matrix helper spec

all specs passing