Resolve "[API-#2] Pseudo-privatization of rotgen entity member functions"

Closes #18

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

See merge request oss/rotgen!50
This commit is contained in:
Jules Pénuchot 2025-12-17 20:48:00 +01:00 committed by Joel Falcou
parent 6489697c05
commit e151e136d6
52 changed files with 2212 additions and 1556 deletions

View file

@ -18,8 +18,9 @@ void fill(auto& m, int r, int c, auto data[])
for (int k = 0; k < r * c; ++k) m.data()[k] = data[k];
}
TTS_CASE_TPL("Function size", rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Function size", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
T data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
@ -28,44 +29,44 @@ TTS_CASE_TPL("Function size", rotgen::tests::types)<typename T, typename O>(
fill(dm, 1, 12, data);
auto b1 = rotgen::block<decltype(dm), rotgen::Dynamic, rotgen::Dynamic>(
dm, 0, 0, 1, 12);
TTS_EQUAL(b1.rows(), rotgen::Index{1});
TTS_EQUAL(b1.cols(), rotgen::Index{12});
TTS_EQUAL(rows(b1), rotgen::Index{1});
TTS_EQUAL(cols(b1), rotgen::Index{12});
// 1x5 dynamic block at (0,2)
auto b2 = rotgen::block<decltype(dm), rotgen::Dynamic, rotgen::Dynamic>(
dm, 0, 2, 1, 5);
TTS_EQUAL(b2.rows(), rotgen::Index{1});
TTS_EQUAL(b2.cols(), rotgen::Index{5});
TTS_EQUAL(rows(b2), rotgen::Index{1});
TTS_EQUAL(cols(b2), rotgen::Index{5});
// 3x2 dynamic block at (1,4) in 4x6
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value> dm2(4, 6);
fill(dm2, 4, 6, data);
auto b3 = rotgen::block<decltype(dm2), rotgen::Dynamic, rotgen::Dynamic>(
dm2, 1, 4, 3, 2);
TTS_EQUAL(b3.rows(), rotgen::Index{3});
TTS_EQUAL(b3.cols(), rotgen::Index{2});
TTS_EQUAL(rows(b3), rotgen::Index{3});
TTS_EQUAL(cols(b3), rotgen::Index{2});
TTS_EQUAL(b3.size(), rotgen::Index{6});
// 3x4 static block
rotgen::matrix<T, 3, 4, O::value> sm;
fill(sm, 3, 4, data);
auto b4 = rotgen::block<decltype(sm), 3, 4>(sm, 0, 0);
TTS_EQUAL(b4.rows(), rotgen::Index{3});
TTS_EQUAL(b4.cols(), rotgen::Index{4});
TTS_EQUAL(rows(b4), rotgen::Index{3});
TTS_EQUAL(cols(b4), rotgen::Index{4});
TTS_EQUAL(b4.size(), rotgen::Index{12});
// 6x2 static block
rotgen::matrix<T, 6, 2, O::value> sm2;
fill(sm2, 6, 2, data);
auto b5 = rotgen::block<decltype(sm2), 6, 2>(sm2, 0, 0);
TTS_EQUAL(b5.rows(), rotgen::Index{6});
TTS_EQUAL(b5.cols(), rotgen::Index{2});
TTS_EQUAL(rows(b5), rotgen::Index{6});
TTS_EQUAL(cols(b5), rotgen::Index{2});
TTS_EQUAL(b5.size(), rotgen::Index{12});
};
TTS_CASE_TPL("Test coefficient accessors",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test coefficient accessors", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
using base = rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, O::value>;
@ -92,9 +93,9 @@ TTS_CASE_TPL("Test coefficient accessors",
TTS_EQUAL(b(2, 2), 17);
};
TTS_CASE_TPL("Test one index coefficient accessors",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test one index coefficient accessors", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto vs = [&]() {
if constexpr (O::value == rotgen::ColMajor)

View file

@ -13,15 +13,15 @@
template<typename EigenType, typename F>
void for_each_element(EigenType const& m, F&& f)
{
for (rotgen::Index i = 0; i < m.rows(); ++i)
for (rotgen::Index j = 0; j < m.cols(); ++j) f(i, j, m(i, j));
for (rotgen::Index i = 0; i < rows(m); ++i)
for (rotgen::Index j = 0; j < cols(m); ++j) f(i, j, m(i, j));
}
template<typename EigenType, typename F>
void for_each_element(EigenType& m, F&& f)
{
for (rotgen::Index i = 0; i < m.rows(); ++i)
for (rotgen::Index j = 0; j < m.cols(); ++j) f(i, j, m(i, j));
for (rotgen::Index i = 0; i < rows(m); ++i)
for (rotgen::Index j = 0; j < cols(m); ++j) f(i, j, m(i, j));
}
template<typename MatrixType, typename T>
@ -53,8 +53,8 @@ void validate_block_behavior(MatrixType& matrix,
rotgen::Index block_n)
{
using T = typename MatrixType::value_type;
TTS_EQUAL(block.rows(), block_m);
TTS_EQUAL(block.cols(), block_n);
TTS_EQUAL(rows(block), block_m);
TTS_EQUAL(cols(block), block_n);
TTS_EQUAL(block.size(), block_m * block_n);
// test block values
@ -144,31 +144,31 @@ void test_dynamic_block_extraction(
std::make_tuple(c_block_top_left_corner, 0, 0, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(c_block_top_right_corner, 0,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(c_block_bottom_left_corner,
matrix.rows() - matrix_construct.ni, 0, matrix_construct.ni,
rows(matrix) - matrix_construct.ni, 0, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(c_block_bottom_right_corner,
matrix.rows() - matrix_construct.ni,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
rows(matrix) - matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(c_block_top_rows, 0, 0, matrix_construct.ni, matrix.cols(),
std::make_tuple(c_block_top_rows, 0, 0, matrix_construct.ni, cols(matrix),
rotgen::Dynamic, MatrixType::ColsAtCompileTime),
std::make_tuple(c_block_middle_rows, matrix_construct.i0, 0,
matrix_construct.ni, matrix.cols(), rotgen::Dynamic,
matrix_construct.ni, cols(matrix), rotgen::Dynamic,
MatrixType::ColsAtCompileTime),
std::make_tuple(c_block_bottom_rows, matrix.rows() - matrix_construct.ni, 0,
matrix_construct.ni, matrix.cols(), rotgen::Dynamic,
std::make_tuple(c_block_bottom_rows, rows(matrix) - matrix_construct.ni, 0,
matrix_construct.ni, cols(matrix), rotgen::Dynamic,
MatrixType::ColsAtCompileTime),
std::make_tuple(c_block_left_cols, 0, 0, matrix.rows(), matrix_construct.nj,
std::make_tuple(c_block_left_cols, 0, 0, rows(matrix), matrix_construct.nj,
MatrixType::RowsAtCompileTime, rotgen::Dynamic),
std::make_tuple(c_block_middle_cols, 0, matrix_construct.j0, matrix.rows(),
std::make_tuple(c_block_middle_cols, 0, matrix_construct.j0, rows(matrix),
matrix_construct.nj, MatrixType::RowsAtCompileTime,
rotgen::Dynamic),
std::make_tuple(c_block_right_cols, 0, matrix.cols() - matrix_construct.nj,
matrix.rows(), matrix_construct.nj,
std::make_tuple(c_block_right_cols, 0, cols(matrix) - matrix_construct.nj,
rows(matrix), matrix_construct.nj,
MatrixType::RowsAtCompileTime, rotgen::Dynamic),
// --- REGULAR TESTS
@ -178,31 +178,31 @@ void test_dynamic_block_extraction(
std::make_tuple(block_top_left_corner, 0, 0, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(block_top_right_corner, 0,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(block_bottom_left_corner,
matrix.rows() - matrix_construct.ni, 0, matrix_construct.ni,
rows(matrix) - matrix_construct.ni, 0, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(block_bottom_right_corner,
matrix.rows() - matrix_construct.ni,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
rows(matrix) - matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, rotgen::Dynamic, rotgen::Dynamic),
std::make_tuple(block_top_rows, 0, 0, matrix_construct.ni, matrix.cols(),
std::make_tuple(block_top_rows, 0, 0, matrix_construct.ni, cols(matrix),
rotgen::Dynamic, MatrixType::ColsAtCompileTime),
std::make_tuple(block_middle_rows, matrix_construct.i0, 0,
matrix_construct.ni, matrix.cols(), rotgen::Dynamic,
matrix_construct.ni, cols(matrix), rotgen::Dynamic,
MatrixType::ColsAtCompileTime),
std::make_tuple(block_bottom_rows, matrix.rows() - matrix_construct.ni, 0,
matrix_construct.ni, matrix.cols(), rotgen::Dynamic,
std::make_tuple(block_bottom_rows, rows(matrix) - matrix_construct.ni, 0,
matrix_construct.ni, cols(matrix), rotgen::Dynamic,
MatrixType::ColsAtCompileTime),
std::make_tuple(block_left_cols, 0, 0, matrix.rows(), matrix_construct.nj,
std::make_tuple(block_left_cols, 0, 0, rows(matrix), matrix_construct.nj,
MatrixType::RowsAtCompileTime, rotgen::Dynamic),
std::make_tuple(block_middle_cols, 0, matrix_construct.j0, matrix.rows(),
std::make_tuple(block_middle_cols, 0, matrix_construct.j0, rows(matrix),
matrix_construct.nj, MatrixType::RowsAtCompileTime,
rotgen::Dynamic),
std::make_tuple(block_right_cols, 0, matrix.cols() - matrix_construct.nj,
matrix.rows(), matrix_construct.nj,
std::make_tuple(block_right_cols, 0, cols(matrix) - matrix_construct.nj,
rows(matrix), matrix_construct.nj,
MatrixType::RowsAtCompileTime, rotgen::Dynamic));
std::apply(
@ -276,68 +276,68 @@ void test_static_block_extraction(
std::make_tuple(c_block_top_left_corner, 0, 0, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(c_block_top_right_corner, 0,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(c_block_bottom_left_corner,
matrix.rows() - matrix_construct.ni, 0, matrix_construct.ni,
rows(matrix) - matrix_construct.ni, 0, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(c_block_bottom_right_corner,
matrix.rows() - matrix_construct.ni,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
rows(matrix) - matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(c_block_top_rows, 0, 0, matrix_construct.ni, matrix.cols(),
std::make_tuple(c_block_top_rows, 0, 0, matrix_construct.ni, cols(matrix),
int(NI), rotgen::Dynamic),
std::make_tuple(c_block_middle_rows, i0, 0, matrix_construct.ni,
matrix.cols(), int(NI), rotgen::Dynamic),
std::make_tuple(c_block_bottom_rows, matrix.rows() - matrix_construct.ni, 0,
matrix_construct.ni, matrix.cols(), int(NI),
cols(matrix), int(NI), rotgen::Dynamic),
std::make_tuple(c_block_bottom_rows, rows(matrix) - matrix_construct.ni, 0,
matrix_construct.ni, cols(matrix), int(NI),
rotgen::Dynamic),
std::make_tuple(c_block_left_cols, 0, 0, matrix.rows(), matrix_construct.nj,
std::make_tuple(c_block_left_cols, 0, 0, rows(matrix), matrix_construct.nj,
rotgen::Dynamic, int(NJ)),
std::make_tuple(c_block_middle_cols, 0, j0, matrix.rows(),
std::make_tuple(c_block_middle_cols, 0, j0, rows(matrix),
matrix_construct.nj, rotgen::Dynamic, int(NJ)),
std::make_tuple(c_block_right_cols, 0, matrix.cols() - matrix_construct.nj,
matrix.rows(), matrix_construct.nj, rotgen::Dynamic,
std::make_tuple(c_block_right_cols, 0, cols(matrix) - matrix_construct.nj,
rows(matrix), matrix_construct.nj, rotgen::Dynamic,
int(NJ)),
std::make_tuple(c_block_row, i0, 0, 1, matrix.cols(), 1, rotgen::Dynamic),
std::make_tuple(c_block_col, 0, j0, matrix.rows(), 1, rotgen::Dynamic, 1),
std::make_tuple(c_block_row, i0, 0, 1, cols(matrix), 1, rotgen::Dynamic),
std::make_tuple(c_block_col, 0, j0, rows(matrix), 1, rotgen::Dynamic, 1),
// -- Block to NON CONST
std::make_tuple(block_main, i0, j0, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(block_top_left_corner, 0, 0, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(block_top_right_corner, 0,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(block_bottom_left_corner,
matrix.rows() - matrix_construct.ni, 0, matrix_construct.ni,
rows(matrix) - matrix_construct.ni, 0, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(block_bottom_right_corner,
matrix.rows() - matrix_construct.ni,
matrix.cols() - matrix_construct.nj, matrix_construct.ni,
rows(matrix) - matrix_construct.ni,
cols(matrix) - matrix_construct.nj, matrix_construct.ni,
matrix_construct.nj, int(NI), int(NJ)),
std::make_tuple(block_top_rows, 0, 0, matrix_construct.ni, matrix.cols(),
std::make_tuple(block_top_rows, 0, 0, matrix_construct.ni, cols(matrix),
int(NI), rotgen::Dynamic),
std::make_tuple(block_middle_rows, i0, 0, matrix_construct.ni,
matrix.cols(), int(NI), rotgen::Dynamic),
std::make_tuple(block_bottom_rows, matrix.rows() - matrix_construct.ni, 0,
matrix_construct.ni, matrix.cols(), int(NI),
std::make_tuple(block_middle_rows, i0, 0, matrix_construct.ni, cols(matrix),
int(NI), rotgen::Dynamic),
std::make_tuple(block_bottom_rows, rows(matrix) - matrix_construct.ni, 0,
matrix_construct.ni, cols(matrix), int(NI),
rotgen::Dynamic),
std::make_tuple(block_left_cols, 0, 0, matrix.rows(), matrix_construct.nj,
std::make_tuple(block_left_cols, 0, 0, rows(matrix), matrix_construct.nj,
rotgen::Dynamic, int(NJ)),
std::make_tuple(block_middle_cols, 0, j0, matrix.rows(),
matrix_construct.nj, rotgen::Dynamic, int(NJ)),
std::make_tuple(block_right_cols, 0, matrix.cols() - matrix_construct.nj,
matrix.rows(), matrix_construct.nj, rotgen::Dynamic,
std::make_tuple(block_middle_cols, 0, j0, rows(matrix), matrix_construct.nj,
rotgen::Dynamic, int(NJ)),
std::make_tuple(block_right_cols, 0, cols(matrix) - matrix_construct.nj,
rows(matrix), matrix_construct.nj, rotgen::Dynamic,
int(NJ)),
std::make_tuple(block_row, i0, 0, 1, matrix.cols(), 1, rotgen::Dynamic),
std::make_tuple(block_col, 0, j0, matrix.rows(), 1, rotgen::Dynamic, 1));
std::make_tuple(block_row, i0, 0, 1, cols(matrix), 1, rotgen::Dynamic),
std::make_tuple(block_col, 0, j0, rows(matrix), 1, rotgen::Dynamic, 1));
std::apply(
[&](auto&&... block_entries) {
@ -358,7 +358,9 @@ void test_static_block_extraction(
TTS_CASE_TPL(
"Check all dynamic block extractions on a dynamic row-major matrix",
rotgen::tests::types)<typename T, typename O>(tts::type<tts::types<T, O>>)
rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
using mat_t =
rotgen::matrix<T, rotgen::Dynamic, rotgen::Dynamic, rotgen::RowMajor>;
@ -394,7 +396,9 @@ TTS_CASE_TPL(
TTS_CASE_TPL(
"Check all dynamic block extractions on a static column-major matrix",
rotgen::tests::types)<typename T, typename O>(tts::type<tts::types<T, O>>)
rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
using mat_t = rotgen::matrix<T, 4, 5, rotgen::ColMajor>;
@ -417,9 +421,9 @@ TTS_CASE_TPL(
}
};
TTS_CASE_TPL("Check all static block extractions",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Check all static block extractions", 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>;
@ -446,9 +450,9 @@ TTS_CASE_TPL("Check all static block extractions",
0});
};
TTS_CASE_TPL("Check vector-only extractions",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Check vector-only extractions", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto run_case = [](auto&& matrix, auto&& block, int i_offset, int j_offset,
int ni, int nj, auto const& rows_ct, auto const& cols_ct) {

View file

@ -48,9 +48,9 @@ void test_random(auto const& matrix,
}
}
TTS_CASE_TPL("Test dynamic block::setZero",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test dynamic block::setZero", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_block_references<T, O>();
for (auto const& [matrix_desc, i0, j0, ni, nj] : cases)
@ -64,14 +64,14 @@ TTS_CASE_TPL("Test dynamic block::setZero",
test_value(m, T{0}, i0, j0, ni, nj);
using input_type = decltype(rotgen::extract(m, i0, j0, ni, nj));
auto values = input_type::Zero(ni, nj);
auto values = rotgen::setZero<input_type>(ni, nj);
test_value(values, T{0}, 0, 0, ni, nj);
}
};
TTS_CASE_TPL("Test static block::setZero",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test static block::setZero", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_static_block_references<T, O>();
@ -87,16 +87,16 @@ TTS_CASE_TPL("Test static block::setZero",
test_value(m, T{0}, i0, j0, D::ni, D::nj);
using input_type = decltype(rotgen::extract<D::ni, D::nj>(m, i0, j0));
auto values = input_type::Zero();
auto values = rotgen::setZero<input_type>();
test_value(values, T{0}, 0, 0, D::ni, D::nj);
};
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
};
TTS_CASE_TPL("Test dynamic block::setOnes",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test dynamic block::setOnes", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_block_references<T, O>();
for (auto const& [matrix_desc, i0, j0, ni, nj] : cases)
@ -110,14 +110,14 @@ TTS_CASE_TPL("Test dynamic block::setOnes",
test_value(m, T{1}, i0, j0, ni, nj);
using input_type = decltype(rotgen::extract(m, i0, j0, ni, nj));
auto values = input_type::Ones(ni, nj);
auto values = rotgen::setOnes<input_type>(ni, nj);
test_value(values, T{1}, 0, 0, ni, nj);
}
};
TTS_CASE_TPL("Test static block::setOnes",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test static block::setOnes", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_static_block_references<T, O>();
@ -133,16 +133,16 @@ TTS_CASE_TPL("Test static block::setOnes",
test_value(m, T{1}, i0, j0, D::ni, D::nj);
using input_type = decltype(rotgen::extract<D::ni, D::nj>(m, i0, j0));
auto values = input_type::Ones();
auto values = rotgen::setOnes<input_type>();
test_value(values, T{1}, 0, 0, D::ni, D::nj);
};
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
};
TTS_CASE_TPL("Test dynamic block::setConstant",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test dynamic block::setConstant", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_block_references<T, O>();
for (auto const& [matrix_desc, i0, j0, ni, nj] : cases)
@ -156,14 +156,14 @@ TTS_CASE_TPL("Test dynamic block::setConstant",
test_value(m, T{13.37f}, i0, j0, ni, nj);
using input_type = decltype(rotgen::extract(m, i0, j0, ni, nj));
auto values = input_type::Constant(ni, nj, T{13.37f});
auto values = rotgen::setConstant<input_type>(ni, nj, T{13.37f});
test_value(values, T{13.37f}, 0, 0, ni, nj);
}
};
TTS_CASE_TPL("Test static block::setConstant",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test static block::setConstant", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_static_block_references<T, O>();
@ -179,16 +179,16 @@ TTS_CASE_TPL("Test static block::setConstant",
test_value(m, T{13.37f}, i0, j0, D::ni, D::nj);
using input_type = decltype(rotgen::extract<D::ni, D::nj>(m, i0, j0));
auto values = input_type::Constant(T{13.37f});
auto values = rotgen::setConstant<input_type>(T{13.37f});
test_value(values, T{13.37f}, 0, 0, D::ni, D::nj);
};
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
};
TTS_CASE_TPL("Test dynamic block::setIdentity",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test dynamic block::setIdentity", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_block_references<T, O>();
for (auto const& [matrix_desc, i0, j0, ni, nj] : cases)
@ -202,14 +202,14 @@ TTS_CASE_TPL("Test dynamic block::setIdentity",
test_identity(m, i0, j0, ni, nj);
using input_type = decltype(rotgen::extract(m, i0, j0, ni, nj));
auto values = input_type::Identity(ni, nj);
auto values = rotgen::setIdentity<input_type>(ni, nj);
test_identity(values, 0, 0, ni, nj);
}
};
TTS_CASE_TPL("Test static block::setIdentity",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test static block::setIdentity", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_static_block_references<T, O>();
@ -225,16 +225,16 @@ TTS_CASE_TPL("Test static block::setIdentity",
test_identity(m, i0, j0, D::ni, D::nj);
using input_type = decltype(rotgen::extract<D::ni, D::nj>(m, i0, j0));
auto values = input_type::Identity();
auto values = rotgen::setIdentity<input_type>();
test_identity(values, 0, 0, D::ni, D::nj);
};
std::apply([&](auto const&... d) { (process(d), ...); }, cases);
};
TTS_CASE_TPL("Test dynamic block::setRandom",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test dynamic block::setRandom", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_block_references<T, O>();
for (auto const& [matrix_desc, i0, j0, ni, nj] : cases)
@ -248,14 +248,14 @@ TTS_CASE_TPL("Test dynamic block::setRandom",
test_random(m, i0, j0, ni, nj);
using input_type = decltype(rotgen::extract(m, i0, j0, ni, nj));
auto values = input_type::Random(ni, nj);
auto values = rotgen::setRandom<input_type>(ni, nj);
test_random(values, 0, 0, ni, nj);
}
};
TTS_CASE_TPL("Test static block::setRandom",
rotgen::tests::types)<typename T, typename O>(
tts::type<tts::types<T, O>>)
TTS_CASE_TPL("Test static block::setRandom", rotgen::tests::types)
<typename T, typename O>(tts::type<tts::types<T, O>>)
{
auto const cases = rotgen::tests::generate_static_block_references<T, O>();
@ -271,7 +271,7 @@ TTS_CASE_TPL("Test static block::setRandom",
test_random(m, i0, j0, D::ni, D::nj);
using input_type = decltype(rotgen::extract<D::ni, D::nj>(m, i0, j0));
auto values = input_type::Random();
auto values = rotgen::setRandom<input_type>();
test_random(values, 0, 0, D::ni, D::nj);
};