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

Fix stackoverflow issue with dividing localoperator #25

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Conversation

lkdvos
Copy link
Member

@lkdvos lkdvos commented Sep 9, 2024

No description provided.

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/operators/localoperators.jl 0.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/operators/localoperators.jl 60.52% <0.00%> (+4.42%) ⬆️

@lkdvos lkdvos merged commit c51af18 into master Sep 9, 2024
8 of 9 checks passed
@lkdvos lkdvos deleted the ld-fix-divide branch September 9, 2024 15:24
@@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lkdvos , could you explain why this would give a stack overflow ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous definition was a / b = deepcopy(a) / b, and because the deepcopy does not change the type that just recurses infinitely. It should have been rdiv!(deepcopy(a), b), but it seems like either rdiv or ldiv was not defined for tensor maps, (and braiding tensors), so I just simplified the entire thing a bit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, that's funny !
Thanks for taking the time to explain :)

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 this pull request may close these issues.

2 participants