MathematicalSystems.jl icon indicating copy to clipboard operation
MathematicalSystems.jl copied to clipboard

Conversion from IdentityMultiple to Diagonal

Open mforets opened this issue 5 years ago • 1 comments

julia> convert(Matrix, I(2.0, 4))
4×4 Array{Float64,2}:
 2.0  0.0  0.0  0.0
 0.0  2.0  0.0  0.0
 0.0  0.0  2.0  0.0
 0.0  0.0  0.0  2.0

julia> using LinearAlgebra

julia> convert(Diagonal, I(2.0, 4))
ERROR: MethodError: Cannot `convert` an object of type IdentityMultiple{Float64} to an object of type Diagonal
Closest candidates are:
  convert(::Type{#s617} where #s617<:Diagonal, ::Union{LinearAlgebra.AbstractTriangular, Bidiagonal, Diagonal, SymTridiagonal, Tridiagonal}) at /buildworker/wor
ker/package_linux64/build/usr/share/julia/stdlib/v1.2/LinearAlgebra/src/special.jl:69
  convert(::Type{T<:AbstractArray}, ::T<:AbstractArray) where T<:AbstractArray at abstractarray.jl:14
  convert(::Type{T<:AbstractArray}, ::Factorization) where T<:AbstractArray at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/LinearAlgeb
ra/src/factorization.jl:46
  ...
Stacktrace:
 [1] top-level scope at REPL[7]:1

mforets avatar Feb 23 '20 11:02 mforets

With #189 this is not needed.

schillic avatar Feb 23 '20 11:02 schillic