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

@@ -10,34 +10,35 @@
#include "main.h"
#include <Eigen/SVD>
template<typename MatrixType> void upperbidiag(const MatrixType& m)
{
template <typename MatrixType>
void upperbidiag(const MatrixType& m) {
const Index rows = m.rows();
const Index cols = m.cols();
typedef Matrix<typename MatrixType::RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType;
typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TransposeMatrixType;
typedef Matrix<typename MatrixType::RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime>
RealMatrixType;
typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime>
TransposeMatrixType;
MatrixType a = MatrixType::Random(rows,cols);
MatrixType a = MatrixType::Random(rows, cols);
internal::UpperBidiagonalization<MatrixType> ubd(a);
RealMatrixType b(rows, cols);
b.setZero();
b.block(0,0,cols,cols) = ubd.bidiagonal();
b.block(0, 0, cols, cols) = ubd.bidiagonal();
MatrixType c = ubd.householderU() * b * ubd.householderV().adjoint();
VERIFY_IS_APPROX(a,c);
VERIFY_IS_APPROX(a, c);
TransposeMatrixType d = ubd.householderV() * b.adjoint() * ubd.householderU().adjoint();
VERIFY_IS_APPROX(a.adjoint(),d);
VERIFY_IS_APPROX(a.adjoint(), d);
}
EIGEN_DECLARE_TEST(upperbidiagonalization)
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( upperbidiag(MatrixXf(3,3)) );
CALL_SUBTEST_2( upperbidiag(MatrixXd(17,12)) );
CALL_SUBTEST_3( upperbidiag(MatrixXcf(20,20)) );
CALL_SUBTEST_4( upperbidiag(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(16,15)) );
CALL_SUBTEST_5( upperbidiag(Matrix<float,6,4>()) );
CALL_SUBTEST_6( upperbidiag(Matrix<float,5,5>()) );
CALL_SUBTEST_7( upperbidiag(Matrix<double,4,3>()) );
EIGEN_DECLARE_TEST(upperbidiagonalization) {
for (int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1(upperbidiag(MatrixXf(3, 3)));
CALL_SUBTEST_2(upperbidiag(MatrixXd(17, 12)));
CALL_SUBTEST_3(upperbidiag(MatrixXcf(20, 20)));
CALL_SUBTEST_4(upperbidiag(Matrix<std::complex<double>, Dynamic, Dynamic, RowMajor>(16, 15)));
CALL_SUBTEST_5(upperbidiag(Matrix<float, 6, 4>()));
CALL_SUBTEST_6(upperbidiag(Matrix<float, 5, 5>()));
CALL_SUBTEST_7(upperbidiag(Matrix<double, 4, 3>()));
}
}