function mat_vec_prod(A,v) @assert size(A,2) == length(v) "Dimensions do not match." ### w = zeros(size(A,1)) is equivalent but there is a slight difference in that it takes time to actually fill a matrix with zeros, and this way we just tell Julia to use that part of the memory of the computer as a matrix, and nothing more, it is just a bit more efficient. eltype(A) provides the type of the elements of the Array, inbounds tells Julia not to check if the index is actually a permissible index, since we use axes and eachindex we know that it will be fine. w = Vector{eltype(A)}(undef,size(A,1)) @inbounds for i in axes(A,1) w[i] = 0.0 for j in eachindex(v) w[i] = w[i] + A[i,j] * v[j] end end return w end