def _compute_stationary(self):
        """
        Store the stationary distributions in self._stationary_distributions.

        """
        if self.is_irreducible:
            if not self.is_sparse:  # Dense
                stationary_dists = gth_solve(self.P).reshape(1, self.n)
            else:  # Sparse
                stationary_dists = \
                    gth_solve(self.P.toarray(),
                              overwrite=True).reshape(1, self.n)
        else:
            rec_classes = self.recurrent_classes_indices
            stationary_dists = np.zeros((len(rec_classes), self.n))
            for i, rec_class in enumerate(rec_classes):
                P_rec_class = self.P[np.ix_(rec_class, rec_class)]
                if self.is_sparse:
                    P_rec_class = P_rec_class.toarray()
                stationary_dists[i, rec_class] = \
                    gth_solve(P_rec_class, overwrite=True)

        self._stationary_dists = stationary_dists