Implement equality checks for all polynomials
The __eq__
dunder method is added to MultivariatePolynomialSingleABC
to compare two polynomial instances for exact equality, considering:
- their concrete class,
- the underlying multi-index sets,
- the underlying grids, and
- the coefficients.
All of these attributes/properties must be equal in value for the polynomials to also be equal in value.
Both MultiIndexSet and Grid are conditions for equality because a polynomial of a given multi-index set may live on a grid of a multi-index superset. Two polynomials having the same multi-index set may live on two different grids and thus they cannot be consider equal.
For the coefficients, whose values are of floating types, the equality check is exact without any tolerance specification. In the future, a more loose comparison may be implemented via, say, a custom-made context manager.
Furthermore, associated equality and inequality tests are also added to ensure the functionality works as expected.
This MR should resolve Issue #138 (closed).