Open gdkrmr opened 3 months ago
This is a DiskArrays LinearAlgebra interaction problem. mat' calls adjoint and this accesses the data with separate getindex calls for every value. You can see that by setting up an AccessCountDiskArray see below. If you don't need to have the adjoint you can use permutedims instead for switching the axes order. This should have special cases which would not access all data one by one.
julia> using DiskArrays
julia> mat = TestTypes.AccessCountDiskArray(rand(4,5));
julia> convert(Matrix, mat)
4×5 Matrix{Float64}:
0.9342 0.00562529 0.554012 0.0577668 0.591995
0.0644567 0.760773 0.364234 0.777978 0.103616
0.268764 0.138414 0.296148 0.501075 0.177412
0.993255 0.137569 0.111455 0.492843 0.216849
julia> mat.getindex_log
1-element Vector{Any}:
(1:4, 1:5)
julia> mat = TestTypes.AccessCountDiskArray(rand(4,5));
julia> convert(Matrix, mat')
5×4 Matrix{Float64}:
0.0455661 0.137063 0.0339512 0.146162
0.567136 0.00509385 0.614943 0.817899
0.569512 0.655161 0.185285 0.379507
0.33343 0.59349 0.930645 0.999305
0.906612 0.619647 0.171684 0.75579
julia> mat.getindex_log
20-element Vector{Any}:
(1:1, 1:1)
(2:2, 1:1)
(3:3, 1:1)
(4:4, 1:1)
(1:1, 2:2)
(2:2, 2:2)
(3:3, 2:2)
⋮
(2:2, 4:4)
(3:3, 4:4)
(4:4, 4:4)
(1:1, 5:5)
(2:2, 5:5)
(3:3, 5:5)
(4:4, 5:5)
convert(Matrix, x')
is so slow that I haven't gotten it to finish.convert(Matrix, x)
works just fine.