Refactor Polynomial-Polynomial Addition in the Canonical Basis
Following recent changes in the MultiIndexSet
(see Issue #99 (closed)) and Grid
(see Issue #135) classes, the implementation of polynomial-polynomial addition and subtraction in the canonical basis shall be refactored.
The logic behind the addition/substraction is as follows: Given two polynomials in the canonical basis
- Check if the polynomials have a matching domain
- Add the underlying
Grid
instances (rely on the method of unionizing twoGrid
instances; see Issue #155 (closed)) - Add the underlying
MultiIndexSet
instances if they are not the same as the one attached to the respective instances (this is related to the notion "separate indices"). Adding twoMultiIndexSet
instances rely on the union method (see Issue #124 (closed)) - Process the coefficients; match the multi-index set elements and sum the coefficients of the matching elements.
- Create a new instance of polynomial with the new
Grid
instance, coefficients, and (when applicable)MultiIndexSet
instance.
This issue is part of extending the support for arithmetic operations involving polynomial (see Issue #142 (closed)).