code: def F_to_K(self, F, method='doubling'):
          
          Q2 = self.beta * self.theta
          R2 = - self.R - dot(F.T, dot(self.Q, F))
          A2 = self.A - dot(self.B, F)
          B2 = self.C
          lq = LQ(Q2, R2, A2, B2, beta=self.beta)
          neg_P, neg_K, d = lq.stationary_values(method=method)
  
          return -neg_K, -neg_P
docs: Compute agent 2's best cost-minimizing response K, given F.
  
          Parameters
          ----------
          F : array_like(float, ndim=2)
              A k x n array
          method : str, optional(default='doubling')
              Solution method used in solving the associated Riccati
              equation, str in {'doubling', 'qz'}.
  
          Returns
          -------
          K : array_like(float, ndim=2)
              Agent's best cost minimizing response for a given F
          P : array_like(float, ndim=2)
              The value function for a given F