Reshape of subarray


#1
A = randn(10,2)
svd(reshape(view(A,1:10), (5,2)))

yields a MethodError. Is it a fault in the way svd is defined, or just me doing something wrong/“unjulian”? What’s the correct way to do this without copy?


#2

The main issue is that we don’t seem to have a generic implementation of svdfact, because we rely on LAPACK. Unless you want to write one in pure Julia, best would be to have a fallback. If you don’t want to submit as a PR to julia, then please do file an issue.


#3

This case is slightly different because reshape(view(A,1:10), (5,2)) is a contiguous (strided) array that LAPACK could support. I believe it should be fixed by https://github.com/JuliaLang/julia/pull/22429, which is pending backports.


#4

#5

@mbauman yes that was the point, sorry I should have made it more clear. The PR looks set to fix it, that’s great!