I think I am just looking at all the elements of single row in line 174, the row I want to return, not all the elements of matrix. Sorry but I didn't got your point on returning a list? Can't list be considered as a valid matrix. This implementation has a small bug in line 178 which I am going to fix in a few hours.