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

Define + for LocalOperators #63

Merged
merged 8 commits into from
Aug 21, 2024
Merged

Define + for LocalOperators #63

merged 8 commits into from
Aug 21, 2024

Conversation

Gertian
Copy link
Contributor

@Gertian Gertian commented Aug 19, 2024

I defined addition for Localoperators

I defined additional for Localoperators
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

Maybe in the meantime it might be convenient to also add -, and scalar multiplication?

src/operators/localoperator.jl Outdated Show resolved Hide resolved
src/operators/localoperator.jl Outdated Show resolved Hide resolved
@Gertian
Copy link
Contributor Author

Gertian commented Aug 20, 2024

Maybe in the meantime it might be convenient to also add -, and scalar multiplication?

Sure, I didn't need those so I didn't think of it.
I'll get to it in the near future.

1) Overloaded checklattice for two LocalOperators
2)Changed LocalOperator+LocalOperator such that its more efficient when duplicate indices appear
3)Defined Number*LocalOperator
4)Defined - using + and *
@Gertian
Copy link
Contributor Author

Gertian commented Aug 20, 2024

It might be useful to also check when H1 - H2 contains operators that are 0 that can therefore be thrown away.
The issue is that this requires some sort of tolerance which is a bit ambiguous.

Any suggestions/preferences ? Or do we just ignore this subtlety ?

@lkdvos
Copy link
Member

lkdvos commented Aug 20, 2024

Honestly, maybe we just add a default tolerance for that? something like norm < eps^(3/4) (1e-12) sounds reasonable to me.
I think the cleaner approach is then to just ignore this in the + methods, and just handle this in the constructor (where we can have the tolerance as a kwarg).

@Gertian
Copy link
Contributor Author

Gertian commented Aug 20, 2024

Okay. I'll implement it like that.

Gertian and others added 5 commits August 20, 2024 17:53
1) Extended LocalOperator constructor so that it eliminates operators with norm < tolerance. 
2) Used this to make + - * implementations more streamlined
@lkdvos
Copy link
Member

lkdvos commented Aug 21, 2024

I made some slight changes and added a very basic docstring, thanks for getting this started!
Once the tests turn green, I think this is good to go from my side.

@lkdvos lkdvos requested a review from pbrehmer August 21, 2024 08:29
@Gertian
Copy link
Contributor Author

Gertian commented Aug 21, 2024

I made some slight changes and added a very basic docstring, thanks for getting this started! Once the tests turn green, I think this is good to go from my side.

This all looks great for me. And you're welcome ! :)

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 61.76471% with 13 lines in your changes missing coverage. Please review.

Files Patch % Lines
src/operators/localoperator.jl 61.76% 13 Missing ⚠️
Files Coverage Δ
src/operators/localoperator.jl 74.57% <61.76%> (-19.71%) ⬇️

Copy link
Collaborator

@pbrehmer pbrehmer left a comment

Choose a reason for hiding this comment

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

Also looks great to me, thanks for that! :-)

@pbrehmer pbrehmer merged commit 76e25d9 into QuantumKitHub:master Aug 21, 2024
8 of 9 checks passed
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.

3 participants