/** For debugging reasons*/ void checkAllComponents() { arma::vec rowSumA = arma::sum(A_, 1); rowSumA.print("rowSumA"); double sumPi = arma::sum(pi_); std::cout << "sumPi: " << sumPi << std::endl; arma::vec weights = arma::zeros((unsigned int)BModels_.size()); for (unsigned int i = 0; i < (unsigned int) BModels_.size(); ++i) { weights(i) = arma::accu(BModels_[i].getWeights()); } weights.print("bCumWeights"); arma::rowvec checksum = arma::sum(gamma_); checksum.print("checksum"); arma::uvec checksumIndices = arma::find(checksum < 1.0 - 1E-2); if (checksumIndices.n_elem >= 1) { arma::rowvec checksumAlpha = arma::sum(alpha_); checksumAlpha.print("checkAlpha"); //alpha_.print("alpha"); arma::rowvec checksumBeta = arma::sum(beta_); checksumBeta.print("checkBeta"); //beta_.print("beta"); c_.print("c"); throw std::runtime_error("data going wonky"); } if (!arma::is_finite(A_)) { A_.print("A Fail"); throw std::runtime_error("A has invalid entries"); } if (!arma::is_finite(pi_)) { pi_.print("pi Fail"); throw std::runtime_error("pi has invalid entries"); } if (!arma::is_finite(alpha_)) { alpha_.print("alpha Fail"); throw std::runtime_error("alpha has invalid entries"); } if (!arma::is_finite(beta_)) { beta_.print("beta Fail"); throw std::runtime_error("beta has invalid entries"); } if (!arma::is_finite(gamma_)) { gamma_.print("gamma Fail"); throw std::runtime_error("gamma has invalid entries"); } if (!arma::is_finite(xi_)) { xi_.print("xi Fail"); throw std::runtime_error("xi has invalid entries"); } }
void print(std::string header = "") { A_.print("A"); for (size_t i = 0; i < BModels_.size(); ++i) { BModels_[i].print("B"); } pi_.print("pi"); }