diff --git a/src/rmn.cpp b/src/rmn.cpp index 6a09cfd..de9cd60 100644 --- a/src/rmn.cpp +++ b/src/rmn.cpp @@ -101,8 +101,11 @@ void calcSumZ(const arma::vec& z, const arma::vec& empty, const arma::uvec& s, a sumZ(w, s(i)) += empty(i); sumZ(arma::span(w - 1 - i, w - 1), s(i)) += z(arma::span(0, i)); } - - } + for (; i < L; i++){ + sumZ(w, s(i)) += empty(i); + sumZ(arma::span(0, w - 1), s(i)) += z(arma::span(i - w + 1, i)); + } +} void calcLnEmPN(const arma::umat& u, const arma::uvec& s, const arma::mat& mu, arma::vec& lnEmPN){