Skip to content

Commit

Permalink
more efficient looping for transposes
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Jun 26, 2023
1 parent cfa0641 commit 5750d0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ void sum_mat

void transpose_mat2(real_t *restrict A, size_t m, size_t n, real_t *restrict outp)
{
for (size_t row = 0; row < m; row++)
for (size_t col = 0; col < n; col++)
for (size_t col = 0; col < n; col++)
for (size_t row = 0; row < m; row++)
outp[row + col*m] = A[col + row*n];
}

Expand All @@ -1275,8 +1275,8 @@ void transpose_mat3
real_t *restrict outp, size_t ldb
)
{
for (size_t row = 0; row < m; row++)
for (size_t col = 0; col < n; col++)
for (size_t col = 0; col < n; col++)
for (size_t row = 0; row < m; row++)
outp[row + col*ldb] = A[col + row*lda];
}

Expand Down

0 comments on commit 5750d0c

Please sign in to comment.