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

`cholesky` should not error with `check=false`

Open jishnub opened this issue 2 years ago • 1 comments

julia> B = BandedMatrix(-3=> 2ones(2), -1=>ones(4), 0=>2ones(5)); Buplo = :L; SB = Symmetric(B, Buplo);

julia> cholesky(Matrix(SB), check = false)
Failed factorization of type Cholesky{Float64, Matrix{Float64}}

julia> cholesky(SB, check = false)
ERROR: LAPACKException(4)
Stacktrace:
  [1] chklapackerror(ret::Int64)
    @ LinearAlgebra.LAPACK ~/packages/julias/julia-1.7/share/julia/stdlib/v1.7/LinearAlgebra/src/lapack.jl:43
  [2] pbtrf!(uplo::Char, m::Int64, kd::Int64, A::Matrix{Float64})
    @ BandedMatrices ~/Dropbox/JuliaPackages/BandedMatrices.jl/src/lapack.jl:215
  [3] banded_chol!
    @ ~/Dropbox/JuliaPackages/BandedMatrices.jl/src/symbanded/BandedCholesky.jl:10 [inlined]
  [4] banded_chol!
    @ ~/Dropbox/JuliaPackages/BandedMatrices.jl/src/symbanded/BandedCholesky.jl:68 [inlined]
  [5] _chol!
    @ ~/Dropbox/JuliaPackages/BandedMatrices.jl/src/symbanded/BandedCholesky.jl:70 [inlined]
  [6] _chol!
    @ ~/.julia/packages/ArrayLayouts/DX7ic/src/factorizations.jl:368 [inlined]
  [7] _cholesky!(layout::ArrayLayouts.SymmetricLayout{BandedMatrices.BandedColumns{ArrayLayouts.DenseColumnMajor}}, axes::Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, A::Symmetric{Float64, BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, ::Val{false}; check::Bool)
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/lOmzi/src/factorizations.jl:371
  [8] #cholesky!#22
    @ ~/.julia/packages/ArrayLayouts/DX7ic/src/factorizations.jl:407 [inlined]
  [9] #_cholesky#23
    @ ~/Dropbox/JuliaPackages/BandedMatrices.jl/src/symbanded/BandedCholesky.jl:96 [inlined]
 [10] cholesky(A::Symmetric{Float64, BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}}, v::Val{false}; kwds::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:check,), Tuple{Bool}}})
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/lOmzi/src/ArrayLayouts.jl:183
 [11] top-level scope
    @ REPL[52]:1

The factorization should return an output with a failure error code instead of erroring.

jishnub avatar Jul 25 '22 13:07 jishnub

Hmm probably somewhere on the change we are forgetting ; kwds... type pass-throughs. Essentially we need to do something like:

https://github.com/JuliaMatrices/ArrayLayouts.jl/commit/c20d16d3b82269619eb867898462a86e57cbcbd2

dlfivefifty avatar Jul 27 '22 10:07 dlfivefifty