Skip to content

Implement multiplication operation for Grid instances

Damar Wicaksono requested to merge dev-154-a into dev

By implementing the dunder method __mul__() for Grid class, instances of the class may now be multiplied with each other.

A multiplication between two Grid instances returns a new Grid instance with a multi-index set that is the product of the multi-index sets of the operands.

Additionally:

  • The test suite has been updated to include the changes.
  • A how-to guide on Grid multiplication has been added to the docs.
  • The method expand_dim() may now accept another instance of Grid as the target dimension. It means that the current instance shall be expanded to the dimension of the target grid as long as the underlying generating function or points are compatible. In essence, it has a built-in error checking.
  • Generating points of higher dimension (i.e., more columns) than the multi-index set may now be specified for the construction of Grid instance.
  • The method merge() for the Grid class has been implemented to support the common operation of dimension expansion, multiplication, and addition.

This MR should resolve Issue #154 (closed) and part of the refactoring and update of the Grid class (see Issue #135).

Merge request reports

Loading