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

@@ -11,24 +11,20 @@
#include <unsupported/Eigen/MatrixFunctions>
// For complex matrices, any matrix is fine.
template<typename MatrixType, int IsComplex = NumTraits<typename internal::traits<MatrixType>::Scalar>::IsComplex>
struct processTriangularMatrix
{
static void run(MatrixType&, MatrixType&, const MatrixType&)
{ }
template <typename MatrixType, int IsComplex = NumTraits<typename internal::traits<MatrixType>::Scalar>::IsComplex>
struct processTriangularMatrix {
static void run(MatrixType&, MatrixType&, const MatrixType&) {}
};
// For real matrices, make sure none of the eigenvalues are negative.
template<typename MatrixType>
struct processTriangularMatrix<MatrixType,0>
{
static void run(MatrixType& m, MatrixType& T, const MatrixType& U)
{
template <typename MatrixType>
struct processTriangularMatrix<MatrixType, 0> {
static void run(MatrixType& m, MatrixType& T, const MatrixType& U) {
const Index size = m.cols();
for (Index i=0; i < size; ++i) {
if (i == size - 1 || T.coeff(i+1,i) == 0)
T.coeffRef(i,i) = std::abs(T.coeff(i,i));
for (Index i = 0; i < size; ++i) {
if (i == size - 1 || T.coeff(i + 1, i) == 0)
T.coeffRef(i, i) = std::abs(T.coeff(i, i));
else
++i;
}
@@ -40,10 +36,8 @@ template <typename MatrixType, int IsComplex = NumTraits<typename internal::trai
struct generateTestMatrix;
template <typename MatrixType>
struct generateTestMatrix<MatrixType,0>
{
static void run(MatrixType& result, typename MatrixType::Index size)
{
struct generateTestMatrix<MatrixType, 0> {
static void run(MatrixType& result, typename MatrixType::Index size) {
result = MatrixType::Random(size, size);
RealSchur<MatrixType> schur(result);
MatrixType T = schur.matrixT();
@@ -52,16 +46,11 @@ struct generateTestMatrix<MatrixType,0>
};
template <typename MatrixType>
struct generateTestMatrix<MatrixType,1>
{
static void run(MatrixType& result, typename MatrixType::Index size)
{
result = MatrixType::Random(size, size);
}
struct generateTestMatrix<MatrixType, 1> {
static void run(MatrixType& result, typename MatrixType::Index size) { result = MatrixType::Random(size, size); }
};
template <typename Derived, typename OtherDerived>
typename Derived::RealScalar relerr(const MatrixBase<Derived>& A, const MatrixBase<OtherDerived>& B)
{
typename Derived::RealScalar relerr(const MatrixBase<Derived>& A, const MatrixBase<OtherDerived>& B) {
return std::sqrt((A - B).cwiseAbs2().sum() / (std::min)(A.cwiseAbs2().sum(), B.cwiseAbs2().sum()));
}