Hello, I am thinking about doing a matrix RREF function, am still in the research stage, but I thought I should post a bug I have been having. The following code doesn't work. What I am trying to do is orderby the array index [0], and then by [i...] etc. Here is the code I have been having trouble with. I am trying to break the orderby decending, and thenby operations up onto multiple lines as I build the query so I can have a looping like action. I think it doesn't matter which rows you swap in RREF as long as the row with the 0 on the front is at the bottom, and the larger numbers are at the top, but I could be wrong, it has been a while since I had a math class, and I am going to have to sift through my books. I may be attempting to break some LINQ rules here, I don't know. Please enlighten me as I am new to LINQ.
public static IEnumerable<int[]> OrderByMatrixRows(this int[][] jagged) {
IEnumerable<int[]> query = jagged.OrderByDescending(row => row[0]);
for (int i = 1; i < jagged.Length; i++) {
//the following line errors out
query = query.ThenBy(row => row[i]);
}//end loop
return query;
}//end method
If I can't do this with LINQ I will have to figure out some other way of doing so. Also if you all have any good sources for re-learning RREF please post em.