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:
parent
e92e824a18
commit
648dd768ee
94 changed files with 6778 additions and 4722 deletions
|
|
@ -9,54 +9,59 @@
|
|||
#include "unit/common/arithmetic.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
TTS_CASE_TPL("Test dynamic matrix inverse", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("Test dynamic matrix inverse",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
using mat_t = rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>;
|
||||
using mat_t = rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>;
|
||||
auto eps = std::numeric_limits<T>::epsilon();
|
||||
|
||||
auto const cases = rotgen::tests::generate_matrix_references();
|
||||
for (const auto& [r, c, fn] : cases)
|
||||
for (auto const& [r, c, fn] : cases)
|
||||
{
|
||||
if(r == c)
|
||||
if (r == c)
|
||||
{
|
||||
auto input = mat_t::Random(r, c);
|
||||
auto inv = rotgen::inverse(input);
|
||||
|
||||
auto rec = input * inv;
|
||||
auto id = mat_t::Identity(rotgen::rows(rec),rotgen::cols(rec));
|
||||
auto error = rec - id;
|
||||
auto rec = input * inv;
|
||||
auto id = mat_t::Identity(rotgen::rows(rec), rotgen::cols(rec));
|
||||
auto error = rec - id;
|
||||
|
||||
TTS_LESS_EQUAL(rotgen::maxCoeff(rotgen::abs(error)) / eps, 64.)
|
||||
<< "Result:\n" << rec << "\n"
|
||||
<< "Residuals:\n" << error << "\n";
|
||||
<< "Result:\n"
|
||||
<< rec << "\n"
|
||||
<< "Residuals:\n"
|
||||
<< error << "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test static matrix inverse", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("Test static matrix inverse",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
using mat_t = rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>;
|
||||
using mat_t = rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>;
|
||||
auto eps = std::numeric_limits<T>::epsilon();
|
||||
auto const cases = rotgen::tests::generate_static_matrix_references();
|
||||
|
||||
auto process = [&]<typename D>(D const&)
|
||||
{
|
||||
if constexpr(D::rows == D::cols)
|
||||
auto process = [&]<typename D>(D const&) {
|
||||
if constexpr (D::rows == D::cols)
|
||||
{
|
||||
auto input = rotgen::matrix<T,D::rows,D::cols,O::value>::Random();
|
||||
auto input = rotgen::matrix<T, D::rows, D::cols, O::value>::Random();
|
||||
auto inv = rotgen::inverse(input);
|
||||
|
||||
auto rec = input * inv;
|
||||
auto id = mat_t::Identity(rotgen::rows(rec),rotgen::cols(rec));
|
||||
auto error = rec - id;
|
||||
auto rec = input * inv;
|
||||
auto id = mat_t::Identity(rotgen::rows(rec), rotgen::cols(rec));
|
||||
auto error = rec - id;
|
||||
|
||||
TTS_LESS_EQUAL(rotgen::maxCoeff(rotgen::abs(error)) / eps, 64.)
|
||||
<< "Result:\n" << rec << "\n"
|
||||
<< "Residuals:\n" << error << "\n";
|
||||
<< "Result:\n"
|
||||
<< rec << "\n"
|
||||
<< "Residuals:\n"
|
||||
<< error << "\n";
|
||||
}
|
||||
};
|
||||
|
||||
std::apply([&](auto const&... d) { (process(d),...);}, cases);
|
||||
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue