Add Support for Polynomial-Polynomial Multiplication in the Canonical Basis
Currently, Minterpy does not yet support multiplication operation between polynomials in the canonical basis (for addition/subtraction see Issue #161 (closed)). While the canonical basis is not the preferred basis for computation in high-degree, they are still intuitive in low-dimension, low-degree and also useful for testing and sanity check.
The logic behind the multiplication is as follows: Given two polynomials in the canonical basis
- Check if the polynomials have a matching domain
- Multiply the underlying
Grid
instances (rely on the method of creating a product of twoGrid
instances; see Issue #154 (closed)) - Multiply 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"). Creating a product of twoMultiIndexSet
instances rely on the__mul__()
method (see Issue #125 (closed)) - Process the coefficients; match the sum of each element of the operands' multi-indices with the product multi-index set, multiply the coefficients before adding it to the product coefficients array at the matched location.
- Create a new instance of polynomial with the new
Grid
instance, coefficients, and (when applicable)MultiIndexSet
instance.
This approach shall follow the recent changes in the MultiIndexSet
(see Issue #99 (closed)) and Grid
(see Issue #135) classes.
This issue is part of extending the support for arithmetic operations involving polynomial (see Issue #142 (closed)).