Fix noise in sparse_basic_3 (numerical cancellation)
(grafted from cd25b538ab
)
This commit is contained in:
parent
c285ed1033
commit
204d1f1456
@ -630,7 +630,8 @@ void big_sparse_triplet(Index rows, Index cols, double density) {
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user