Skip to content

1.12-rc3: Overload Array(::BunchKaufman) to fix Array(factorization(A)) #1461

@dlfivefifty

Description

@dlfivefifty

I ran into a missing overload in MatrixFactorizations.jl. I believe Array should be overloaded for BunchKaufman just like it is for Cholesky:

julia> A = Symmetric(randn(5,5)) + 100I;

julia> Array(cholesky(A))
5×5 Matrix{Float64}:
 100.064      -0.513683   0.0526112   -0.734536    0.402664
  -0.513683   99.7659    -0.520904    -0.025515   -0.299517
   0.0526112  -0.520904  98.3513       0.157766    0.239067
  -0.734536   -0.025515   0.157766   100.985      -1.34571
   0.402664   -0.299517   0.239067    -1.34571   100.884

julia> Array(cholesky(A))  A
true

julia> Array(bunchkaufman(A))  A
ERROR: MethodError: no method matching Array(::BunchKaufman{Float64, Matrix{Float64}, Vector{Int64}})
The type `Array` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Array(::Tridiagonal)
   @ LinearAlgebra ~/Projects/julia-1.12/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/tridiag.jl:624
  Array(::Schur)
   @ LinearAlgebra ~/Projects/julia-1.12/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/schur.jl:446
  Array(::LDLt)
   @ LinearAlgebra ~/Projects/julia-1.12/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/ldlt.jl:224
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[10]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions