Rank-Constrained Optimization: Algorithms And Applications