Fix a lot of ref issues reagrding extarction, rvalueness and proper use of temporary memory.

This commit is contained in:
Joel Falcou 2025-10-28 20:12:33 +01:00
parent d5c41bf43e
commit 379d77ebef
50 changed files with 2945 additions and 1397 deletions

View file

@ -5,10 +5,11 @@
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
#include "unit/tests.hpp"
#include <rotgen/rotgen.hpp>
#include <vector>
#include "unit/tests.hpp"
#include <Eigen/Core>
#include <vector>
auto generate_data(int rows, int cols)
{
@ -26,7 +27,7 @@ using r_mat_t = rotgen::matrix<float, rotgen::Dynamic, rotgen::Dynamic, O>;
template<int O>
using e_mat_t = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, O>;
template<typename M, typename S = rotgen::stride>
template<typename M, typename S = rotgen::stride<0, 0>>
using r_map_t = rotgen::map<M, 0, S>;
template<typename M, typename S = Eigen::Stride<0, 0>>
using e_map_t = Eigen::Map<M, 0, S>;
@ -56,7 +57,7 @@ TTS_CASE("Validate Column Major Map with specific outer stride behavior")
auto buffer = generate_data(rows, cols);
r_map_t<r_mat_t<rotgen::ColMajor>, rotgen::outer_stride<>> r_map(
buffer.data(), rows, cols, rotgen::outer_stride(rows + 1));
buffer.data(), rows, cols, rotgen::outer_stride<>(rows + 1));
TTS_EQUAL(r_map.innerStride(), 1);
TTS_EQUAL(r_map.outerStride(), 4);
@ -75,8 +76,8 @@ TTS_CASE("Validate Column Major Map with specific inner stride behavior")
auto cols = 4;
auto buffer = generate_data(rows, cols);
r_map_t<r_mat_t<rotgen::ColMajor>> r_map(buffer.data(), rows, cols,
rotgen::stride(rows, 2));
r_map_t<r_mat_t<rotgen::ColMajor>, rotgen::dynamic_stride> r_map(
buffer.data(), rows, cols, rotgen::dynamic_stride(rows, 2));
TTS_EQUAL(r_map.innerStride(), 2);
TTS_EQUAL(r_map.outerStride(), 3);
@ -116,7 +117,7 @@ TTS_CASE("Validate Row Major Map with specific outer stride behavior")
auto buffer = generate_data(rows, cols);
r_map_t<r_mat_t<rotgen::RowMajor>, rotgen::outer_stride<>> r_map(
buffer.data(), rows, cols, rotgen::outer_stride(cols + 1));
buffer.data(), rows, cols, rotgen::outer_stride<>(cols + 1));
TTS_EQUAL(r_map.innerStride(), 1);
TTS_EQUAL(r_map.outerStride(), 5);
@ -135,8 +136,8 @@ TTS_CASE("Validate Row Major Map with specific inner stride behavior")
auto cols = 4;
auto buffer = generate_data(rows, cols);
r_map_t<r_mat_t<rotgen::RowMajor>, rotgen::stride> r_map(
buffer.data(), rows, cols, rotgen::stride(2, cols));
r_map_t<r_mat_t<rotgen::RowMajor>, rotgen::dynamic_stride> r_map(
buffer.data(), rows, cols, rotgen::dynamic_stride(2, cols));
TTS_EQUAL(r_map.innerStride(), 4);
TTS_EQUAL(r_map.outerStride(), 2);