From fe21ef7920e61a8192c7dda25e3206024c56b0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigbj=C3=B8rn=20Skj=C3=A6ret?= Date: Thu, 13 Jun 2024 02:10:17 +0200 Subject: [PATCH] correct counts on load --- examples/imatrix/imatrix.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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;