The optimal regulation of generalized state-space systems with quadratic cost