This is a regression in Julia 1.0. Consider this code
using LinearAlgebra
Umat = [ 4.10229+0.0im -0.00360251-2.02412im ; -0.00360251+2.02412im 1.30966+0.0im]
R = cholesky(Umat) ;
display(R)
V = Array(R) ;
display(V)
X = zeros(Complex{Float64}, 2, 2, 2) ;
X[2,:,:] = R ;
The output of this in Julia 1.0 is:
Cholesky{Complex{Float64},Array{Complex{Float64},2}}
U factor:
2×2 UpperTriangular{Complex{Float64},Array{Complex{Float64},2}}:
2.02541+0.0im -0.00177866-0.999363im
⋅ 0.557612+0.0im
2×2 Array{Complex{Float64},2}:
4.10229+0.0im -0.00360251-2.02412im
-0.00360251+2.02412im 1.30966+0.0im
ERROR: LoadError: MethodError: no method matching setindex_shape_check(::Cholesky{Complex{Float64},Array{Complex{Float64},2}}, ::Int64, ::Int64, ::Int64)
Closest candidates are:
setindex_shape_check(::AbstractArray, ::Integer…) at indices.jl:154
setindex_shape_check(::AbstractArray{#s57,1} where #s57, ::Integer, ::Integer) at indices.jl:196
setindex_shape_check(::AbstractArray{#s57,2} where #s57, ::Integer, ::Integer) at indices.jl:200
…
This code works perfectly in Julia 0.6.4 once cholesky is replaced with chol() and the using LinearAlgebra statement is removed.
So it appears that the Array() constructor fails to work with a triangular matrix as an argument. (It worked before). Furthermore there no longer appears to be a working auto-conversion to a dense matrix when I attempt to load the triangular matrix into a dense array.
Even worse, this fails
convert(Array{ComplexF64,2}, R)
with:
ERROR: MethodError: no method matching Array{Complex{Float64},2}(::Cholesky{Complex{Float64},Array{Complex{Float64},2}})
How am I supposed to convert these matrices to regular dense arrays when I need to?
Furthermore no matrix operations work on triangular matrices namely,
R’ * R
R+R
R * 2
etc.
I believe the fact that convert(Array, R) does not work properly, is definitely a bug, but my issue was immediately closed.
This is a big step back in usability, unless there is yet another way to convert to a dense matrix that is somehow hidden in the documentation.
FYI it appears that the conversion routines suggested revert R back to R’ * R
thus
Matrix ( R ) = R’ * R
How is this supposed to be helpful? There is no way to use the Cholesky factor at all with this convention.