Implements map and ref for both static & dynamic mode
See merge request oss/rotgen!12
This commit is contained in:
parent
aacae1cbb1
commit
6c2b260229
58 changed files with 4121 additions and 1205 deletions
73
test/unit/map/arithmetic_functions.cpp
Normal file
73
test/unit/map/arithmetic_functions.cpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#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>> )
|
||||
{
|
||||
auto const cases = rotgen::tests::generate_matrix_references();
|
||||
for (const auto& [rows, cols, fn] : cases)
|
||||
{
|
||||
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::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>> )
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
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::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>> )
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue