Skip to content

Instantly share code, notes, and snippets.

@filipebraida
Created October 18, 2019 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipebraida/5de9dceb28773c8615732c9176f97ec7 to your computer and use it in GitHub Desktop.
Save filipebraida/5de9dceb28773c8615732c9176f97ec7 to your computer and use it in GitHub Desktop.
function multiply(a::Array{T, 2}, b::Array{T, 2}) where T <: Number
if size(a, 2) != size(b, 1)
error("size")
end
c = Array{T}(undef, size(a, 1), size(b, 2))
for i = 1:size(a, 1), j = 1:size(b, 2)
aux = 0.0
for k = 1:size(a, 2)
aux += a[i, k] * b[k, j]
end
c[i,j] = aux
end
return c
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment