Add rank_k_approximation() and its tests.