matrix multiplication, factorisation framework for k-means