Explore matrix-vector multiplication with Julia

2018-08-14 Jeff Fessler, University of Michigan
2020-08-05 Julia 1.5
2023-08-23 Julia 1.6.2

Double loop over m,n

This is the textbook version.

Double loop over n,m

We expect this way to be faster because of cache access over m.

Row versions

Loop over m.

Col versions

Loop over n.

Test and time each version

The results above are for a 2017 iMac with 4.2GHz quad-core Intel Core i7 with macOS Mojave 10.14.6 and Julia 1.6.2. As expected, simple A*x is the fastest, but one can come quite close to that using proper double loop order with @inbounds or using "dots" and @views to coalesce. Without @views the vector versions have huge memory overhead!