// ComputeCentroids Needs comments. func ComputeCentroid(mat *matrix.DenseMatrix) (*matrix.DenseMatrix, error) { rows, _ := mat.GetSize() vectorSum := mat.SumCols() if rows == 0 { return vectorSum, errors.New("No points inputted") } vectorSum.Scale(1.0 / float64(rows)) return vectorSum, nil }