How to calculate similarity between users

See this e.g from Pawan Cond in func not work as I suppose