'Given K and F, compute the value of deterministic entropy, which
is
.. math::
\sum_t \beta^t x_t\' K\'K x_t`
with
.. math::
x_{t+1} = (A - BF + CK) x_t
Parameters
F : array_like(float, ndim=2)
The policy function, a k x n array
K : array_like(float, ndim=2)
The worst case matrix, a j x n array
x0 : array_like(float, ndim=1)
The initial condition for state
Returns
e : scalar(int)
The deterministic entropy'

def compute_deterministic_entropy(self, F, K, x0):

    H0 = dot(K.T, K)
    C0 = np.zeros((self.n, 1))
    A0 = ((self.A - dot(self.B, F)) + dot(self.C, K))
    e = var_quadratic_sum(A0, C0, H0, self.beta, x0)
    return e
