Skip to content

cholesky specialized methods aren't triggering #80

@cgeoga

Description

@cgeoga

Thanks again for the great package. Based on looking at the source, I would expect the following code to work and give me the hierarchical Cholesky approximation:

using HMatrices, StaticArrays

pts = rand(SVector{2,Float64}, 1000)
km  = KernelMatrix((x,y)->exp(-norm(x-y)), pts, pts)
hk  = assemble_hmatrix(km, atol=1e-10)
hkf = cholesky(hk; atol=1e-8)

But instead I get this error:

cg:hmatrices_chol> jp demo.jl 
ERROR: LoadError: MethodError: no method matching cholesky(::HMatrix{ClusterTree{2, Float64}, Float64}, ::NoPivot; atol::Float64)
This error has been manually thrown, explicitly, so the method may exist but be intentionally marked as unimplemented.

Closest candidates are:
  cholesky(::AbstractMatrix, ::NoPivot; check) got unsupported keyword argument "atol"
   @ LinearAlgebra ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:401
  cholesky(::SymTridiagonal, ::NoPivot; check) got unsupported keyword argument "atol"
   @ LinearAlgebra ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/tridiag.jl:909
  cholesky(::Union{Hermitian{var"#s5021", var"#s5020"}, Hermitian{Complex{var"#s5021"}, var"#s5020"}, Symmetric{var"#s5021", var"#s5020"}} where {var"#s5021"<:Real, var"#s5020"<:SymTridiagonal}, ::NoPivot; check) got unsupported keyword argument "atol"
   @ LinearAlgebra ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/LinearAlgebra/src/special.jl:467
  ...

Stacktrace:
 [1] kwerr(::@NamedTuple{atol::Float64}, ::Function, ::HMatrix{ClusterTree{2, Float64}, Float64}, ::NoPivot)
   @ Base ./error.jl:165
 [2] top-level scope
   @ ~/Scratch/hmatrices_chol/demo.jl:8

And playing with @which on the call of just cholesky(hk) shows that it just falls back to the default indexed routines in LinearAlgebra.

Am I doing something wrong with types here? Or is this something that should work? It is honestly kind of confusing to me why your special methods aren't getting triggered, because from looking at the source I would expect that to work.

Thanks in advance!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions