June 2019
Intermediate to advanced
218 pages
5h 19m
English
Sometimes, you may have an algorithm that is naturally expressed as row-first. Converting the algorithm to column-first iteration can be a difficult process, prone to errors. In such cases, Julia provides an Adjoint type that can store a transpose of a matrix as a view into the original matrix. Row-wise iteration will be the fast option. We illustrate this in the following code.
julia> b=a'1000×1000 LinearAlgebra.Adjoint{Float64,Array{Float64,2}}:...julia> @btime col_iter($b) 3.521 ms (0 allocations: 0 bytes)julia> @btime row_iter($b) 1.160 ms (0 allocations: 0 bytes)
We see here that the timings of the function have been inverted from those in the previous section. Column iteration is now slower than row iteration. You will also ...
Read now
Unlock full access