Skip to content

Commit c4c51ea

Browse files
authored
julia matmul div instead of round (#491)
1 parent f01c70d commit c4c51ea

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

matmul/matmul-native.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ function matgen(n, seed)
77
end
88

99
function calc(n)
10-
n = round(Int, n / 2) * 2
11-
a = matgen(n, 1.0)
12-
b = matgen(n, 2.0)
10+
n = n ÷ 2 * 2
11+
a = matgen(n, 1)
12+
b = matgen(n, 2)
1313
c = a * b
14-
c[Int(n / 2)+1, Int(n / 2)+1]
14+
c[n÷2+1, n÷2+1]
1515
end
1616

1717
function notify(msg)

matmul/matmul.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ function mul(a, b)
2020
end
2121

2222
function calc(n)
23-
n = round(Int, n / 2) * 2
24-
a = matgen(n, 1.0)
25-
b = matgen(n, 2.0)
23+
n = n ÷ 2 * 2
24+
a = matgen(n, 1)
25+
b = matgen(n, 2)
2626
c = mul(a, b)
27-
c[Int(n / 2)+1, Int(n / 2)+1]
27+
c[n÷2+1, n÷2+1]
2828
end
2929

3030
function notify(msg)

0 commit comments

Comments
 (0)