Skip to content

Commit

Permalink
Added more consistent types to iteration indices.
Browse files Browse the repository at this point in the history
  • Loading branch information
odlomax committed Dec 7, 2023
1 parent a96057e commit 8b3e8f4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ auto getInnerIt(const Matrix& matrix, int k) {
template <typename Functor, typename Matrix>
void sparseMatrixForEach(const Functor& functor, const Matrix& matrix) {

atlas_omp_parallel_for(auto k = 0; k < matrix.outerSize(); ++k) {
using Index = decltype (matrix.outerSize());
atlas_omp_parallel_for (auto k = Index{}; k < matrix.outerSize(); ++k) {
for (auto it = getInnerIt(matrix, k); it; ++it) {
functor(it.row(), it.col(), it.value());
}
Expand All @@ -75,7 +76,8 @@ void sparseMatrixForEach(const Functor& functor, const Matrix& matrix) {
template <typename Functor, typename Matrix1, typename Matrix2>
void sparseMatrixForEach(const Functor& functor, const Matrix1& matrix1,
const Matrix2& matrix2) {
atlas_omp_parallel_for(auto k = 0; k < matrix1.outerSize(); ++k) {
using Index = decltype (matrix1.outerSize());
atlas_omp_parallel_for (auto k = Index{}; k < matrix1.outerSize(); ++k) {
for (auto [it1, it2] =
std::make_pair(getInnerIt(matrix1, k), getInnerIt(matrix2, k));
it1; ++it1, ++it2) {
Expand Down

0 comments on commit 8b3e8f4

Please sign in to comment.