Skip to content

Commit

Permalink
small fixes and slighly better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlag31 committed Sep 15, 2023
1 parent 20f906a commit 0c5bb0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ KOKKOS_INLINE_FUNCTION void ensureIsSquareSymmetricMatrix(Matrix const &mat)
using value_t = typename Matrix::non_const_value_type;

auto is_symmetric = [&]() {
int size = mat.extent(0);
int const size = mat.extent(0);
for (int i = 0; i < size; i++)
for (int j = i + 1; j < size; j++)
{
Expand All @@ -60,7 +60,6 @@ KOKKOS_FUNCTION auto argmaxUpperTriangle(Matrix const &mat)
{
ensureIsSquareMatrix(mat);
using value_t = typename Matrix::non_const_value_type;
int const size = mat.extent(0);

struct
{
Expand All @@ -69,6 +68,7 @@ KOKKOS_FUNCTION auto argmaxUpperTriangle(Matrix const &mat)
int col = 0;
} result;

int const size = mat.extent(0);
for (int i = 0; i < size; i++)
for (int j = i + 1; j < size; j++)
{
Expand Down
7 changes: 3 additions & 4 deletions test/ArborX_EnableViewComparison.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ void arborxViewCheck(U const &u, V const &v, std::string const &u_name,
if (!same_dim_size)
return;

auto const layout = u.layout();
Kokkos::Array<int, 8> index{0, 0, 0, 0, 0, 0, 0, 0};
int index[8]{0, 0, 0, 0, 0, 0, 0, 0};
auto make_index = [&]() {
std::stringstream sstr;
sstr << "(";
Expand All @@ -55,7 +54,7 @@ void arborxViewCheck(U const &u, V const &v, std::string const &u_name,
return sstr.str();
};

while (index[0] != layout.dimension[0])
while (index[0] != u.extent_int(0))
{
auto uval = u.access(index[0], index[1], index[2], index[3], index[4],
index[5], index[6], index[7]);
Expand All @@ -75,7 +74,7 @@ void arborxViewCheck(U const &u, V const &v, std::string const &u_name,

index[rank - 1]++;
for (int i = rank - 1; i > 0; i--)
if (index[i] == layout.dimension[i])
if (index[i] == u.extent_int(i))
{
index[i] = 0;
index[i - 1]++;
Expand Down

0 comments on commit 0c5bb0d

Please sign in to comment.