Metric Learning on Manifolds