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

Updated operators to print with hat #79

Closed
wants to merge 6 commits into from

Conversation

rbaliarizona
Copy link

Operators now print with hat on top

@rbaliarizona
Copy link
Author

@Krastanov my main goal here was to familiarize myself with the pull-request process. I personally like my operators to display with hats, but I know this isn't a law, so feel free to discard this change. Any feedback on if I went through the pull request process would be welcome though :)

@Krastanov
Copy link
Member

This is great, Rohan, thanks! I will run a review on it later today

Copy link
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

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

I love that the PR is small -- way easier to review and merge.

I left one inline comment on some code details.

There are a lot of failing tests. An easy way to run the tests locally and check things is to do ] test QuantumSymbolics -- that way you can find exactly which test is failing and focus on it.

Most of the tests here seem to be "doctests" that just lack a hat. There is an automated way to fix them (the fix argument to doctest function).

Happy to discuss testing more at the hackathon.

@@ -138,7 +138,7 @@ basis(x::SymQ) = x.basis

Base.show(io::IO, x::SKet) = print(io, "|$(symbollabel(x))⟩")
Base.show(io::IO, x::SBra) = print(io, "⟨$(symbollabel(x))|")
Base.show(io::IO, x::Union{SOperator,SHermitianOperator,SUnitaryOperator,SHermitianUnitaryOperator,SSuperOperator}) = print(io, "$(symbollabel(x))")
Base.show(io::IO, x::Union{SOperator,SHermitianOperator,SUnitaryOperator,SHermitianUnitaryOperator,SSuperOperator}) = print(io, "$(symbollabel(x))̂")
Copy link
Member

Choose a reason for hiding this comment

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

Two points:

  • we probably should insert the hat on the first letter (not all operators are a single symbol)

  • let's remove SSuperOperator from this list for the moment, as it has a bit more complicated printing

@rbaliarizona
Copy link
Author

@Krastanov thanks for the feedback!

I have updated the doctests. Hopefully they pass now.

I actually added logic to make the hat print on the middle character instead. I know this wasn't your suggestion and it may be more logic that we are looking for here. Lmk what you think!

@Krastanov Krastanov self-requested a review September 26, 2024 17:39
@Krastanov
Copy link
Member

Apologies, this dropped from my review queue and I forgot to get back to it. It should be reviewed sometime soon.

@Krastanov
Copy link
Member

apologies, it seems I messed up the merge with master. Let me try to fix that

@Krastanov
Copy link
Member

Darn, there are a few new places in the documentation where the hats need to be added. For now I will mark this as a draft as I will not have the time to make these changes. Apologies for the delay. Happy to pick it back up if you are interested in finishing it, but no pressure on that.

@Krastanov Krastanov marked this pull request as draft November 14, 2024 21:54
@rbaliarizona
Copy link
Author

Hi @Krastanov , thanks for looking at it. Unfortunately I think I will need to drop this, atleast for now.

@Krastanov
Copy link
Member

no worries!

@Krastanov Krastanov closed this Nov 15, 2024
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