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,101 +9,109 @@
|
|||
#include "unit/common/arithmetic.hpp"
|
||||
#include <rotgen/rotgen.hpp>
|
||||
|
||||
TTS_CASE_TPL("Test dynamic map transposition-like operations", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("Test dynamic map transposition-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
auto const cases = rotgen::tests::generate_matrix_references();
|
||||
for (const auto& [rows, cols, fn] : cases)
|
||||
for (auto const& [rows, cols, fn] : cases)
|
||||
{
|
||||
using mat_t = rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>;
|
||||
using mat_t = rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>;
|
||||
mat_t base(rows, cols);
|
||||
rotgen::tests::prepare(rows,cols,fn,base);
|
||||
rotgen::tests::prepare(rows, cols, fn, base);
|
||||
|
||||
rotgen::map<mat_t> input(base.data(),rows,cols);
|
||||
rotgen::map<mat_t> input(base.data(), rows, cols);
|
||||
rotgen::tests::check_shape_functions(input);
|
||||
}
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test static map transposition-like operations", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("Test static map transposition-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
auto const cases = rotgen::tests::generate_static_matrix_references();
|
||||
|
||||
auto process = []<typename D>(D const& desc)
|
||||
{
|
||||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> base(D::rows,D::cols);
|
||||
rotgen::tests::prepare(base.rows(),base.cols(),desc.init_fn,base);
|
||||
auto process = []<typename D>(D const& desc) {
|
||||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> base(D::rows,
|
||||
D::cols);
|
||||
rotgen::tests::prepare(base.rows(), base.cols(), desc.init_fn, base);
|
||||
|
||||
rotgen::map<rotgen::matrix<T,D::rows,D::cols,O::value>> input(base.data());
|
||||
rotgen::map<rotgen::matrix<T, D::rows, D::cols, O::value>> input(
|
||||
base.data());
|
||||
rotgen::tests::check_shape_functions(input);
|
||||
};
|
||||
|
||||
std::apply([&](auto const&... d) { (process(d),...);}, cases);
|
||||
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test dynamic map reduction-like operations", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("Test dynamic map reduction-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
auto const cases = rotgen::tests::generate_matrix_references();
|
||||
for (const auto& [rows, cols, fn] : cases)
|
||||
for (auto const& [rows, cols, fn] : cases)
|
||||
{
|
||||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> base(rows, cols);
|
||||
rotgen::tests::prepare(rows,cols,fn,base);
|
||||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> base(rows,
|
||||
cols);
|
||||
rotgen::tests::prepare(rows, cols, fn, base);
|
||||
|
||||
rotgen::map<rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>> input(base.data(),rows,cols);
|
||||
rotgen::map<rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>>
|
||||
input(base.data(), rows, cols);
|
||||
rotgen::tests::check_reduction_functions(input);
|
||||
}
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test static map reduction-like operations", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
TTS_CASE_TPL("Test static map reduction-like operations",
|
||||
rotgen::tests::types)<typename T, typename O>(
|
||||
tts::type<tts::types<T, O>>)
|
||||
{
|
||||
auto const cases = rotgen::tests::generate_static_matrix_references();
|
||||
|
||||
auto process = []<typename D>(D const& desc)
|
||||
{
|
||||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> base(D::rows,D::cols);
|
||||
rotgen::tests::prepare(base.rows(),base.cols(),desc.init_fn,base);
|
||||
auto process = []<typename D>(D const& desc) {
|
||||
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> base(D::rows,
|
||||
D::cols);
|
||||
rotgen::tests::prepare(base.rows(), base.cols(), desc.init_fn, base);
|
||||
|
||||
rotgen::map<rotgen::matrix<T,D::rows,D::cols,O::value>> input(base.data());
|
||||
rotgen::map<rotgen::matrix<T, D::rows, D::cols, O::value>> input(
|
||||
base.data());
|
||||
rotgen::tests::check_reduction_functions(input);
|
||||
};
|
||||
|
||||
std::apply([&](auto const&... d) { (process(d),...);}, cases);
|
||||
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
|
||||
};
|
||||
|
||||
TTS_CASE_TPL("Test dot product", float, double)
|
||||
<typename T>( tts::type<T> )
|
||||
TTS_CASE_TPL("Test dot product", float, double)<typename T>(tts::type<T>){
|
||||
{auto v = rotgen::setConstant<rotgen::matrix<T, 1, rotgen::Dynamic>>(1,
|
||||
16,
|
||||
2);
|
||||
auto a = rotgen::map<decltype(v)>(v.data(), 1, 8);
|
||||
auto b = rotgen::map<decltype(v)>(v.data() + 8, 1, 8);
|
||||
|
||||
TTS_EQUAL(rotgen::dot(a, b), 32);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T,1,rotgen::Dynamic>>(1,16,2);
|
||||
auto a = rotgen::map<decltype(v)>(v.data(),1,8);
|
||||
auto b = rotgen::map<decltype(v)>(v.data()+8,1,8);
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T, rotgen::Dynamic, 1>>(16, 1, 2);
|
||||
auto a = rotgen::map<decltype(v)>(v.data(), 8, 1);
|
||||
auto b = rotgen::map<decltype(v)>(v.data() + 8, 8, 1);
|
||||
|
||||
TTS_EQUAL(rotgen::dot(a,b), 32);
|
||||
}
|
||||
TTS_EQUAL(rotgen::dot(a, b), 32);
|
||||
}
|
||||
|
||||
{
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T,rotgen::Dynamic,1>>(16,1,2);
|
||||
auto a = rotgen::map<decltype(v)>(v.data(),8,1);
|
||||
auto b = rotgen::map<decltype(v)>(v.data()+8,8,1);
|
||||
{
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T, 1, rotgen::Dynamic>>(1, 16, 2);
|
||||
auto a = rotgen::map<rotgen::matrix<T, 1, 8>>(v.data());
|
||||
auto b = rotgen::map<rotgen::matrix<T, 1, 8>>(v.data() + 8);
|
||||
|
||||
TTS_EQUAL(rotgen::dot(a,b), 32);
|
||||
}
|
||||
TTS_EQUAL(rotgen::dot(a, b), 32);
|
||||
}
|
||||
|
||||
{
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T,1,rotgen::Dynamic>>(1,16,2);
|
||||
auto a = rotgen::map<rotgen::matrix<T,1,8>>(v.data());
|
||||
auto b = rotgen::map<rotgen::matrix<T,1,8>>(v.data()+8);
|
||||
{
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T, 1, rotgen::Dynamic>>(1, 16, 2);
|
||||
auto a = rotgen::map<rotgen::matrix<T, 8, 1>>(v.data());
|
||||
auto b = rotgen::map<rotgen::matrix<T, 8, 1>>(v.data() + 8);
|
||||
|
||||
TTS_EQUAL(rotgen::dot(a,b), 32);
|
||||
}
|
||||
|
||||
{
|
||||
auto v = rotgen::setConstant<rotgen::matrix<T,1,rotgen::Dynamic>>(1,16,2);
|
||||
auto a = rotgen::map<rotgen::matrix<T,8,1>>(v.data());
|
||||
auto b = rotgen::map<rotgen::matrix<T,8,1>>(v.data()+8);
|
||||
|
||||
TTS_EQUAL(rotgen::dot(a,b), 32);
|
||||
}
|
||||
};
|
||||
TTS_EQUAL(rotgen::dot(a, b), 32);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue