add MAP estimation code, which doubles up as Laplace approximation.