Adding clang-format configuration file and formatting all source files

Co-authored-by: Jules Pénuchot <jules@penuchot.com>
Co-authored-by: Joel FALCOU <jfalcou@codereckons.com>

See merge request oss/rotgen!41
This commit is contained in:
Jules Pénuchot 2025-10-14 16:19:03 +02:00
parent e92e824a18
commit 648dd768ee
94 changed files with 6778 additions and 4722 deletions

View file

@ -8,23 +8,24 @@
#include "unit/tests.hpp"
#include <rotgen/rotgen.hpp>
TTS_CASE_TPL("SVD decomposition - Dynamic case", rotgen::tests::types)
<typename T, typename O>( tts::type< tts::types<T,O>> )
TTS_CASE_TPL("SVD decomposition - Dynamic case",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
{
int rank, i = 5;
auto eps = std::numeric_limits<T>::epsilon();
auto m = rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>::Random(5,5);
auto m =
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>::Random(5, 5);
auto decomp = rotgen::svd(m);
do
{
rank = decomp.rank();
do {
rank = decomp.rank();
auto u = decomp.U(rank);
auto d = decomp.singular_values(rank);
auto u = decomp.U(rank);
auto d = decomp.singular_values(rank);
auto dd = decomp.D(rank);
auto v = decomp.V(rank);
auto v = decomp.V(rank);
TTS_EQUAL(rank, i);
@ -32,34 +33,36 @@ TTS_CASE_TPL("SVD decomposition - Dynamic case", rotgen::tests::types)
auto error = m - rec;
TTS_LESS_EQUAL(rotgen::maxCoeff(rotgen::abs(error)) / eps, 16.)
<< "Result:\n" << rec << "\n"
<< "Residuals:\n" << error << "\n";
<< "Result:\n"
<< rec << "\n"
<< "Residuals:\n"
<< error << "\n";
// Reduce rank by duplicating one column
i--;
col(m,i) = col(m,0);
col(m, i) = col(m, 0);
decomp = rotgen::svd(m);
}while(rank != 1);
} while (rank != 1);
};
TTS_CASE_TPL("SVD decomposition - Static case", rotgen::tests::types)
<typename T, typename O>( tts::type< tts::types<T,O>> )
TTS_CASE_TPL("SVD decomposition - Static case",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
{
int rank, i = 5;
auto eps = std::numeric_limits<T>::epsilon();
auto m = rotgen::matrix<T,5,5,O::value>::Random();
auto m = rotgen::matrix<T, 5, 5, O::value>::Random();
auto decomp = rotgen::svd(m);
do
{
rank = decomp.rank();
do {
rank = decomp.rank();
auto u = decomp.U(rank);
auto d = decomp.singular_values(rank);
auto u = decomp.U(rank);
auto d = decomp.singular_values(rank);
auto dd = decomp.D(rank);
auto v = decomp.V(rank);
auto v = decomp.V(rank);
TTS_EQUAL(rank, i);
@ -67,13 +70,15 @@ TTS_CASE_TPL("SVD decomposition - Static case", rotgen::tests::types)
auto error = m - rec;
TTS_LESS_EQUAL(rotgen::maxCoeff(rotgen::abs(error)) / eps, 16.)
<< "Result:\n" << rec << "\n"
<< "Residuals:\n" << error << "\n";
<< "Result:\n"
<< rec << "\n"
<< "Residuals:\n"
<< error << "\n";
// Reduce rank by duplicating one column
i--;
col(m,i) = col(m,0);
col(m, i) = col(m, 0);
decomp = rotgen::svd(m);
}while(rank != 1);
};
} while (rank != 1);
};