Closed David-Berghaus closed 3 years ago
I agree that this won't lead to a significant performance regression, but I'd like to think some more about possible alternative solutions before merging this. Other methods are affected by this aliasing bug as well.
Finally merged in Flint so I will merge this as well. Thanks!
I noticed that most
mat_mul
-functions (withmat_mul_entrywise
being an exception) do not work properly for aliased window-matrices. The reason for this is thatmat_swap
destroys the entanglement of the window matrices with their parent matrix. This can be seen with the following code-snippet:Which produces:
As you can see,
A
no longer holds the correct result.My fix performs the pointer-swaps entrywise which makes sure that the corresponding parent object gets updated accordingly. We now have to do O(N^2) pointer-swaps instead of O(1) but the performance impact should be negligible.