Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with // in expintegrator in KrylovKit.jl v0.9 #114

Open
mtfishman opened this issue Jan 18, 2025 · 1 comment
Open

Issue with // in expintegrator in KrylovKit.jl v0.9 #114

mtfishman opened this issue Jan 18, 2025 · 1 comment

Comments

@mtfishman
Copy link

This call to // is causing issues in our TDVP code: https://github.com/Jutho/KrylovKit.jl/blob/v0.9.0/src/matrixfun/expintegrator.jl#L207 (which was introduced in #106, and included in KrylovKit.jl v0.9).

It looks like q is a floating point value, so // fails. This reproduces the issue:

julia> using KrylovKit

julia> exponentiate(randn(10, 10), 1.2, randn(10); krylovdim=2)
ERROR: MethodError: no method matching //(::Int64, ::Float64)
The function `//` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  //(::Number, ::Complex)
   @ Base rational.jl:101
  //(::LinearAlgebra.UniformScaling, ::Number)
   @ LinearAlgebra ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/uniformscaling.jl:273
  //(::AbstractArray, ::Number)
   @ Base rational.jl:104
  ...

Stacktrace:
 [1] expintegrator(A::Matrix{Float64}, t::Float64, u::Tuple{Vector{Float64}, Vector{Float64}}, alg::Arnoldi{ModifiedGramSchmidt2, Float64})
   @ KrylovKit ~/.julia/packages/KrylovKit/gFbJF/src/matrixfun/expintegrator.jl:207
 [2] expintegrator
   @ ~/.julia/dev/KrylovKit/src/matrixfun/expintegrator.jl:102 [inlined]
 [3] expintegrator(::Matrix{Float64}, ::Float64, ::Vector{Float64}; kwargs::@Kwargs{krylovdim::Int64})
   @ KrylovKit ~/.julia/packages/KrylovKit/gFbJF/src/matrixfun/expintegrator.jl:98
 [4] expintegrator
   @ ~/.julia/packages/KrylovKit/gFbJF/src/matrixfun/expintegrator.jl:94 [inlined]
 [5] #exponentiate#100
   @ ~/.julia/packages/KrylovKit/gFbJF/src/matrixfun/exponentiate.jl:83 [inlined]
 [6] top-level scope
   @ REPL[23]:1

julia> pkgversion(KrylovKit)
v"0.9.0"
@Jutho
Copy link
Owner

Jutho commented Jan 18, 2025

Thanks, that should indeed not be there. I tried this to fix a type instability when using single precision (Float32), but that was not the right solution. Rather, I just needed to fix type type of q, which I also did.

It is strange that this was not picked up by the tests, which probably means the while block surrounding it was never ran.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants