def F(self): if not hasattr(self, "_F"): F = np.zeros_like(self.P) for i, p in enumerate(self.P): F[i] = fmpt(np.asarray(p)) self._F = np.asarray(F) return self._F
def get_mfpt(x): """Calculate mean-first-passage time of a given transition matrix. Set self-transitions to zero. Note that the pysal code (ergodic.py) calls it "first-mean-passage-time".""" # NB! The ergodic code expects a matrix, not a numpy array. Breaks # otherwise. x = np.matrix(x) x = np.array(ergodic.fmpt(x)) set_self_transition_zero(x) return x
def fmpt(self): if not hasattr(self, "_fmpt"): self._fmpt = fmpt(self.p, fill_empty_classes=True) return self._fmpt
def f(self): if not hasattr(self, "_f"): self._f = fmpt(self.p) return self._f