- Refurbish block implementation to support nested block
- Add missing extractors
This commit is contained in:
parent
3fff326db9
commit
93a1404d9a
24 changed files with 1205 additions and 630 deletions
51
test/integration/extract.cpp
Normal file
51
test/integration/extract.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
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("Chains of extraction", rotgen::tests::types)
|
||||
<typename T, typename O>( tts::type< tts::types<T,O>> )
|
||||
{
|
||||
constexpr int N = 8;
|
||||
auto a = rotgen::matrix<T,N,N,O::value>::Random();
|
||||
|
||||
auto b = topLeftCorner(a,5,5);
|
||||
TTS_EQUAL(b.startRow(), 0);
|
||||
TTS_EQUAL(b.startCol(), 0);
|
||||
b.setConstant(-7);
|
||||
|
||||
for(rotgen::Index r=0;r<5;r++)
|
||||
for(rotgen::Index c=0;c<5;c++)
|
||||
TTS_EQUAL(a(r,c), -7);
|
||||
|
||||
auto bb = bottomRightCorner(b,3,3);
|
||||
TTS_EQUAL(bb.startRow(), 2);
|
||||
TTS_EQUAL(bb.startCol(), 2);
|
||||
bb.setConstant(42);
|
||||
|
||||
for(rotgen::Index r=2;r<5;r++)
|
||||
for(rotgen::Index c=2;c<5;c++)
|
||||
TTS_EQUAL(a(r,c), 42);
|
||||
|
||||
auto bbb = row(bb,1);
|
||||
TTS_EQUAL(bbb.startRow(), 1);
|
||||
TTS_EQUAL(bbb.startCol(), 0);
|
||||
bbb.setConstant(99.5);
|
||||
|
||||
for(rotgen::Index c=3;c<5;c++)
|
||||
TTS_EQUAL(a(3,c), 99.5);
|
||||
|
||||
auto bbbb = col(bbb,1);
|
||||
TTS_EQUAL(bbbb.startRow(), 0);
|
||||
TTS_EQUAL(bbbb.startCol(), 1);
|
||||
bbbb.setConstant(0.125);
|
||||
|
||||
TTS_EQUAL(a(3,3), 0.125);
|
||||
|
||||
std::cout << "a: \n" << a << std::endl;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue