示例#1
0
 def _get_cplusninvdoty(self):
     # now we want cpnmatrix^(-1)*mag = x, which is the same as
     #    mag = cpnmatrix*x, so we solve this equation for x
     self.cplusninvdoty = chosolve_from_tri(self.U,
                                            self.md,
                                            nugget=None,
                                            inplace=False)
示例#2
0
 def _fastpredict(self, jw, iw, set_threading=False):
     """ jw : jwant
         iw : iwant
     """
     mw = np.zeros_like(jw)
     vw = np.zeros_like(jw)
     for i, (jwant, iwant) in enumerate(zip(jw, iw)):
         if set_threading:
             covar = spear_threading(jwant, self.jd, iwant + 1, self.id + 1,
                                     **self.covparams)
         else:
             covar = spear(jwant, self.jd, iwant + 1, self.id + 1,
                           **self.covparams)
         cplusninvdotcovar = chosolve_from_tri(self.U,
                                               covar.T,
                                               nugget=None,
                                               inplace=False)
         if set_threading:
             vw[i] = spear_threading(jwant, jwant, iwant + 1, iwant + 1,
                                     **self.covparams)
         else:
             vw[i] = spear(jwant, jwant, iwant + 1, iwant + 1,
                           **self.covparams)
         mw[i] = np.dot(covar, self.cplusninvdoty)
         vw[i] = vw[i] - np.dot(covar, cplusninvdotcovar)
     return (mw, vw)