19 Oct
2007
19 Oct
'07
1:42 p.m.
Hi, If I have a boost::numeric::ublas::vector<double> v, I can use the STL's sort and boost::lambda. sort(v.begin(), v.end(), _1<_2); How do I do the same with matrix<double>, using, say column 3 as sort key (i.e. I want to reorder the rows in the matrix by their 3rd entry)? sort(m.begin1(), m.end1(), _1[3]<_2[3]); won't do the trick, and I really have a hard time figuring out what does. In case it's not clear what I want, here's an example: [0,0,1,4 0,0,2,3 0,0,3,2 0,0,4,1] => [0,0,4,1 0,0,3,2 0,0,2,3 0,0,1,4] cheers, 'as