mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Fix noise in sparse_basic_3 (numerical cancellation)
(grafted from cd25b538abff7370100ef5613b8138919f89c7b0 )
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…
x
Reference in New Issue
Block a user