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,8 +5,9 @@
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
#include "unit/tests.hpp"
#include <rotgen/rotgen.hpp>
#include "unit/tests.hpp"
#include <iostream>
TTS_CASE_TPL("outer_stride<0> interactions",
@ -54,49 +55,3 @@ TTS_CASE_TPL("outer_stride<0> interactions",
TTS_EQUAL(dp, sp);
}
};
void process_ref(rotgen::ref<rotgen::matrix<float> const>) {}
void process_ref(rotgen::ref<rotgen::matrix<double> const>) {}
void process_ref(
rotgen::ref<
rotgen::
matrix<float, rotgen::Dynamic, rotgen::Dynamic, rotgen::RowMajor> const>)
{
}
void process_ref(
rotgen::ref<
rotgen::
matrix<double, rotgen::Dynamic, rotgen::Dynamic, rotgen::RowMajor> const>)
{
}
TTS_CASE_TPL("Extraction of outer_stride<?> blocks",
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>;
if constexpr (O::value == rotgen::ColMajor)
{
T padded[] = {1, 2, 3, 4, 99, 5, 6, 7, 8, 99, 9, 10, 11, 12};
rotgen::map<mat_t, 0, rotgen::outer_stride<5>> sp(&padded[0], 4, 3);
rotgen::map<mat_t, 0, rotgen::outer_stride<>> dp(&padded[0], 4, 3,
rotgen::outer_stride(5));
TTS_EXPECT_COMPILES(sp, { process_ref(extract(sp, 0, 0, 3, 2)); });
TTS_EXPECT_COMPILES(dp, { process_ref(extract(dp, 0, 0, 3, 2)); });
}
else
{
T padded[] = {1, 2, 3, 99, 4, 5, 6, 99, 7, 8, 9, 99, 10, 11, 12};
rotgen::map<mat_t, 0, rotgen::outer_stride<4>> sp(&padded[0], 4, 3);
rotgen::map<mat_t, 0, rotgen::outer_stride<>> dp(&padded[0], 4, 3,
rotgen::outer_stride(4));
TTS_EXPECT_COMPILES(sp, { process_ref(extract(sp, 0, 0, 3, 2)); });
TTS_EXPECT_COMPILES(dp, { process_ref(extract(dp, 0, 0, 3, 2)); });
}
};