Commit 51b24d71 authored by Maximilian Schanner's avatar Maximilian Schanner
Browse files

slogdet fix

parent 6c735e84
...@@ -863,7 +863,7 @@ class Inversion: ...@@ -863,7 +863,7 @@ class Inversion:
""" """
dummy = np.linalg.slogdet(np.dot(self.h.T, self.h)) dummy = np.linalg.slogdet(np.dot(self.h.T, self.h))
logdet = np.sum(2*np.log(np.diag(self.L))) \ logdet = np.sum(2*np.log(np.diag(self.L))) \
+ dummy[0] * dummy[1] + dummy[1]
delta = np.sum(self.c**2) - np.linalg.multi_dot((self.c.T, delta = np.sum(self.c**2) - np.linalg.multi_dot((self.c.T,
self.h, self.h,
...@@ -872,7 +872,10 @@ class Inversion: ...@@ -872,7 +872,10 @@ class Inversion:
self.c)) self.c))
dummy = np.linalg.slogdet(self.cov_DIF_icmp) dummy = np.linalg.slogdet(self.cov_DIF_icmp)
logdet += dummy[0] * dummy[1] if 0 < dummy[0]:
logdet += dummy[1]
else:
raise ValueError("Covariance not positive definite.")
delta += np.linalg.multi_dot(((self.o_DIF_icmp - self.mu_DIF_icmp).T, delta += np.linalg.multi_dot(((self.o_DIF_icmp - self.mu_DIF_icmp).T,
self.prc_DIF_icmp, self.prc_DIF_icmp,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment