Fast optimization of the exact likelihood of AR and ARMA processes