Adjoint of Matrix is not a StridedArray?

I am implementing a linear algebra routine for which I am trying to reuse an allocated array, but need to reshape it and take transposes of it.

In this process, I noticed that no method exists for ldiv!(::LU, Adjoint{Float64, Matrix{Float64}}), because Adjoint{Float64, Matrix{Float64}}} is not a subtype of StridedArray. But in reality, shouldn’t it be?

The whole builtin strided interface is pretty anemic at the moment — StridedArray is just an ad-hoc union of some builtin types that happen to use strided layouts. Now as of Julia 1.5, Adjoints and Transposes gain support for calling strides and pointer, but they’re still not a part of that Union.

This could definitely be done better — see #30432 or #25558 , for example.

3 Likes

I guess that for many BLAS/Lapack routines, “strided” also means stride 1 along the first dimension. That fails for transpose and adjoint matrices.

While the latter PR didn’t quite make it to Julia v1.0, but became ArrayLayouts.jl which has been fairly successful as a way to manipulate arrays based on layout, not type (and is used in BandedMatrices.jl, BlockArrays.jl, and elsewhere)

2 Likes