nmatrix icon indicating copy to clipboard operation
nmatrix copied to clipboard

Rename clapack_laswp

Open wlevine opened this issue 9 years ago • 6 comments

We have a function called clapack_laswp, which permutes columns, but as far as I can tell, there is no equivalent function called clapack_?laswp in ATLAS, or anywhere else in the world (if you google clapack_laswp, you just end up with results for nmatrix). John, do you remember where this code came from? There is a standard laswp function in LAPACK, but it exchanges rows instead of columns. So at the least, I think we should rename this to prevent confusion.

Furthermore, it seems like when calling clapack_laswp the last element of the pivot vector is ignored, although I am not really sure how this is supposed to work.

Also, we have #laswp! method for NMatrix, which behaves differently from the clapack_laswp and friends, due to #346. I think the default "intuitive" behavior is good for a method #permute_columns, but not for a method name #laswp, since all the other functions called *laswp behave differently. So I guess I think that #permute_columns and #laswp should be different methods with different behavior and not aliased to each other.

wlevine avatar Jul 20 '15 23:07 wlevine

The only reason ours does columns is our storage format. It's a clone of the algorithm, and it was called by some other ATLAS functions (which I may or may not have had time to implement).

translunar avatar Jul 21 '15 13:07 translunar

Yeah, but every other function we've adapted to have the expected behavior when operating on row-major matrices. That's why I think we should rename this one.

wlevine avatar Jul 21 '15 15:07 wlevine

If it's not used, I'd say we should just remove it.

translunar avatar Jul 21 '15 15:07 translunar

It's used internally in our C code. I don't know if anyone uses the ruby interface, maybe @agisga, since he submitted #346

wlevine avatar Jul 21 '15 21:07 wlevine

Okay. I say go ahead and rename it.

translunar avatar Jul 21 '15 21:07 translunar

I don't know if anyone uses the ruby interface, maybe @agisga, since he submitted #346

I have used #permute_columns! in the unmerged pull request #336 only. That's when the issue with the unintuitive behaviour of the method came up. I still want to improve some things in said pull request, and I can adapt it to any new behaviour of #permute_columns at the same time.

agisga avatar Jul 21 '15 22:07 agisga