I'm trying to use getrf to put a MxN matrix in RREF (get U, divide by leading entry) but either I'm misunderstanding the function description or something strange is going on. Now my understanding is that on return A contains both U and L, and IPIV contains the pivot indices (i.e. the index of the first non-zero entry in U on each row) to enable you to determine where L stops and U begins within A. But the values being return in IPIV often don't make any sense by this interpretation, with the returned index often referring to a point before or after the "actual" start of U, and in some cases they aren't even non-decreasing (i.e. [1,3,2,4,4]). I've confirmed through matlab that the U and L being returned in A are correct, but I can't make any sense of IPIV and without it I'm not able to automatically extract those two matrices from the returned A.
Am I missing something in what IPIV is, or does anyone have some advice on what might be going wrong?