Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jun 5, 2024
1 parent a1fea31 commit 4551c54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sparse_coeffs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ function Base.copy(sc::SparseCoefficients)
end

function Base.getindex(sc::SparseCoefficients{K}, key::K) where {K}
@show sc.basis_elements
@show key
k = searchsortedfirst(sc.basis_elements, key; lt = comparable(K))
@show k
@show eachindex(sc.basis_elements)
if k in eachindex(sc.basis_elements)
v = sc.values[k]
return ifelse(sc.basis_elements[k] == key, v, zero(v))
if sc.basis_elements[k] == key
return v
else
return zero(v)
end
else
return zero(valtype(sc))
end
Expand Down

0 comments on commit 4551c54

Please sign in to comment.