  We present structure preserving integrators for solving linear quadratic
optimal control problems. This problem requires the numerical integration of
matrix Riccati differential equations whose exact solution is a symmetric
positive definite time-dependent matrix which controls the stability of the
equation for the state. This property is not preserved, in general, by the
numerical methods. We propose second order exponential methods based on the
Magnus series expansion which unconditionally preserve positivity for this
problem and analyze higher order Magnus integrators. This method can also be
used for the integration of nonlinear problems if they are previously
linearized. The performance of the algorithms is illustrated with the
stabilization of a quadrotor which is an unmanned aerial vehicle.
