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

StaticArrays support #766

Open
gdalle opened this issue Aug 8, 2023 · 0 comments · May be fixed by #767
Open

StaticArrays support #766

gdalle opened this issue Aug 8, 2023 · 0 comments · May be fixed by #767

Comments

@gdalle
Copy link

gdalle commented Aug 8, 2023

At the moment, the solvers fail on StaticArrays

julia> using Krylov, StaticArrays

julia> A = rand(2, 2)
2×2 Matrix{Float64}:
 0.175316  0.379652
 0.908308  0.655592

julia> b = SVector{2}(rand(2))
2-element SVector{2, Float64} with indices SOneTo(2):
 0.4292733187710226
 0.6223773606304001

julia> A \ b
2-element Vector{Float64}:
 -0.19634658574195155
  1.2213703847547805

julia> gmres(A, b)
ERROR: MethodError: Cannot `convert` an object of type UndefInitializer to an object of type Float64

Closest candidates are:
  convert(::Type{T}, ::T) where T<:Number
   @ Base number.jl:6
  convert(::Type{T}, ::Number) where T<:Number
   @ Base number.jl:7
  convert(::Type{T}, ::Base.TwicePrecision) where T<:Number
   @ Base twiceprecision.jl:273
  ...

Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/StaticArraysCore/P6PH7/src/StaticArraysCore.jl:88 [inlined]
  [2] convert_ntuple
    @ ~/.julia/packages/StaticArraysCore/P6PH7/src/StaticArraysCore.jl:84 [inlined]
  [3] SVector{2, Float64}(x::Tuple{UndefInitializer, Int64})
    @ StaticArraysCore ~/.julia/packages/StaticArraysCore/P6PH7/src/StaticArraysCore.jl:120
  [4] SVector{2, Float64}(::UndefInitializer, ::Vararg{Any})
    @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/convert.jl:165
  [5] GmresSolver(m::Int64, n::Int64, memory::Int64, S::Type{SVector{2, Float64}})
    @ Krylov ~/.julia/packages/Krylov/Iuavd/src/krylov_solvers.jl:1549
  [6] GmresSolver(A::Matrix{Float64}, b::SVector{2, Float64}, memory::Int64)
    @ Krylov ~/.julia/packages/Krylov/Iuavd/src/krylov_solvers.jl:1567
  [7] gmres(A::Matrix{Float64}, b::SVector{2, Float64}; memory::Int64, M::LinearAlgebra.UniformScaling{Bool}, N::LinearAlgebra.UniformScaling{Bool}, ldiv::Bool, restart::Bool, reorthogonalization::Bool, atol::Float64, rtol::Float64, itmax::Int64, timemax::Float64, verbose::Int64, history::Bool, callback::Krylov.var"#164#171", iostream::Core.CoreSTDOUT)
    @ Krylov ~/.julia/packages/Krylov/Iuavd/src/gmres.jl:121
  [8] gmres(A::Matrix{Float64}, b::SVector{2, Float64})
    @ Krylov ~/.julia/packages/Krylov/Iuavd/src/gmres.jl:119
  [9] top-level scope
    @ REPL[7]:1
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

Successfully merging a pull request may close this issue.

1 participant