Skip to content

Commit 8d3c0bd

Browse files
Update matmul.jl
More idiomatic handling of indices
1 parent 8d44613 commit 8d3c0bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/matmul.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(joinpath(dirname(pathof(KernelAbstractions)), "../examples/utils.jl")) #
77

88
# creating a temporary sum variable for matrix multiplication
99
tmp_sum = zero(eltype(output))
10-
for k in 1:size(a)[2]
10+
for k in axes(a,2)
1111
tmp_sum += a[i, k] * b[k, j]
1212
end
1313

@@ -16,7 +16,7 @@ end
1616

1717
# Creating a wrapper kernel for launching with error checks
1818
function matmul!(output, a, b)
19-
if size(a)[2] != size(b)[1]
19+
if size(a,2) != size(b,1)
2020
println("Matrix size mismatch!")
2121
return nothing
2222
end

0 commit comments

Comments
 (0)