mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #698: rewrite LinSpaced for integer scalar types to avoid overflow and guarantee an even spacing when possible.
Otherwise, the "high" bound is implicitly lowered to the largest value allowing for an even distribution. This changeset also disable vectorization for this integer path.
This commit is contained in:
8
doc/snippets/DenseBase_LinSpacedInt.cpp
Normal file
8
doc/snippets/DenseBase_LinSpacedInt.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
cout << "Even spacing inputs:" << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,4).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,8).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,15).transpose() << endl;
|
||||
cout << "Uneven spacing inputs:" << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,7).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,9).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,16).transpose() << endl;
|
||||
Reference in New Issue
Block a user