- status: open --> closed
If you call 'length(M)', you get the number of rows, but as far as I can see there is no easy way to get the number of columns in a matrix.
I have been using 'length(list_matrix_entries(row(M,1)))', but this is long and probably inefficient (?).
Can i suggest two new functions:
rows(M) - A synonym for length(M)
cols(M) - Returns the number of columns in a matrix
Thanks
Use matrix_size:
(%i42) matrix_size(matrix([1,2,3],[6,7,8]));
(%o42) [2,3]