diff --git a/examples/imatrix/imatrix.cpp b/examples/imatrix/imatrix.cpp index 2e8437328..0cff9994d 100644 --- a/examples/imatrix/imatrix.cpp +++ b/examples/imatrix/imatrix.cpp @@ -343,8 +343,10 @@ bool IMatrixCollector::load_imatrix(const char * fname) { // Recreate the state as expected by save_imatrix(), and corerct for weighted sum. for (int i = 0; i < nval; i++) { - e.values[i] += tmp[i]; - e.counts[i] += ncall; + if (tmp[i]) { + e.values[i] += tmp[i]; + e.counts[i] += ncall; + } } e.ncall += ncall;