mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clang-format tests, examples, libraries, benchmarks, etc.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
3252ecc7a4
commit
46e9cdb7fe
@@ -11,16 +11,12 @@
|
||||
#include "main.h"
|
||||
#include <Eigen/SVD>
|
||||
|
||||
template<typename MatrixType, typename JacobiScalar>
|
||||
void jacobi(const MatrixType& m = MatrixType())
|
||||
{
|
||||
template <typename MatrixType, typename JacobiScalar>
|
||||
void jacobi(const MatrixType& m = MatrixType()) {
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
enum {
|
||||
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||
ColsAtCompileTime = MatrixType::ColsAtCompileTime
|
||||
};
|
||||
enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime };
|
||||
|
||||
typedef Matrix<JacobiScalar, 2, 1> JacobiVector;
|
||||
|
||||
@@ -31,10 +27,10 @@ void jacobi(const MatrixType& m = MatrixType())
|
||||
JacobiRotation<JacobiScalar> rot(c, s);
|
||||
|
||||
{
|
||||
Index p = internal::random<Index>(0, rows-1);
|
||||
Index p = internal::random<Index>(0, rows - 1);
|
||||
Index q;
|
||||
do {
|
||||
q = internal::random<Index>(0, rows-1);
|
||||
q = internal::random<Index>(0, rows - 1);
|
||||
} while (q == p);
|
||||
|
||||
MatrixType b = a;
|
||||
@@ -44,10 +40,10 @@ void jacobi(const MatrixType& m = MatrixType())
|
||||
}
|
||||
|
||||
{
|
||||
Index p = internal::random<Index>(0, cols-1);
|
||||
Index p = internal::random<Index>(0, cols - 1);
|
||||
Index q;
|
||||
do {
|
||||
q = internal::random<Index>(0, cols-1);
|
||||
q = internal::random<Index>(0, cols - 1);
|
||||
} while (q == p);
|
||||
|
||||
MatrixType b = a;
|
||||
@@ -57,28 +53,28 @@ void jacobi(const MatrixType& m = MatrixType())
|
||||
}
|
||||
}
|
||||
|
||||
EIGEN_DECLARE_TEST(jacobi)
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1(( jacobi<Matrix3f, float>() ));
|
||||
CALL_SUBTEST_2(( jacobi<Matrix4d, double>() ));
|
||||
CALL_SUBTEST_3(( jacobi<Matrix4cf, float>() ));
|
||||
CALL_SUBTEST_3(( jacobi<Matrix4cf, std::complex<float> >() ));
|
||||
EIGEN_DECLARE_TEST(jacobi) {
|
||||
for (int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1((jacobi<Matrix3f, float>()));
|
||||
CALL_SUBTEST_2((jacobi<Matrix4d, double>()));
|
||||
CALL_SUBTEST_3((jacobi<Matrix4cf, float>()));
|
||||
CALL_SUBTEST_3((jacobi<Matrix4cf, std::complex<float> >()));
|
||||
|
||||
CALL_SUBTEST_1(( jacobi<Matrix<float, 3, 3, RowMajor>, float>() ));
|
||||
CALL_SUBTEST_2(( jacobi<Matrix<double, 4, 4, RowMajor>, double>() ));
|
||||
CALL_SUBTEST_3(( jacobi<Matrix<std::complex<float>, 4, 4, RowMajor>, float>() ));
|
||||
CALL_SUBTEST_3(( jacobi<Matrix<std::complex<float>, 4, 4, RowMajor>, std::complex<float> >() ));
|
||||
CALL_SUBTEST_1((jacobi<Matrix<float, 3, 3, RowMajor>, float>()));
|
||||
CALL_SUBTEST_2((jacobi<Matrix<double, 4, 4, RowMajor>, double>()));
|
||||
CALL_SUBTEST_3((jacobi<Matrix<std::complex<float>, 4, 4, RowMajor>, float>()));
|
||||
CALL_SUBTEST_3((jacobi<Matrix<std::complex<float>, 4, 4, RowMajor>, std::complex<float> >()));
|
||||
|
||||
int r = internal::random<int>(2, internal::random<int>(1, EIGEN_TEST_MAX_SIZE) / 2),
|
||||
c = internal::random<int>(2, internal::random<int>(1, EIGEN_TEST_MAX_SIZE) / 2);
|
||||
CALL_SUBTEST_4((jacobi<MatrixXf, float>(MatrixXf(r, c))));
|
||||
CALL_SUBTEST_5((jacobi<MatrixXcd, double>(MatrixXcd(r, c))));
|
||||
CALL_SUBTEST_5((jacobi<MatrixXcd, std::complex<double> >(MatrixXcd(r, c))));
|
||||
// complex<float> is really important to test as it is the only way to cover conjugation issues in certain unaligned
|
||||
// paths
|
||||
CALL_SUBTEST_6((jacobi<MatrixXcf, float>(MatrixXcf(r, c))));
|
||||
CALL_SUBTEST_6((jacobi<MatrixXcf, std::complex<float> >(MatrixXcf(r, c))));
|
||||
|
||||
int r = internal::random<int>(2, internal::random<int>(1,EIGEN_TEST_MAX_SIZE)/2),
|
||||
c = internal::random<int>(2, internal::random<int>(1,EIGEN_TEST_MAX_SIZE)/2);
|
||||
CALL_SUBTEST_4(( jacobi<MatrixXf, float>(MatrixXf(r,c)) ));
|
||||
CALL_SUBTEST_5(( jacobi<MatrixXcd, double>(MatrixXcd(r,c)) ));
|
||||
CALL_SUBTEST_5(( jacobi<MatrixXcd, std::complex<double> >(MatrixXcd(r,c)) ));
|
||||
// complex<float> is really important to test as it is the only way to cover conjugation issues in certain unaligned paths
|
||||
CALL_SUBTEST_6(( jacobi<MatrixXcf, float>(MatrixXcf(r,c)) ));
|
||||
CALL_SUBTEST_6(( jacobi<MatrixXcf, std::complex<float> >(MatrixXcf(r,c)) ));
|
||||
|
||||
TEST_SET_BUT_UNUSED_VARIABLE(r);
|
||||
TEST_SET_BUT_UNUSED_VARIABLE(c);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user