K-means Loss Calculation

@tom Can you please explain a bit on how exactly should this be done? And is there some advantage of using broadcasting over repeat ?