diff --git a/test/test.hpp b/test/test.hpp index 4af4e024..d707ff8f 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -80,17 +80,40 @@ std::array lindex_to_pos_arr( std::size_t const d1 return p; } -std::array std_res_to_pos4D ( int* res - , int* begin - , std::size_t const d1 - , std::size_t const d2 - , std::size_t const d3 - ) +std::array lindex_to_pos_arr( std::size_t const d1 + , int const lindex + ) { - auto dist = static_cast(std::distance(begin, res)); + int remains = lindex; + std::array p; + std::fill(p.begin(), p.end(), 0); + p[0] = remains / d1; + remains -= p[0] * d1; + p[1] = remains; + return p; +} + +std::array std_res_to_pos ( int* res + , int* begin + , std::size_t const d1 + , std::size_t const d2 + , std::size_t const d3 + ) +{ + std::size_t dist = static_cast(std::distance(begin, res)); return lindex_to_pos_arr(d1, d2, d3, dist); } +std::array std_res_to_pos ( int* res + , int* begin + , std::size_t const d1 + ) +{ + std::size_t dist = static_cast(std::distance(begin, res)); + return lindex_to_pos_arr(d1, dist); +} + + template void fill_data(T* data, S shp, bool fill)