mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
fix singed integer overflow UB in integer_types and other trivial compiler warnings
libeigen/eigen!2380
This commit is contained in:
11
test/main.h
11
test/main.h
@@ -902,6 +902,17 @@ void setRandomDataInRange(DataContainer& data_container, typename DataContainer:
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
template <typename MatrixType, typename Scalar = typename MatrixType::Scalar>
|
||||
MatrixType RandomMatrix(Index rows, Index cols, Scalar min, Scalar max) {
|
||||
MatrixType M = MatrixType(rows, cols);
|
||||
for (Index i = 0; i < rows; ++i) {
|
||||
for (Index j = 0; j < cols; ++j) {
|
||||
M(i, j) = Eigen::internal::random<Scalar>(min, max);
|
||||
}
|
||||
}
|
||||
return M;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set number of repetitions for unit test from input string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user