Fix noise in sparse_basic_3 (numerical cancellation)
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 30d3f1b..30bba3f 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -658,7 +658,8 @@
{
Index r = internal::random<Index>(0,rows-1);
Index c = internal::random<Index>(0,cols-1);
- Scalar v = internal::random<Scalar>();
+ // use positive values to prevent numerical cancellation errors in sum
+ Scalar v = numext::abs(internal::random<Scalar>());
triplets.push_back(TripletType(r,c,v));
sum += v;
}