Example #1
0
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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
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)