-
Notifications
You must be signed in to change notification settings - Fork 627
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
More fermionic dunders #4209
More fermionic dunders #4209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @lillian542. My main comment is about using arrays with length != 1
. I think that should not be allowed.
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
…lane into more_fermionic_dunders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review comments
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @lillian542!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small comment about rounding in tests. Conditionally approving based on that 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
* create fermiword class * create fermisentence class * [skip ci] modify order * [skip ci] remove unused import * [skip ci] add deepcopy method * [skip ci] replace list with generator * [skip ci] add tests * [skip ci] add tests * [skip ci] add tests * add tests * [skip ci] run black * [skip ci] copy fermiword * [skip ci] rebase and fix conflict * [skip ci] run black * [skip ci] copy fermiword * [skip ci] add tests * add test to tests_passing_pylint * add sum mult test * [skip ci] add tests * [skip ci] add pow tests * add tests * fix pylint * add error tests * fix pylint * add TODO * modify docstrings * update changelog * update changelog * modify docstrings * fix codecov * add code review comments * add test for indices * fix codefactor * multiply FermiWord and FermiSentence * add tests for fw * fs * add and test multiplying fermiword with integer or float * allow number times fermi sentence * update tests * Allow subtracting one FermiSentence from another * Allow substraction * clean up formatting and tests * Add multiplication by complex * Add more tests and reorganize * update change log * add test * black formatting * Add constants to FermiWord and FermiSentence * add tests * radd and rsub methods plus tests * missing lines for codecov * start adding support for tensors * numpy and pennylane numpy tensors plus tests for __add__ and __sub__ * add tests for multiplying by tensor * fix formatting issues post merge * add comment regarding overriding numpy dunders * Apply suggestions from code review Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> * check len of array before adding to FeriSentence * Raise error if array with len>2 is passed to arithmetic dunders * Apply suggestions from code review Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update doc/releases/changelog-dev.md * round to 10 digits --------- Co-authored-by: soranjh <soranjh@yahoo.com> Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Description of the Change:
__rmul__
toFermiWord
andFermiSentence
to handle things like2 * FermiWord
(int
,float
orcomplex
or numpyarray
multiplied byFermiWord
orFermiSentence
)__mul__
method to allow multiplication betweenFermiWord
,FermiSentence
,float
,int
,complex
or numpyarray
__add__
and__radd__
method to to bothFermiWord
andFermiSentence
to allow addition betweenFermiWord
,FermiSentence
and constants__sub__
and__rsub__
method to bothFermiWord
andFermiSentence
to allow subtraction betweenFermiWord
,FermiSentence
and constants