Adding clang-format configuration file and formatting all source files
Co-authored-by: Jules Pénuchot <jules@penuchot.com> Co-authored-by: Joel FALCOU <jfalcou@codereckons.com> See merge request oss/rotgen!41
This commit is contained in:
parent
e92e824a18
commit
648dd768ee
94 changed files with 6778 additions and 4722 deletions
|
|
@ -8,63 +8,67 @@
|
|||
#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>> )
|
||||
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 a = rotgen::matrix<T, N, N, O::value>::Random();
|
||||
|
||||
auto b = topLeftCorner(a,5,5);
|
||||
auto b = topLeftCorner(a, 5, 5);
|
||||
TTS_EQUAL(b.startRow(), 0);
|
||||
TTS_EQUAL(b.startCol(), 0);
|
||||
setConstant(b,-7);
|
||||
setConstant(b, -7);
|
||||
|
||||
for(rotgen::Index r=0;r<5;r++)
|
||||
for(rotgen::Index c=0;c<5;c++)
|
||||
TTS_EQUAL(a(r,c), -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);
|
||||
auto bb = bottomRightCorner(b, 3, 3);
|
||||
TTS_EQUAL(bb.startRow(), 2);
|
||||
TTS_EQUAL(bb.startCol(), 2);
|
||||
setConstant(bb,42);
|
||||
setConstant(bb, 42);
|
||||
|
||||
for(rotgen::Index r=2;r<5;r++)
|
||||
for(rotgen::Index c=2;c<5;c++)
|
||||
TTS_EQUAL(a(r,c), 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);
|
||||
auto bbb = row(bb, 1);
|
||||
TTS_EQUAL(bbb.startRow(), 1);
|
||||
TTS_EQUAL(bbb.startCol(), 0);
|
||||
setConstant(bbb,99.5);
|
||||
setConstant(bbb, 99.5);
|
||||
|
||||
for(rotgen::Index c=3;c<5;c++)
|
||||
TTS_EQUAL(a(3,c), 99.5);
|
||||
for (rotgen::Index c = 3; c < 5; c++) TTS_EQUAL(a(3, c), 99.5);
|
||||
|
||||
auto bbbb = col(bbb,1);
|
||||
auto bbbb = col(bbb, 1);
|
||||
TTS_EQUAL(bbbb.startRow(), 0);
|
||||
TTS_EQUAL(bbbb.startCol(), 1);
|
||||
setConstant(bbbb,0.125);
|
||||
setConstant(bbbb, 0.125);
|
||||
|
||||
TTS_EQUAL(a(3,3), 0.125);
|
||||
TTS_EQUAL(a(3, 3), 0.125);
|
||||
};
|
||||
|
||||
auto ref_extract ( rotgen::ref<rotgen::matrix<float> > m) { return rotgen::extract(m,0,0,3,4); }
|
||||
auto ref_cextract( rotgen::ref<const rotgen::matrix<float> > m) { return rotgen::extract(m,3,4,4,3); }
|
||||
auto ref_extract(rotgen::ref<rotgen::matrix<float>> m)
|
||||
{
|
||||
return rotgen::extract(m, 0, 0, 3, 4);
|
||||
}
|
||||
|
||||
auto ref_cextract(rotgen::ref<rotgen::matrix<float> const> m)
|
||||
{
|
||||
return rotgen::extract(m, 3, 4, 4, 3);
|
||||
}
|
||||
|
||||
TTS_CASE("Extraction of ref/ref const")
|
||||
{
|
||||
auto m = rotgen::setRandom<rotgen::matrix<float,7,7>>();
|
||||
auto m = rotgen::setRandom<rotgen::matrix<float, 7, 7>>();
|
||||
|
||||
auto extracted = ref_extract(m);
|
||||
extracted = rotgen::setOnes<rotgen::matrix<float,3,4>>();
|
||||
extracted = rotgen::setOnes<rotgen::matrix<float, 3, 4>>();
|
||||
|
||||
for(rotgen::Index r=0;r<3;r++)
|
||||
for(rotgen::Index c=0;c<4;c++)
|
||||
TTS_EQUAL(m(r,c), 1.f);
|
||||
for (rotgen::Index r = 0; r < 3; r++)
|
||||
for (rotgen::Index c = 0; c < 4; c++) TTS_EQUAL(m(r, c), 1.f);
|
||||
|
||||
auto sliced = ref_cextract(m);
|
||||
rotgen::extract(m,3,4,4,3) = rotgen::setConstant<rotgen::matrix<float,4,3>>(5);
|
||||
for(rotgen::Index r=0;r<4;r++)
|
||||
for(rotgen::Index c=0;c<3;c++)
|
||||
TTS_EQUAL(sliced(r,c), 5.f);
|
||||
};
|
||||
rotgen::extract(m, 3, 4, 4, 3) =
|
||||
rotgen::setConstant<rotgen::matrix<float, 4, 3>>(5);
|
||||
for (rotgen::Index r = 0; r < 4; r++)
|
||||
for (rotgen::Index c = 0; c < 3; c++) TTS_EQUAL(sliced(r, c), 5.f);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue