diff --git a/include/armadillo_bits/fn_accu.hpp b/include/armadillo_bits/fn_accu.hpp index 9886652e..f3dd4cd5 100644 --- a/include/armadillo_bits/fn_accu.hpp +++ b/include/armadillo_bits/fn_accu.hpp @@ -1162,10 +1162,14 @@ accu(const SpGlue& expr) if((x_it_col < y_it_col) || ((x_it_col == y_it_col) && (x_it_row < y_it_row))) // if y is closer to the end { + acc += (*x_it) * eT(0); // in case (*x_it) is inf or nan + ++x_it; } else // x is closer to the end { + acc += eT(0) * (*y_it); // in case (*y_it) is inf or nan + ++y_it; } }