I have this optimization problem: $$\min_v \sum_{v(i)v(j) \neq0} dist(\vec{x}_i,\vec{x}_j) , ~~ i=1...N$$ where $v$ is $N \times 1$.
Meaning that i calculate the sum of distances between pairs of $(\vec{x}_i,\vec{x}_j)$ if their relevant entries in $v$ are both non-zero.
Q:My question is how to calculate the gradient of the above objective function respect to $v$? or is it at all possible?