JL: Changed lq to be right order for solve_discrete_ricatti