  Let $S(A)$ denote the orbit of a complex or real matrix $A$ under a certain
equivalence relation such as unitary similarity, unitary equivalence, unitary
congruences etc. Efficient gradient-flow algorithms are constructed to
determine the best approximation of a given matrix $A_0$ by the sum of matrices
in $S(A_1), ..., S(A_N)$ in the sense of finding the Euclidean least-squares
distance $$\min \{\|X_1+ ... + X_N - A_0\|: X_j \in S(A_j), j = 1, >..., N\}.$$
Connections of the results to different pure and applied areas are discussed.
