Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1424: Fix matrix multiplication at boundaries r=dennisYatunin a=dennisYatunin Peeled off from #1399. Fixes a bug in matrix-matrix multiplication (i.e., the `MultiplyColumnwiseBandMatrixField()` operator with two matrix fields as inputs) that was causing entries from outside the second input matrix to be used in the computation of entries outside the product matrix. These entries are used for padding, allowing us to store the nonzero entries of band matrices in `Field`s with rectangular parent arrays, so using them during the computation of matrix-matrix products leads to an unnecessary performance loss. Moreover, it breaks the assumption that these outside entries have no effect on program behavior. In addition to fixing the bug, this PR - Updates the documentation of `MultiplyColumnwiseBandMatrixField` to reflect the change. - Adds a unit test which ensures that outside entries are never used during matrix-matrix multiplication. - Simplifies some of the code for `MultiplyColumnwiseBandMatrixField`, making sure that it reflects the updated documentation as closely as possible. - Introduces the `column_axes(matrix_field)` utility function, which can be used to obtain the space that corresponds to the columns of `matrix_field` (as opposed to `axes(matrix_field)`, which corresponds to the rows). This function simplifies the computation of interior/boundary indices during matrix multiplication. - Fixes a type instability in `field2arrays` and updates the corresponding unit test. This also decreases the memory allocated by the new unit test for outside entries. - Modifies the `show` method for matrix `Field`s so that it also displays the matrix shape. Co-authored-by: Dennis Yatunin <[email protected]>
- Loading branch information