The row swap functions have an option of checking if the input matrix contains NaN entries. However, the arguments of the function do not tell the row size of the input matrix.
Passing LDA instead of the unknown row size to the NaN checking function is not very good idea. The NaN checking function should not check the memory that is not part of the matrix.
As an option, the laswp function could have guessed the lower boundary on the row size of the matrix by scanning the pivot array first. This option does not look appealing too, because the guess may not give the actual row size of the matrix.
Even if the guess is correct, checking full matrix may be redundant. For instance, the pivot could describe just one interchange of the first and the last row, and the laswp function would have to check for NaNs the whole matrix while swapping just only two rows of it, which does not seem a good thing to do.
As yet another option, the function could do the NaN check only on the rows it interchanges. This would penetrate the NaN check into the computation and break the pattern of ‘first check, then compute’.
Perhaps, removing the NaN checking option from the LAPACKE_?laswp functions is the best option.
What do you think about this?
Thanks
Dmitry

