-
Notifications
You must be signed in to change notification settings - Fork 210
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
Add PolynomialTensor class #756
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.
Some suggestions from my side. Other than that, this looks to be shaping up quite nicely 👍
Co-authored-by: Max Rossmannek <[email protected]>
Pull Request Test Coverage Report for Build 3052969424
💛 - Coveralls |
Co-authored-by: Max Rossmannek <[email protected]>
I had another discussion with @woodsp-ibm and we said that it might be beneficial to directly implement from collections.abc import Mapping
from typing import Iterator
class PolynomialTensor(..., Mapping):
...
def __getitem__(self, __k: str) -> np.ndarray | Number:
return self._data.__getitem__(__k)
def __len__(self) -> int:
return self._data.__len__()
def __iter__(self) -> Iterator[str]:
return self._data.__iter__() This will directly enable users to use |
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.
Please also double check the formatting of the docstrings. Especially PolynomialTensor
should always be written as a single word
Co-authored-by: Max Rossmannek <[email protected]>
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 some minor comments. Other than this, I think this is almost good to go 👍
Co-authored-by: Max Rossmannek <[email protected]>
Co-authored-by: Max Rossmannek <[email protected]>
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.
I'm happy with this as is! Thanks a lot, Saasha, for your continuous effort on this! 🙂
I'm sure that there will be some minor changes that I will be doing to this as I work on #666 but overall this looks like it is in very good shape to be merged now 👍
|
||
|
||
class PolynomialTensor(LinearMixin, AdjointMixin, TolerancesMixin, Mapping): | ||
"""PolynomialTensor class""" |
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.
For a future reviewer: I will flesh out this docstring in an upcoming PR when working on #666 👍
* adding PolynomialTensor class * adding unittest corresponding PolynomialTensor class; making changes to the class as suggested * adding conjugate and transpose functions * made changes to polynomial_tensor and test_polyomial_tensor files * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * updating polynomial_tensor and unittest * updating polynomial tensor and unittest * update unittest * updating polynomial_tensor file * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * update polynomial_tensor and test_polynomial_tensor * adding register_length to polynomial tensor * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * changes to polynomial_tensor - adding register_length * adding equiv method to polynomial_tensor. adding unittests for dunders * lint and mypy update * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * updating polynomial_tensor * Update qiskit_nature/second_q/operators/polynomial_tensor.py Co-authored-by: Max Rossmannek <[email protected]> * update polynomial_tensor Co-authored-by: Manoel Marques <[email protected]> Co-authored-by: Max Rossmannek <[email protected]> Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Max Rossmannek <[email protected]>
Summary
Adding a [draft] file for
PolynomialTensor
class.[WIP] corresponding unittest.
Closes #665
Details and comments
The PolynomialTensor class overrides:
_mul
and_add
functions fromStarAlgebraMixin
LinearMixin
conjugate
andtranspose
methods fromAdjointMixin
More brainstorming needs to be done forcompose
andadjoint
functions.