mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Fix noise in sparse_basic_3 (numerical cancellation)
This commit is contained in:
parent
efaf03bf96
commit
cd25b538ab
@ -658,7 +658,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