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
|
|
@ -15,132 +15,138 @@ auto generate_data(int rows, int cols)
|
|||
std::vector<float> buffer(rows * cols * 3);
|
||||
|
||||
for (size_t i = 0; i < buffer.size(); ++i)
|
||||
buffer[i] = static_cast<float>(1+i);
|
||||
buffer[i] = static_cast<float>(1 + i);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
template<int O>
|
||||
using r_mat_t = rotgen::matrix<float,rotgen::Dynamic,rotgen::Dynamic,O>;
|
||||
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>;
|
||||
using e_mat_t = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, O>;
|
||||
|
||||
template<typename M, typename S = rotgen::stride> 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>;
|
||||
template<typename M, typename S = rotgen::stride>
|
||||
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>;
|
||||
|
||||
TTS_CASE("Validate Column Major Map with regular stride behavior")
|
||||
{
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows,cols);
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows, cols);
|
||||
|
||||
r_map_t<r_mat_t<rotgen::ColMajor>> r_map(buffer.data(), rows, cols);
|
||||
|
||||
TTS_EQUAL(r_map.innerStride(), 1);
|
||||
TTS_EQUAL(r_map.outerStride(), 3);
|
||||
|
||||
e_map_t<e_mat_t<Eigen::ColMajor>> e_map(buffer.data(), rows, cols);
|
||||
e_map_t<e_mat_t<Eigen::ColMajor>> e_map(buffer.data(), rows, cols);
|
||||
|
||||
for(std::ptrdiff_t r=0;r<rows;r++)
|
||||
for(std::ptrdiff_t c=0;c<cols;c++)
|
||||
TTS_EQUAL(r_map(r,c), e_map(r,c));
|
||||
for (std::ptrdiff_t r = 0; r < rows; r++)
|
||||
for (std::ptrdiff_t c = 0; c < cols; c++)
|
||||
TTS_EQUAL(r_map(r, c), e_map(r, c));
|
||||
};
|
||||
|
||||
TTS_CASE("Validate Column Major Map with specific outer stride behavior")
|
||||
{
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows,cols);
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
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));
|
||||
r_map_t<r_mat_t<rotgen::ColMajor>, rotgen::outer_stride<>> r_map(
|
||||
buffer.data(), rows, cols, rotgen::outer_stride(rows + 1));
|
||||
|
||||
TTS_EQUAL(r_map.innerStride(), 1);
|
||||
TTS_EQUAL(r_map.outerStride() , 4);
|
||||
TTS_EQUAL(r_map.innerStride(), 1);
|
||||
TTS_EQUAL(r_map.outerStride(), 4);
|
||||
|
||||
e_map_t<e_mat_t<Eigen::ColMajor>, Eigen::OuterStride<>>
|
||||
e_map(buffer.data(), rows, cols, Eigen::OuterStride<>(rows + 1));
|
||||
e_map_t<e_mat_t<Eigen::ColMajor>, Eigen::OuterStride<>> e_map(
|
||||
buffer.data(), rows, cols, Eigen::OuterStride<>(rows + 1));
|
||||
|
||||
for(std::ptrdiff_t r=0;r<rows;r++)
|
||||
for(std::ptrdiff_t c=0;c<cols;c++)
|
||||
TTS_EQUAL(r_map(r,c), e_map(r,c));
|
||||
for (std::ptrdiff_t r = 0; r < rows; r++)
|
||||
for (std::ptrdiff_t c = 0; c < cols; c++)
|
||||
TTS_EQUAL(r_map(r, c), e_map(r, c));
|
||||
};
|
||||
|
||||
TTS_CASE("Validate Column Major Map with specific inner stride behavior")
|
||||
{
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows,cols);
|
||||
auto rows = 3;
|
||||
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>> r_map(buffer.data(), rows, cols,
|
||||
rotgen::stride(rows, 2));
|
||||
|
||||
TTS_EQUAL(r_map.innerStride(), 2);
|
||||
TTS_EQUAL(r_map.outerStride() , 3);
|
||||
TTS_EQUAL(r_map.innerStride(), 2);
|
||||
TTS_EQUAL(r_map.outerStride(), 3);
|
||||
|
||||
e_map_t<e_mat_t<Eigen::ColMajor>,Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic>>
|
||||
e_map(buffer.data(), rows, cols, Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic>(rows,2));
|
||||
e_map_t<e_mat_t<Eigen::ColMajor>,
|
||||
Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>>
|
||||
e_map(buffer.data(), rows, cols,
|
||||
Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>(rows, 2));
|
||||
|
||||
for(std::ptrdiff_t r=0;r<rows;r++)
|
||||
for(std::ptrdiff_t c=0;c<cols;c++)
|
||||
TTS_EQUAL(r_map(r,c), e_map(r,c));
|
||||
for (std::ptrdiff_t r = 0; r < rows; r++)
|
||||
for (std::ptrdiff_t c = 0; c < cols; c++)
|
||||
TTS_EQUAL(r_map(r, c), e_map(r, c));
|
||||
};
|
||||
|
||||
TTS_CASE("Validate Row Major Map with regular stride behavior")
|
||||
{
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows,cols);
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows, cols);
|
||||
|
||||
r_map_t<r_mat_t<rotgen::RowMajor>> r_map(buffer.data(), rows, cols);
|
||||
|
||||
TTS_EQUAL(r_map.innerStride(), 1);
|
||||
TTS_EQUAL(r_map.outerStride(), 4);
|
||||
|
||||
e_map_t<e_mat_t<Eigen::RowMajor>> e_map(buffer.data(), rows, cols);
|
||||
e_map_t<e_mat_t<Eigen::RowMajor>> e_map(buffer.data(), rows, cols);
|
||||
|
||||
for(std::ptrdiff_t r=0;r<rows;r++)
|
||||
for(std::ptrdiff_t c=0;c<cols;c++)
|
||||
TTS_EQUAL(r_map(r,c), e_map(r,c));
|
||||
for (std::ptrdiff_t r = 0; r < rows; r++)
|
||||
for (std::ptrdiff_t c = 0; c < cols; c++)
|
||||
TTS_EQUAL(r_map(r, c), e_map(r, c));
|
||||
};
|
||||
|
||||
TTS_CASE("Validate Row Major Map with specific outer stride behavior")
|
||||
{
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows,cols);
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
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));
|
||||
r_map_t<r_mat_t<rotgen::RowMajor>, rotgen::outer_stride<>> r_map(
|
||||
buffer.data(), rows, cols, rotgen::outer_stride(cols + 1));
|
||||
|
||||
TTS_EQUAL(r_map.innerStride(), 1);
|
||||
TTS_EQUAL(r_map.outerStride() , 5);
|
||||
TTS_EQUAL(r_map.innerStride(), 1);
|
||||
TTS_EQUAL(r_map.outerStride(), 5);
|
||||
|
||||
e_map_t<e_mat_t<Eigen::RowMajor>, Eigen::OuterStride<>>
|
||||
e_map(buffer.data(), rows, cols, Eigen::OuterStride<>(cols + 1));
|
||||
e_map_t<e_mat_t<Eigen::RowMajor>, Eigen::OuterStride<>> e_map(
|
||||
buffer.data(), rows, cols, Eigen::OuterStride<>(cols + 1));
|
||||
|
||||
for(std::ptrdiff_t r=0;r<rows;r++)
|
||||
for(std::ptrdiff_t c=0;c<cols;c++)
|
||||
TTS_EQUAL(r_map(r,c), e_map(r,c));
|
||||
for (std::ptrdiff_t r = 0; r < rows; r++)
|
||||
for (std::ptrdiff_t c = 0; c < cols; c++)
|
||||
TTS_EQUAL(r_map(r, c), e_map(r, c));
|
||||
};
|
||||
|
||||
TTS_CASE("Validate Row Major Map with specific inner stride behavior")
|
||||
{
|
||||
auto rows = 3;
|
||||
auto cols = 4;
|
||||
auto buffer = generate_data(rows,cols);
|
||||
auto rows = 3;
|
||||
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::stride> r_map(
|
||||
buffer.data(), rows, cols, rotgen::stride(2, cols));
|
||||
|
||||
TTS_EQUAL(r_map.innerStride(), 4);
|
||||
TTS_EQUAL(r_map.outerStride() , 2);
|
||||
TTS_EQUAL(r_map.innerStride(), 4);
|
||||
TTS_EQUAL(r_map.outerStride(), 2);
|
||||
|
||||
e_map_t<e_mat_t<Eigen::RowMajor>,Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic>>
|
||||
e_map(buffer.data(), rows, cols, Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic>(2,cols));
|
||||
e_map_t<e_mat_t<Eigen::RowMajor>,
|
||||
Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>>
|
||||
e_map(buffer.data(), rows, cols,
|
||||
Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>(2, cols));
|
||||
|
||||
for(std::ptrdiff_t r=0;r<rows;r++)
|
||||
for(std::ptrdiff_t c=0;c<cols;c++)
|
||||
TTS_EQUAL(r_map(r,c), e_map(r,c));
|
||||
};
|
||||
for (std::ptrdiff_t r = 0; r < rows; r++)
|
||||
for (std::ptrdiff_t c = 0; c < cols; c++)
|
||||
TTS_EQUAL(r_map(r, c), e_map(r, c));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue