sort.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "sort.h"
  9. #include "SortableRow.h"
  10. #include "slice.h"
  11. #include "IndexComparison.h"
  12. #include "colon.h"
  13. #include "parallel_for.h"
  14. #include <cassert>
  15. #include <algorithm>
  16. #include <iostream>
  17. template <typename DerivedX, typename DerivedY, typename DerivedIX>
  18. IGL_INLINE void igl::sort(
  19. const Eigen::DenseBase<DerivedX>& X,
  20. const int dim,
  21. const bool ascending,
  22. Eigen::PlainObjectBase<DerivedY>& Y,
  23. Eigen::PlainObjectBase<DerivedIX>& IX)
  24. {
  25. typedef typename DerivedX::Scalar Scalar;
  26. // get number of rows (or columns)
  27. int num_inner = (dim == 1 ? X.rows() : X.cols() );
  28. // Special case for swapping
  29. switch(num_inner)
  30. {
  31. default:
  32. break;
  33. case 2:
  34. return igl::sort2(X,dim,ascending,Y,IX);
  35. case 3:
  36. return igl::sort3(X,dim,ascending,Y,IX);
  37. }
  38. // get number of columns (or rows)
  39. int num_outer = (dim == 1 ? X.cols() : X.rows() );
  40. // dim must be 2 or 1
  41. assert(dim == 1 || dim == 2);
  42. // Resize output
  43. Y.resizeLike(X);
  44. IX.resizeLike(X);
  45. // idea is to process each column (or row) as a std vector
  46. // loop over columns (or rows)
  47. for(int i = 0; i<num_outer;i++)
  48. {
  49. // Unsorted index map for this column (or row)
  50. std::vector<size_t> index_map(num_inner);
  51. std::vector<Scalar> data(num_inner);
  52. for(int j = 0;j<num_inner;j++)
  53. {
  54. if(dim == 1)
  55. {
  56. data[j] = (Scalar) X(j,i);
  57. }else
  58. {
  59. data[j] = (Scalar) X(i,j);
  60. }
  61. }
  62. // sort this column (or row)
  63. igl::sort( data, ascending, data, index_map);
  64. // Copy into Y and IX
  65. for(int j = 0;j<num_inner;j++)
  66. {
  67. if(dim == 1)
  68. {
  69. Y(j,i) = data[j];
  70. IX(j,i) = index_map[j];
  71. }else
  72. {
  73. Y(i,j) = data[j];
  74. IX(i,j) = index_map[j];
  75. }
  76. }
  77. }
  78. }
  79. template <typename DerivedX, typename DerivedY>
  80. IGL_INLINE void igl::sort(
  81. const Eigen::DenseBase<DerivedX>& X,
  82. const int dim,
  83. const bool ascending,
  84. Eigen::PlainObjectBase<DerivedY>& Y)
  85. {
  86. Eigen::Matrix< int, DerivedX::RowsAtCompileTime, DerivedX::ColsAtCompileTime > IX;
  87. return sort(X,dim,ascending,Y,IX);
  88. }
  89. template <typename DerivedX, typename DerivedY, typename DerivedIX>
  90. IGL_INLINE void igl::sort_new(
  91. const Eigen::DenseBase<DerivedX>& X,
  92. const int dim,
  93. const bool ascending,
  94. Eigen::PlainObjectBase<DerivedY>& Y,
  95. Eigen::PlainObjectBase<DerivedIX>& IX)
  96. {
  97. // get number of rows (or columns)
  98. int num_inner = (dim == 1 ? X.rows() : X.cols() );
  99. // Special case for swapping
  100. switch(num_inner)
  101. {
  102. default:
  103. break;
  104. case 2:
  105. return igl::sort2(X,dim,ascending,Y,IX);
  106. case 3:
  107. return igl::sort3(X,dim,ascending,Y,IX);
  108. }
  109. // get number of columns (or rows)
  110. int num_outer = (dim == 1 ? X.cols() : X.rows() );
  111. // dim must be 2 or 1
  112. assert(dim == 1 || dim == 2);
  113. // Resize output
  114. Y.resizeLike(X);
  115. IX.resizeLike(X);
  116. // idea is to process each column (or row) as a std vector
  117. // loop over columns (or rows)
  118. for(int i = 0; i<num_outer;i++)
  119. {
  120. Eigen::VectorXi ix;
  121. colon(0,num_inner-1,ix);
  122. // Sort the index map, using unsorted for comparison
  123. if(dim == 1)
  124. {
  125. std::sort(
  126. ix.data(),
  127. ix.data()+ix.size(),
  128. igl::IndexVectorLessThan<const typename DerivedX::ConstColXpr >(X.col(i)));
  129. }else
  130. {
  131. std::sort(
  132. ix.data(),
  133. ix.data()+ix.size(),
  134. igl::IndexVectorLessThan<const typename DerivedX::ConstRowXpr >(X.row(i)));
  135. }
  136. // if not ascending then reverse
  137. if(!ascending)
  138. {
  139. std::reverse(ix.data(),ix.data()+ix.size());
  140. }
  141. for(int j = 0;j<num_inner;j++)
  142. {
  143. if(dim == 1)
  144. {
  145. Y(j,i) = X(ix[j],i);
  146. IX(j,i) = ix[j];
  147. }else
  148. {
  149. Y(i,j) = X(i,ix[j]);
  150. IX(i,j) = ix[j];
  151. }
  152. }
  153. }
  154. }
  155. template <typename DerivedX, typename DerivedY, typename DerivedIX>
  156. IGL_INLINE void igl::sort2(
  157. const Eigen::DenseBase<DerivedX>& X,
  158. const int dim,
  159. const bool ascending,
  160. Eigen::PlainObjectBase<DerivedY>& Y,
  161. Eigen::PlainObjectBase<DerivedIX>& IX)
  162. {
  163. typedef typename DerivedY::Scalar YScalar;
  164. Y = X.derived().template cast<YScalar>();
  165. // get number of columns (or rows)
  166. int num_outer = (dim == 1 ? X.cols() : X.rows() );
  167. // get number of rows (or columns)
  168. int num_inner = (dim == 1 ? X.rows() : X.cols() );
  169. assert(num_inner == 2);(void)num_inner;
  170. typedef typename DerivedIX::Scalar Index;
  171. IX.resizeLike(X);
  172. if(dim==1)
  173. {
  174. IX.row(0).setConstant(0);// = DerivedIX::Zero(1,IX.cols());
  175. IX.row(1).setConstant(1);// = DerivedIX::Ones (1,IX.cols());
  176. }else
  177. {
  178. IX.col(0).setConstant(0);// = DerivedIX::Zero(IX.rows(),1);
  179. IX.col(1).setConstant(1);// = DerivedIX::Ones (IX.rows(),1);
  180. }
  181. // loop over columns (or rows)
  182. for(int i = 0;i<num_outer;i++)
  183. {
  184. YScalar & a = (dim==1 ? Y(0,i) : Y(i,0));
  185. YScalar & b = (dim==1 ? Y(1,i) : Y(i,1));
  186. Index & ai = (dim==1 ? IX(0,i) : IX(i,0));
  187. Index & bi = (dim==1 ? IX(1,i) : IX(i,1));
  188. if((ascending && a>b) || (!ascending && a<b))
  189. {
  190. std::swap(a,b);
  191. std::swap(ai,bi);
  192. }
  193. }
  194. }
  195. template <typename DerivedX, typename DerivedY, typename DerivedIX>
  196. IGL_INLINE void igl::sort3(
  197. const Eigen::DenseBase<DerivedX>& X,
  198. const int dim,
  199. const bool ascending,
  200. Eigen::PlainObjectBase<DerivedY>& Y,
  201. Eigen::PlainObjectBase<DerivedIX>& IX)
  202. {
  203. typedef typename DerivedY::Scalar YScalar;
  204. Y = X.derived().template cast<YScalar>();
  205. Y.resizeLike(X);
  206. for(int j=0;j<X.cols();j++)for(int i=0;i<X.rows();i++)Y(i,j)=(YScalar)X(i,j);
  207. // get number of columns (or rows)
  208. int num_outer = (dim == 1 ? X.cols() : X.rows() );
  209. // get number of rows (or columns)
  210. int num_inner = (dim == 1 ? X.rows() : X.cols() );
  211. assert(num_inner == 3);(void)num_inner;
  212. typedef typename DerivedIX::Scalar Index;
  213. IX.resizeLike(X);
  214. if(dim==1)
  215. {
  216. IX.row(0).setConstant(0);// = DerivedIX::Zero(1,IX.cols());
  217. IX.row(1).setConstant(1);// = DerivedIX::Ones (1,IX.cols());
  218. IX.row(2).setConstant(2);// = DerivedIX::Ones (1,IX.cols());
  219. }else
  220. {
  221. IX.col(0).setConstant(0);// = DerivedIX::Zero(IX.rows(),1);
  222. IX.col(1).setConstant(1);// = DerivedIX::Ones (IX.rows(),1);
  223. IX.col(2).setConstant(2);// = DerivedIX::Ones (IX.rows(),1);
  224. }
  225. const auto & inner = [&IX,&Y,&dim,&ascending](const Index & i)
  226. {
  227. YScalar & a = (dim==1 ? Y.coeffRef(0,i) : Y.coeffRef(i,0));
  228. YScalar & b = (dim==1 ? Y.coeffRef(1,i) : Y.coeffRef(i,1));
  229. YScalar & c = (dim==1 ? Y.coeffRef(2,i) : Y.coeffRef(i,2));
  230. Index & ai = (dim==1 ? IX.coeffRef(0,i) : IX.coeffRef(i,0));
  231. Index & bi = (dim==1 ? IX.coeffRef(1,i) : IX.coeffRef(i,1));
  232. Index & ci = (dim==1 ? IX.coeffRef(2,i) : IX.coeffRef(i,2));
  233. if(ascending)
  234. {
  235. // 123 132 213 231 312 321
  236. if(a > b)
  237. {
  238. std::swap(a,b);
  239. std::swap(ai,bi);
  240. }
  241. // 123 132 123 231 132 231
  242. if(b > c)
  243. {
  244. std::swap(b,c);
  245. std::swap(bi,ci);
  246. // 123 123 123 213 123 213
  247. if(a > b)
  248. {
  249. std::swap(a,b);
  250. std::swap(ai,bi);
  251. }
  252. // 123 123 123 123 123 123
  253. }
  254. }else
  255. {
  256. // 123 132 213 231 312 321
  257. if(a < b)
  258. {
  259. std::swap(a,b);
  260. std::swap(ai,bi);
  261. }
  262. // 213 312 213 321 312 321
  263. if(b < c)
  264. {
  265. std::swap(b,c);
  266. std::swap(bi,ci);
  267. // 231 321 231 321 321 321
  268. if(a < b)
  269. {
  270. std::swap(a,b);
  271. std::swap(ai,bi);
  272. }
  273. // 321 321 321 321 321 321
  274. }
  275. }
  276. };
  277. parallel_for(num_outer,inner,16000);
  278. }
  279. template <class T>
  280. IGL_INLINE void igl::sort(
  281. const std::vector<T> & unsorted,
  282. const bool ascending,
  283. std::vector<T> & sorted,
  284. std::vector<size_t> & index_map)
  285. {
  286. // Original unsorted index map
  287. index_map.resize(unsorted.size());
  288. for(size_t i=0;i<unsorted.size();i++)
  289. {
  290. index_map[i] = i;
  291. }
  292. // Sort the index map, using unsorted for comparison
  293. std::sort(
  294. index_map.begin(),
  295. index_map.end(),
  296. igl::IndexLessThan<const std::vector<T>& >(unsorted));
  297. // if not ascending then reverse
  298. if(!ascending)
  299. {
  300. std::reverse(index_map.begin(),index_map.end());
  301. }
  302. // make space for output without clobbering
  303. sorted.resize(unsorted.size());
  304. // reorder unsorted into sorted using index map
  305. igl::slice(unsorted,index_map,sorted);
  306. }
  307. #ifdef IGL_STATIC_LIBRARY
  308. // Explicit template instantiation
  309. template void igl::sort<std::int64_t>(std::vector<std::int64_t, std::allocator<std::int64_t>> const&, bool, std::vector<std::int64_t, std::allocator<std::int64_t>>&, std::vector<size_t, std::allocator<size_t>>&);
  310. // generated by autoexplicit.sh
  311. template void igl::sort<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  312. // generated by autoexplicit.sh
  313. template void igl::sort<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
  314. // generated by autoexplicit.sh
  315. template void igl::sort<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  316. // generated by autoexplicit.sh
  317. template void igl::sort<Eigen::Matrix<unsigned int, -1, 2, 0, -1, 2>, Eigen::Matrix<unsigned int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<unsigned int, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, -1, 0, -1, -1> >&);
  318. // generated by autoexplicit.sh
  319. template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  320. // generated by autoexplicit.sh
  321. template void igl::sort<Eigen::Matrix<int, 1, 3, 1, 1, 3>, Eigen::Matrix<int, 1, 3, 1, 1, 3> >(Eigen::DenseBase<Eigen::Matrix<int, 1, 3, 1, 1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, 1, 3, 1, 1, 3> >&);
  322. // generated by autoexplicit.sh
  323. template void igl::sort<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1>, 1, -1, false>, Eigen::Matrix<int, 1, 3, 1, 1, 3> >(Eigen::DenseBase<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1>, 1, -1, false> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, 1, 3, 1, 1, 3> >&);
  324. // generated by autoexplicit.sh
  325. template void igl::sort<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3>, Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >(Eigen::DenseBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<unsigned int, -1, 3, 1, -1, 3> >&);
  326. // generated by autoexplicit.sh
  327. template void igl::sort<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
  328. // generated by autoexplicit.sh
  329. template void igl::sort<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  330. // generated by autoexplicit.sh
  331. template void igl::sort<Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
  332. // generated by autoexplicit.sh
  333. template void igl::sort<Eigen::Matrix<double, -1, -1, 1, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 1, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  334. // generated by autoexplicit.sh
  335. template void igl::sort<Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  336. // generated by autoexplicit.sh
  337. template void igl::sort<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  338. // generated by autoexplicit.sh
  339. template void igl::sort<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  340. template void igl::sort<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  341. template void igl::sort<int>(std::vector<int, std::allocator<int> > const&, bool, std::vector<int, std::allocator<int> >&, std::vector<size_t,class std::allocator<size_t> > &);
  342. template void igl::sort<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  343. template void igl::sort<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  344. template void igl::sort<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  345. template void igl::sort<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  346. template void igl::sort<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  347. template void igl::sort<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  348. template void igl::sort_new<Eigen::Matrix<int, 1, 6, 1, 1, 6>, Eigen::Matrix<int, 1, 6, 1, 1, 6>, Eigen::Matrix<int, 1, 6, 1, 1, 6> >(Eigen::DenseBase<Eigen::Matrix<int, 1, 6, 1, 1, 6> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, 1, 6, 1, 1, 6> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, 1, 6, 1, 1, 6> >&);
  349. template void igl::sort<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&);
  350. template void igl::sort<Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<double, -1, 4, 0, -1, 4>, Eigen::Matrix<int, -1, 4, 0, -1, 4> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 4, 0, -1, 4> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 4, 0, -1, 4> >&);
  351. template void igl::sort<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  352. template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  353. template void igl::sort<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  354. template void igl::sort<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  355. template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  356. template void igl::sort<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  357. template void igl::sort<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  358. template void igl::sort<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  359. template void igl::sort<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  360. template void igl::sort<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
  361. template void igl::sort<Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<double, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&);
  362. template void igl::sort<Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> > const&, int, bool, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  363. #ifdef WIN32
  364. template void igl::sort<class Eigen::Matrix<int,-1,1,0,-1,1>,class Eigen::Matrix<int,-1,1,0,-1,1>,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::DenseBase<class Eigen::Matrix<int,-1,1,0,-1,1> > const &,int,bool,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,1,0,-1,1> > &,class Eigen::PlainObjectBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > &);
  365. template void igl::sort<__int64>(class std::vector<__int64,class std::allocator<__int64> > const &,bool,class std::vector<__int64,class std::allocator<__int64> > &,class std::vector<unsigned __int64,class std::allocator<unsigned __int64> > &);
  366. #endif
  367. #endif