The test could fail in case of multiple entries with maximum absolute value in the randomly generated test matrix. The actual function to be tested basically looks through the matrix in a different order than the simple reference implementation that is compared with. That means that the two functions may find the maximum first at different entries.
To make this more robust, check in the simple implementation whether there are multiple entries that have the maximum absolute value. If so, only test for the absolute value to be equal. Otherwise, the full comparison of value, row and column index can be done as before.
The test could fail in case of multiple entries with maximum absolute value in the randomly generated test matrix. The actual function to be tested basically looks through the matrix in a different order than the simple reference implementation that is compared with. That means that the two functions may find the maximum first at different entries.
To make this more robust, check in the simple implementation whether there are multiple entries that have the maximum absolute value. If so, only test for the absolute value to be equal. Otherwise, the full comparison of value, row and column index can be done as before.
Fixes #144