Use p = sortperm(values) values = values[p] vectors = vectors[:,p]
but the values should already be sorted by the solver if your problem is Hermitian. 2015-01-24 19:55 GMT-05:00 <[email protected]>: > Anything that will sort matrices? Maybe I'm not asking the right question: > I want to sort some eigenvalues, and keep the eigenvectors mapped > accordingly. > > > On Saturday, January 24, 2015 at 7:34:08 PM UTC-5, Kirill Ignatiev wrote: >> >> >> >> On Saturday, 24 January 2015 19:00:14 UTC-5, [email protected] wrote: >>> >>> See the sort functionality in Matlab; the fourth usage case [B,I] = >>> sort(___) >>> >>> http://www.mathworks.com/help/matlab/ref/sort.html#bt83dd_-1 >>> >>> Is there a julia version or julia way? >>> >> >> sortperm seems to do approximately what you want: http://julia. >> readthedocs.org/en/latest/stdlib/sort/#Base.sortperm >> >> But it doesn't return a copy of the array, sorted, so you have to do "i = >> sortperm(x); y = x[i]". >> >> Note that sortperm! doesn't sort the array in-place, but rather uses a >> pre-allocated vector of indices. >> >
