Tests: Bound random integer inputs in array_for_matrix to avoid overflow

In array_for_matrix, m1 and m2 were previously reduced modulo 1000 for integer scalars, leaving cv1, rv1, s1, and s2 spanning the full signed int range. Adding a bounded matrix entry to an unbounded vector or scalar entry caused signed integer overflow in colwise, rowwise, and scalar addition and subtraction checks.

In addition, the bound of 1000 allowed (m1 +- m2).squaredNorm() to exceed INT_MAX on large matrices up to EIGEN_TEST_MAX_SIZE, and random full-range integers in comparisons and cwise_min_max could hit INT_MIN or INT_MAX and overflow in +/- 1, abs() + 1, or unary negation.

Draw bounded integer inputs for all operands in array_for_matrix with a size-dependent cap that keeps 4 * rows * cols * max_abs^2 within NumTraits<Scalar>::highest(), exclude extreme values in comparisons and cwise_min_max, and add a deterministic max-size MatrixXi call to exercise the upper bound directly.
1 file changed