Skip to content

Commit

Permalink
added more stable final inversion for W
Browse files Browse the repository at this point in the history
  • Loading branch information
tonymugen committed Oct 9, 2020
1 parent cccf220 commit 5f7fdd4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/gmmvb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,12 @@ void GmmVB::fitModel(vector<double> &logPost, double &dic) {
// scale the inverse covariance and invert
for (size_t m = 0; m < M_.getNrows(); m++) { // scale the inverse-covariance
W_[m] *= nu0p1_ + (*N_)[m];
W_[m].chol();
W_[m].cholInv();
try {
W_[m].chol();
W_[m].cholInv();
} catch (string problem) {
W_[m].pseudoInv();
}
}
}

Expand Down Expand Up @@ -477,8 +481,12 @@ void GmmVBmiss::fitModel(vector<double> &logPost, double &dic){
// scale the inverse covariance and invert
for (size_t m = 0; m < M_.getNrows(); m++) { // scale the inverse-covariance
W_[m] *= nu0p1_ + (*N_)[m];
W_[m].chol();
W_[m].cholInv();
try {
W_[m].chol();
W_[m].cholInv();
} catch (string problem) {
W_[m].pseudoInv();
}
}
}

Expand Down

0 comments on commit 5f7fdd4

Please sign in to comment.