  Effective Hamiltonians arise in several problems, including homogenization of
Hamilton--Jacobi equations, nonlinear control systems, Hamiltonian dynamics,
and Aubry--Mather theory. In Aubry--Mather theory, related objects, Mather
measures, are also of great importance. Here, we combine ideas from mean-field
games with the Hessian Riemannian flow to compute effective Hamiltonians and
Mather measures simultaneously. We prove the convergence of the Hessian
Riemannian flow in the continuous setting. For the discrete case, we give both
the existence and the convergence of the Hessian Riemannian flow. In addition,
we explore a variant of Newton's method that greatly improves the performance
of the Hessian Riemannian flow. In our numerical experiments, we see that our
algorithms preserve the non-negativity of Mather measures and are more stable
than {related} methods in problems that are close to singular. Furthermore, our
method also provides a way to approximate stationary MFGs.
