Skip to content

Commit

Permalink
Fix stackoverflow issue with dividing localoperator (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos authored Sep 9, 2024
1 parent aa54aef commit c51af18
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/operators/localoperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,8 @@ end
Base.:*(a::LocalOperator, b::Number) = rmul!(deepcopy(a), b)
Base.:*(a::Number, b::LocalOperator) = lmul!(a, deepcopy(b))

function LinearAlgebra.rdiv!(a::LocalOperator, b::Number)
rdiv!(first(a.opp), b)
return a
end
function LinearAlgebra.ldiv!(a::Number, b::LocalOperator)
ldiv!(a, first(b.opp))
return b
end

Base.:/(a::LocalOperator, b::Number) = deepcopy(a) / b
Base.:\(a::Number, b::LocalOperator) = a \ deepcopy(b)
Base.:/(a::LocalOperator, b::Number) = a * inv(b)
Base.:\(a::Number, b::LocalOperator) = inv(a) * b

function Base.:*(a::LocalOperator{T₁,G}, b::LocalOperator{T₂,G}) where {T₁,T₂,G}
inds = sort!(union(a.inds, b.inds))
Expand Down

0 comments on commit c51af18

Please sign in to comment.