def followon_vector(P, G, di): """Compute the followon trace.""" assert (is_stochastic(P)) assert (is_diagonal(G)) I = np.eye(len(P)) return np.dot(np.linalg.inv(I - np.dot(G, P.T)), di)
def followon_vector(P, G, di): """Compute the followon trace.""" assert(is_stochastic(P)) assert(is_diagonal(G)) I = np.eye(len(P)) return np.dot(np.linalg.inv(I - np.dot(G, P.T)), di)
def bellman(P, G, r): """Compute the solution to the Bellman equation.""" assert (is_stochastic(P)) assert (is_diagonal(G)) I = np.eye(len(P)) return np.dot(np.linalg.inv(I - np.dot(G, P)), r)
def bellman(P,G,r): """Compute the solution to the Bellman equation.""" assert(is_stochastic(P)) assert(is_diagonal(G)) I = np.eye(len(P)) return np.dot(np.linalg.inv(I - np.dot(G,P)), r)