Cholfact on reshape of view of array

Hi,

I would like to be able to compute the following

``````julia> A = ones(1000);
julia> B = view(A, 100:199);
julia> C = reshape(B, 10, 10);
julia> F = cholfact!(C) # Obviously this is not SPD :D
``````

But I get

`ERROR: MethodError: no method matching cholfact!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}})`

I think the underlying thing I’m describing is ok, but I don’t seem to be able to express it correctly so that Cholfact can take it.

Any idea?

Which version of Julia? I get

``````julia> A = ones(1000);

julia> B = view(A, 100:199);

julia> C = reshape(B, 10, 10);

julia> F = cholfact!(C)
ERROR: Base.LinAlg.PosDefException(2)
Stacktrace:
[1] _chol!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}, ::Type{UpperTriangular}) at ./linalg/cholesky.jl:55
[2] cholfact!(::Hermitian{Float64,Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}}, ::Type{Val{false}}) at ./linalg/cholesky.jl:211
[3] cholfact!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}, ::Symbol) at ./linalg/cholesky.jl:256
[4] cholfact!(::Base.ReshapedArray{Float64,2,SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Tuple{}}) at ./linalg/cholesky.jl:255
``````

on Julia 0.6.2

1 Like

Ha 0.6. Great. I will update then.