Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -9,50 +9,46 @@
#include "main.h"
template<typename Scalar> void special_numbers()
{
typedef Matrix<Scalar, Dynamic,Dynamic> MatType;
int rows = internal::random<int>(1,300);
int cols = internal::random<int>(1,300);
template <typename Scalar>
void special_numbers() {
typedef Matrix<Scalar, Dynamic, Dynamic> MatType;
int rows = internal::random<int>(1, 300);
int cols = internal::random<int>(1, 300);
Scalar nan = std::numeric_limits<Scalar>::quiet_NaN();
Scalar inf = std::numeric_limits<Scalar>::infinity();
Scalar s1 = internal::random<Scalar>();
MatType m1 = MatType::Random(rows,cols),
mnan = MatType::Random(rows,cols),
minf = MatType::Random(rows,cols),
mboth = MatType::Random(rows,cols);
int n = internal::random<int>(1,10);
for(int k=0; k<n; ++k)
{
mnan(internal::random<int>(0,rows-1), internal::random<int>(0,cols-1)) = nan;
minf(internal::random<int>(0,rows-1), internal::random<int>(0,cols-1)) = inf;
MatType m1 = MatType::Random(rows, cols), mnan = MatType::Random(rows, cols), minf = MatType::Random(rows, cols),
mboth = MatType::Random(rows, cols);
int n = internal::random<int>(1, 10);
for (int k = 0; k < n; ++k) {
mnan(internal::random<int>(0, rows - 1), internal::random<int>(0, cols - 1)) = nan;
minf(internal::random<int>(0, rows - 1), internal::random<int>(0, cols - 1)) = inf;
}
mboth = mnan + minf;
VERIFY(!m1.hasNaN());
VERIFY(m1.allFinite());
VERIFY(mnan.hasNaN());
VERIFY((s1*mnan).hasNaN());
VERIFY((s1 * mnan).hasNaN());
VERIFY(!minf.hasNaN());
VERIFY(!(2*minf).hasNaN());
VERIFY(!(2 * minf).hasNaN());
VERIFY(mboth.hasNaN());
VERIFY(mboth.array().hasNaN());
VERIFY(!mnan.allFinite());
VERIFY(!minf.allFinite());
VERIFY(!(minf-mboth).allFinite());
VERIFY(!(minf - mboth).allFinite());
VERIFY(!mboth.allFinite());
VERIFY(!mboth.array().allFinite());
}
EIGEN_DECLARE_TEST(special_numbers)
{
for(int i = 0; i < 10*g_repeat; i++) {
CALL_SUBTEST_1( special_numbers<float>() );
CALL_SUBTEST_1( special_numbers<double>() );
EIGEN_DECLARE_TEST(special_numbers) {
for (int i = 0; i < 10 * g_repeat; i++) {
CALL_SUBTEST_1(special_numbers<float>());
CALL_SUBTEST_1(special_numbers<double>());
}
}