Say I have an array of 4 vectors, each vector being 5-dimensional. The current ordered declaration
ordered[5] a[4];
would take each of the 4 vectors and order the elements in each vector. Instead of this, I want to compare the 4 vectors by their first elements, then re-arrange the orders of the vectors - in this example, it would be re-arranging the rows of the array of vectors by the elements in the first column. Is there a good way to do this in Stan?