Optimization on manifolds: A symplectic approach