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

Method ambiguity with sparse matrices and operator assumptions #369

Closed
DanielVandH opened this issue Sep 12, 2023 · 2 comments
Closed

Method ambiguity with sparse matrices and operator assumptions #369

DanielVandH opened this issue Sep 12, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@DanielVandH
Copy link

julia> using LinearSolve, SparseArrays

julia> A = sparse(rand(3,3));

julia> b = rand(3);

julia> prob = LinearProblem(A, b);

julia> assumptions = LinearSolve.OperatorAssumptions(condition=LinearSolve.OperatorCondition.WellConditioned);

julia> solve(prob; assumptions)
ERROR: MethodError: defaultalg(::SparseMatrixCSC{Float64, Int64}, ::Vector{Float64}, ::OperatorAssumptions{Nothing}) is ambiguous.

Candidates:
  defaultalg(A::SparseArrays.AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti}, b, assump::OperatorAssumptions) where Ti
    @ LinearSolve C:\Users\User\.julia\packages\LinearSolve\19ohw\src\default.jl:79
  defaultalg(A, b, assump::OperatorAssumptions{Nothing})
    @ LinearSolve C:\Users\User\.julia\packages\LinearSolve\19ohw\src\default.jl:31
  defaultalg(A::SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, b, assump::OperatorAssumptions) where {Tv, Ti}
    @ LinearSolve C:\Users\User\.julia\packages\LinearSolve\19ohw\src\default.jl:69

Possible fix, define
  defaultalg(::SparseArrays.AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti}, ::Any, ::OperatorAssumptions{Nothing}) where Ti

Stacktrace:
 [1] init(::LinearProblem{…}, ::Nothing; assumptions::OperatorAssumptions{…}, kwargs::@Kwargs{})
   @ LinearSolve C:\Users\User\.julia\packages\LinearSolve\19ohw\src\default.jl:246
 [2] solve(::LinearProblem{…}; kwargs::@Kwargs{})
   @ LinearSolve C:\Users\User\.julia\packages\LinearSolve\19ohw\src\common.jl:187
 [3] top-level scope
   @ REPL[14]:1
Some type information was truncated. Use `show(err)` to see complete types.

On v1.10.0-beta2.

@ChrisRackauckas ChrisRackauckas added the good first issue Good for newcomers label Oct 26, 2023
@PaoloBiolghini
Copy link

Hi,
I have run exactly the same code now and it doesn't return any error;
maybe has been solve with some update of SparseArrays or idk :)

@ChrisRackauckas
Copy link
Member

It does seem to be fixed.

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

No branches or pull requests

3 participants