#include "sortrows.h" #include "SortableRow.h" #include "sort.h" #include "colon.h" #include "IndexComparison.h" #include // Obsolete slower version converst to vector //template //IGL_INLINE void igl::sortrows( // const Eigen::PlainObjectBase& X, // const bool ascending, // Eigen::PlainObjectBase& Y, // Eigen::PlainObjectBase& IX) //{ // using namespace std; // using namespace Eigen; // typedef Eigen::Matrix RowVector; // vector > rows; // rows.resize(X.rows()); // // Loop over rows // for(int i = 0;i(ri); // } // vector > sorted; // std::vector index_map; // // Perform sort on rows // igl::sort(rows,ascending,sorted,index_map); // // Resize output // Y.resize(X.rows(),X.cols()); // IX.resize(X.rows(),1); // // Convert to eigen // for(int i = 0;i IGL_INLINE void igl::sortrows( const Eigen::PlainObjectBase& X, const bool ascending, Eigen::PlainObjectBase& Y, Eigen::PlainObjectBase& IX) { using namespace std; using namespace Eigen; using namespace igl; // Resize output Y.resize(X.rows(),X.cols()); IX.resize(X.rows(),1); for(int i = 0;i & >(X)); // if not ascending then reverse if(!ascending) { std::reverse(IX.data(),IX.data()+IX.size()); } for(int i = 0;i, Eigen::Matrix >(Eigen::PlainObjectBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::PlainObjectBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::PlainObjectBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::PlainObjectBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::PlainObjectBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::PlainObjectBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif