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

@ -12,81 +12,82 @@
namespace rotgen::tests
{
template<typename T>
void check_cwise_functions(const T& input)
template<typename T> void check_cwise_functions(T const& input)
{
using EigenMatrix = Eigen::Matrix<typename T::value_type, Eigen::Dynamic, Eigen::Dynamic>;
using mat_t = matrix<typename T::value_type,Dynamic,Dynamic,T::storage_order>;
using EigenMatrix =
Eigen::Matrix<typename T::value_type, Eigen::Dynamic, Eigen::Dynamic>;
using mat_t =
matrix<typename T::value_type, Dynamic, Dynamic, T::storage_order>;
TTS_WHEN("Unary Cwise operations")
{
EigenMatrix e_ref(input.rows(), input.cols());
prepare([&](auto r, auto c) { return input(r,c); }, e_ref);
prepare([&](auto r, auto c) { return input(r, c); }, e_ref);
mat_t ref(input.rows(), input.cols());
TTS_AND_THEN(".cwiseAbs")
{
e_ref = e_ref.cwiseAbs();
prepare([&](auto r, auto c) { return e_ref(r,c); }, ref);
prepare([&](auto r, auto c) { return e_ref(r, c); }, ref);
TTS_EQUAL(input.cwiseAbs(), ref);
}
TTS_AND_THEN(".cwiseAbs2")
{
e_ref = e_ref.cwiseAbs2();
prepare([&](auto r, auto c) { return e_ref(r,c); }, ref);
prepare([&](auto r, auto c) { return e_ref(r, c); }, ref);
TTS_EQUAL(input.cwiseAbs2(), ref);
}
TTS_AND_THEN(".cwiseInverse")
{
e_ref = e_ref.cwiseInverse();
prepare([&](auto r, auto c) { return e_ref(r,c); }, ref);
prepare([&](auto r, auto c) { return e_ref(r, c); }, ref);
TTS_EQUAL(input.cwiseInverse(), ref);
}
TTS_AND_THEN(".cwiseSqrt")
{
e_ref = e_ref.cwiseAbs().cwiseSqrt();
auto mat = input.cwiseAbs();
auto mat = input.cwiseAbs();
auto proper_input = mat.cwiseSqrt();
for(rotgen::Index r=0;r<input.rows();++r)
for(rotgen::Index c=0;c<input.cols();++c)
TTS_ULP_EQUAL(proper_input(r,c), e_ref(r,c), 1);
for (rotgen::Index r = 0; r < input.rows(); ++r)
for (rotgen::Index c = 0; c < input.cols(); ++c)
TTS_ULP_EQUAL(proper_input(r, c), e_ref(r, c), 1);
}
TTS_AND_THEN("abs()")
{
e_ref = e_ref.cwiseAbs();
prepare([&](auto r, auto c) { return e_ref(r,c); }, ref);
prepare([&](auto r, auto c) { return e_ref(r, c); }, ref);
TTS_EQUAL(rotgen::abs(input), ref);
}
TTS_AND_THEN("abs2()")
{
e_ref = e_ref.cwiseAbs2();
prepare([&](auto r, auto c) { return e_ref(r,c); }, ref);
prepare([&](auto r, auto c) { return e_ref(r, c); }, ref);
TTS_EQUAL(rotgen::abs2(input), ref);
}
TTS_AND_THEN("rec")
{
e_ref = e_ref.cwiseInverse();
prepare([&](auto r, auto c) { return e_ref(r,c); }, ref);
prepare([&](auto r, auto c) { return e_ref(r, c); }, ref);
TTS_EQUAL(rotgen::rec(input), ref);
}
TTS_AND_THEN("sqrt")
{
e_ref = e_ref.cwiseAbs().cwiseSqrt();
auto mat = input.cwiseAbs();
auto mat = input.cwiseAbs();
auto proper_input = rotgen::sqrt(mat);
for(rotgen::Index r=0;r<input.rows();++r)
for(rotgen::Index c=0;c<input.cols();++c)
TTS_ULP_EQUAL(proper_input(r,c), e_ref(r,c), 1);
for (rotgen::Index r = 0; r < input.rows(); ++r)
for (rotgen::Index c = 0; c < input.cols(); ++c)
TTS_ULP_EQUAL(proper_input(r, c), e_ref(r, c), 1);
}
}
}