How to use the quantecon.markov.gth_solve.gth_solve function in quantecon

To help you get started, we’ve selected a few quantecon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QuantEcon / QuantEcon.py / quantecon / markov / core.py View on Github external
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
github QuantEcon / QuantEcon.py / quantecon / markov / core.py View on Github external
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
github QuantEcon / QuantEcon.py / quantecon / markov / core.py View on Github external
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