47 lines
No EOL
1.5 KiB
C++
47 lines
No EOL
1.5 KiB
C++
//==================================================================================================
|
|
/*
|
|
ROTGEN - Runtime Overlay for Eigen
|
|
Copyright : CODE RECKONS
|
|
SPDX-License-Identifier: BSL-1.0
|
|
*/
|
|
//==================================================================================================
|
|
#include "unit/tests.hpp"
|
|
#include <rotgen/rotgen.hpp>
|
|
|
|
TTS_CASE_TPL("noalias behavior - dynamicallly sized", rotgen::tests::types)
|
|
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
|
{
|
|
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> a{{1,2},{3,4}};
|
|
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> ref{{7,10},{15,22}};
|
|
rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value> b(2,2),c(2,2),d(2,2);
|
|
|
|
rotgen::noalias(b) = a * a;
|
|
TTS_EQUAL(b, ref);
|
|
|
|
auto e = rotgen::extract(c,0,0,2,2);
|
|
rotgen::noalias(e) = a * a;
|
|
TTS_EQUAL(c, ref);
|
|
|
|
rotgen::map<rotgen::matrix<T,rotgen::Dynamic,rotgen::Dynamic,O::value>> m(d.data(),2,2);
|
|
rotgen::noalias(m) = a * a;
|
|
TTS_EQUAL(m, ref);
|
|
};
|
|
|
|
TTS_CASE_TPL("noalias behavior - statically sized", rotgen::tests::types)
|
|
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
|
{
|
|
rotgen::matrix<T,2,2,O::value> a{{1,2},{3,4}};
|
|
rotgen::matrix<T,2,2,O::value> ref{{7,10},{15,22}};
|
|
rotgen::matrix<T,2,2,O::value> b,c,d;
|
|
|
|
rotgen::noalias(b) = a * a;
|
|
TTS_EQUAL(b, ref);
|
|
|
|
auto e = rotgen::extract(c,0,0,2,2);
|
|
rotgen::noalias(e) = a * a;
|
|
TTS_EQUAL(c, ref);
|
|
|
|
rotgen::map<rotgen::matrix<T,2,2,O::value>> m(d.data());
|
|
rotgen::noalias(m) = a * a;
|
|
TTS_EQUAL(m, ref);
|
|
}; |