Skip to content

Commit c51af18

Browse files
authored
Fix stackoverflow issue with dividing localoperator (#25)
1 parent aa54aef commit c51af18

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/operators/localoperators.jl

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,8 @@ end
6666
Base.:*(a::LocalOperator, b::Number) = rmul!(deepcopy(a), b)
6767
Base.:*(a::Number, b::LocalOperator) = lmul!(a, deepcopy(b))
6868

69-
function LinearAlgebra.rdiv!(a::LocalOperator, b::Number)
70-
rdiv!(first(a.opp), b)
71-
return a
72-
end
73-
function LinearAlgebra.ldiv!(a::Number, b::LocalOperator)
74-
ldiv!(a, first(b.opp))
75-
return b
76-
end
77-
78-
Base.:/(a::LocalOperator, b::Number) = deepcopy(a) / b
79-
Base.:\(a::Number, b::LocalOperator) = a \ deepcopy(b)
69+
Base.:/(a::LocalOperator, b::Number) = a * inv(b)
70+
Base.:\(a::Number, b::LocalOperator) = inv(a) * b
8071

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

0 commit comments

Comments
 (0)