Global objective function and gradient computations with respect to cluster centroid vectors and their weights.
Gradient_cpp(x, SK, W, K)
is a data vector. Its first K*n components are cluster centroids and its last K components are the centroid weights.
is a data sketch vector.
is a frequency matrix.
is a number of cluster centroids.
gradient
is a gradient vector
objective
is an objective function value \(\|SK - \sum_{k=1}^K \alpha_k Sketch(c_k, W)\|\)