mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-22 01:29:35 +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 r = internal::random<Index>(0,rows-1);
|
||||||
Index c = internal::random<Index>(0,cols-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));
|
triplets.push_back(TripletType(r,c,v));
|
||||||
sum += v;
|
sum += v;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user