OpenFermion icon indicating copy to clipboard operation
OpenFermion copied to clipboard

smbolic_operator.py::_issmall() could (should?) be a static member of SymbolicOperator

Open cvjjm opened this issue 4 years ago • 2 comments

smbolic_operator.py defines the function _issmall(). Unfortunately it is defined in the file but not part of the class, which is why derived classes cannot overwrite it.

I would like to request that _issmall() is made part of the class as a @staticmethod.

Background: I would like to implement a "vector valued" (numpy.ndarray values to be precise) subclass of QubitOperator. This is almost trivial, just the _issmall() check needs to compare the norm instead of abs(val) to tol.

cvjjm avatar Jan 18 '21 11:01 cvjjm

I can't see any potential issues with this. Do you want to make the change?

obriente avatar Jan 18 '21 11:01 obriente

OK. PR opened under #703 .

cvjjm avatar Jan 18 '21 12:01 cvjjm