'Given a policy `sigma`, return the reward vector `R_sigma` and
the transition probability matrix `Q_sigma`.
Parameters
sigma : array_like(int, ndim=1)
Policy vector, of length n.
Returns
R_sigma : ndarray(float, ndim=1)
Reward vector for `sigma`, of length n.
Q_sigma : ndarray(float, ndim=2)
Transition probability matrix for `sigma`, of shape (n, n).'

def RQ_sigma(self, sigma):

    if self._sa_pair:
        sigma = np.asarray(sigma)
        sigma_indices = np.empty(self.num_states, dtype=int)
        _find_indices(self.a_indices, self.a_indptr, sigma, out=sigma_indices)
        (R_sigma, Q_sigma) = (self.R[sigma_indices], self.Q[sigma_indices])
    else:
        R_sigma = self.R[(np.arange(self.num_states), sigma)]
        Q_sigma = self.Q[(np.arange(self.num_states), sigma)]
    return (R_sigma, Q_sigma)
