Update KUNN.m

optimize calculation of similarity