Implement fixed size options for rotgen containers
See merge request oss/rotgen!11
This commit is contained in:
parent
8e545dd51a
commit
2084874b1b
39 changed files with 1247 additions and 323 deletions
|
|
@ -6,8 +6,7 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
#include "unit/tests.hpp"
|
||||
#include <rotgen/matrix.hpp>
|
||||
#include <rotgen/extract.hpp>
|
||||
#include <rotgen/rotgen.hpp>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
TTS_CASE_TPL("Matrix norm-related operations", rotgen::tests::types)
|
||||
|
|
@ -17,15 +16,15 @@ TTS_CASE_TPL("Matrix norm-related operations", rotgen::tests::types)
|
|||
|
||||
std::vector<rotgen::tests::matrix_block_test_case<mat_t>> test_cases =
|
||||
{
|
||||
{6, 5, [](auto r, auto c) {return r + c; }, 1, 2, 3, 2},
|
||||
{9, 11, [](auto r, auto c) {return r + c; }, 0, 1, 4, 9},
|
||||
{3, 3, [](auto , auto ) {return 0.0; }, 1, 1, 1, 1},
|
||||
{1, 4, [](auto r, auto c) {return -r -c*c - 1234; }, 0, 0, 1, 1},
|
||||
{4, 1, [](auto , auto ) {return 7.0; }, 2, 0, 2, 1},
|
||||
{1, 1, [](auto , auto ) {return 42.0; }, 0, 0, 1, 1},
|
||||
{12, 13, [](auto r, auto c) {return std::sin(r + c); }, 2, 3, 4, 5 },
|
||||
{4, 9, [](auto r, auto c) {return -1.5 * r + 2.56 * c; }, 0, 1, 2, 3 },
|
||||
{2, 5, [](auto r, auto c) {return (r == c ? 1.0 : 0.0); }, 1, 1, 1, 1},
|
||||
{6, 5, [](rotgen::Index r, rotgen::Index c) {return r + c; }, 1, 2, 3, 2},
|
||||
{9, 11, [](rotgen::Index r, rotgen::Index c) {return r + c; }, 0, 1, 4, 9},
|
||||
{3, 3, [](rotgen::Index , rotgen::Index ) {return 0.0; }, 1, 1, 1, 1},
|
||||
{1, 4, [](rotgen::Index r, rotgen::Index c) {return -r -c*c - 1234; }, 0, 0, 1, 1},
|
||||
{4, 1, [](rotgen::Index , rotgen::Index ) {return 7.0; }, 2, 0, 2, 1},
|
||||
{1, 1, [](rotgen::Index , rotgen::Index ) {return 42.0; }, 0, 0, 1, 1},
|
||||
{12, 13, [](rotgen::Index r, rotgen::Index c) {return std::sin(r + c); }, 2, 3, 4, 5 },
|
||||
{4, 9, [](rotgen::Index r, rotgen::Index c) {return -1.5 * r + 2.56 * c; }, 0, 1, 2, 3 },
|
||||
{2, 5, [](rotgen::Index r, rotgen::Index c) {return (r == c ? 1.0 : 0.0); }, 1, 1, 1, 1},
|
||||
};
|
||||
|
||||
for (const auto& [rows, cols, fn, i0, j0, ni, nj] : test_cases)
|
||||
|
|
@ -33,8 +32,8 @@ TTS_CASE_TPL("Matrix norm-related operations", rotgen::tests::types)
|
|||
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> original_matrix(rows, cols);
|
||||
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic,O::value> ref_matrix(rows, cols);
|
||||
|
||||
for (std::size_t r = 0; r < rows; ++r)
|
||||
for (std::size_t c = 0; c < cols; ++c)
|
||||
for (rotgen::Index r = 0; r < rows; ++r)
|
||||
for (rotgen::Index c = 0; c < cols; ++c)
|
||||
ref_matrix(r, c) = original_matrix(r, c) = fn(r,c);
|
||||
|
||||
auto original_block = rotgen::extract(original_matrix, i0, j0, ni, nj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue