slice.cpp 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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 "slice.h"
  9. #include "colon.h"
  10. #include <vector>
  11. #include <unsupported/Eigen/SparseExtra>
  12. template <
  13. typename TX,
  14. typename TY,
  15. typename DerivedR,
  16. typename DerivedC>
  17. IGL_INLINE void igl::slice(
  18. const Eigen::SparseMatrix<TX> &X,
  19. const Eigen::MatrixBase<DerivedR> &R,
  20. const Eigen::MatrixBase<DerivedC> &C,
  21. Eigen::SparseMatrix<TY> &Y)
  22. {
  23. #if 1
  24. int xm = X.rows();
  25. int xn = X.cols();
  26. int ym = R.size();
  27. int yn = C.size();
  28. // special case when R or C is empty
  29. if (ym == 0 || yn == 0)
  30. {
  31. Y.resize(ym, yn);
  32. return;
  33. }
  34. assert(R.minCoeff() >= 0);
  35. assert(R.maxCoeff() < xm);
  36. assert(C.minCoeff() >= 0);
  37. assert(C.maxCoeff() < xn);
  38. // Build reindexing maps for columns and rows, -1 means not in map
  39. std::vector<std::vector<typename DerivedR::Scalar>> RI;
  40. RI.resize(xm);
  41. for (int i = 0; i < ym; i++)
  42. {
  43. RI[R(i)].push_back(i);
  44. }
  45. std::vector<std::vector<typename DerivedC::Scalar>> CI;
  46. CI.resize(xn);
  47. // initialize to -1
  48. for (int i = 0; i < yn; i++)
  49. {
  50. CI[C(i)].push_back(i);
  51. }
  52. // Resize output
  53. Eigen::DynamicSparseMatrix<TY, Eigen::RowMajor> dyn_Y(ym, yn);
  54. // Take a guess at the number of nonzeros (this assumes uniform distribution
  55. // not banded or heavily diagonal)
  56. dyn_Y.reserve((X.nonZeros() / (X.rows() * X.cols())) * (ym * yn));
  57. // Iterate over outside
  58. for (int k = 0; k < X.outerSize(); ++k)
  59. {
  60. // Iterate over inside
  61. for (typename Eigen::SparseMatrix<TX>::InnerIterator it(X, k); it; ++it)
  62. {
  63. typename std::vector<typename DerivedR::Scalar>::iterator rit;
  64. typename std::vector<typename DerivedC::Scalar>::iterator cit;
  65. for (rit = RI[it.row()].begin(); rit != RI[it.row()].end(); rit++)
  66. {
  67. for (cit = CI[it.col()].begin(); cit != CI[it.col()].end(); cit++)
  68. {
  69. dyn_Y.coeffRef(*rit, *cit) = it.value();
  70. }
  71. }
  72. }
  73. }
  74. Y = Eigen::SparseMatrix<TY>(dyn_Y);
  75. #else
  76. // Alec: This is _not_ valid for arbitrary R,C since they don't necessary
  77. // representation a strict permutation of the rows and columns: rows or
  78. // columns could be removed or replicated. The removal of rows seems to be
  79. // handled here (although it's not clear if there is a performance gain when
  80. // the #removals >> #remains). If this is sufficiently faster than the
  81. // correct code above, one could test whether all entries in R and C are
  82. // unique and apply the permutation version if appropriate.
  83. //
  84. int xm = X.rows();
  85. int xn = X.cols();
  86. int ym = R.size();
  87. int yn = C.size();
  88. // special case when R or C is empty
  89. if (ym == 0 || yn == 0)
  90. {
  91. Y.resize(ym, yn);
  92. return;
  93. }
  94. assert(R.minCoeff() >= 0);
  95. assert(R.maxCoeff() < xm);
  96. assert(C.minCoeff() >= 0);
  97. assert(C.maxCoeff() < xn);
  98. // initialize row and col permutation vectors
  99. Eigen::VectorXi rowIndexVec = igl::LinSpaced<Eigen::VectorXi>(xm, 0, xm - 1);
  100. Eigen::VectorXi rowPermVec = igl::LinSpaced<Eigen::VectorXi>(xm, 0, xm - 1);
  101. for (int i = 0; i < ym; i++)
  102. {
  103. int pos = rowIndexVec.coeffRef(R(i));
  104. if (pos != i)
  105. {
  106. int &val = rowPermVec.coeffRef(i);
  107. std::swap(rowIndexVec.coeffRef(val), rowIndexVec.coeffRef(R(i)));
  108. std::swap(rowPermVec.coeffRef(i), rowPermVec.coeffRef(pos));
  109. }
  110. }
  111. Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> rowPerm(rowIndexVec);
  112. Eigen::VectorXi colIndexVec = igl::LinSpaced<Eigen::VectorXi>(xn, 0, xn - 1);
  113. Eigen::VectorXi colPermVec = igl::LinSpaced<Eigen::VectorXi>(xn, 0, xn - 1);
  114. for (int i = 0; i < yn; i++)
  115. {
  116. int pos = colIndexVec.coeffRef(C(i));
  117. if (pos != i)
  118. {
  119. int &val = colPermVec.coeffRef(i);
  120. std::swap(colIndexVec.coeffRef(val), colIndexVec.coeffRef(C(i)));
  121. std::swap(colPermVec.coeffRef(i), colPermVec.coeffRef(pos));
  122. }
  123. }
  124. Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> colPerm(colPermVec);
  125. Eigen::SparseMatrix<T> M = (rowPerm * X);
  126. Y = (M * colPerm).block(0, 0, ym, yn);
  127. #endif
  128. }
  129. template <
  130. typename TX,
  131. typename TY,
  132. typename DerivedR,
  133. typename DerivedC>
  134. IGL_INLINE void igl::slice(
  135. const Eigen::SparseMatrix<TX> &X,
  136. const Eigen::ArrayBase<DerivedR> &R,
  137. const Eigen::MatrixBase<DerivedC> &C,
  138. Eigen::SparseMatrix<TY> &Y)
  139. {
  140. int xm = X.rows();
  141. int xn = X.cols();
  142. int ym = R.size();
  143. int yn = C.size();
  144. // special case when R or C is empty
  145. if (ym == 0 || yn == 0)
  146. {
  147. Y.resize(ym, yn);
  148. return;
  149. }
  150. assert(R.minCoeff() >= 0);
  151. assert(R.maxCoeff() < xm);
  152. assert(C.minCoeff() >= 0);
  153. assert(C.maxCoeff() < xn);
  154. // Build reindexing maps for columns and rows, -1 means not in map
  155. std::vector<std::vector<typename DerivedR::Scalar>> RI;
  156. RI.resize(xm);
  157. for (int i = 0; i < ym; i++)
  158. {
  159. RI[R(i)].push_back(i);
  160. }
  161. std::vector<std::vector<typename DerivedC::Scalar>> CI;
  162. CI.resize(xn);
  163. // initialize to -1
  164. for (int i = 0; i < yn; i++)
  165. {
  166. CI[C(i)].push_back(i);
  167. }
  168. // Resize output
  169. Eigen::DynamicSparseMatrix<TY, Eigen::RowMajor> dyn_Y(ym, yn);
  170. // Take a guess at the number of nonzeros (this assumes uniform distribution
  171. // not banded or heavily diagonal)
  172. dyn_Y.reserve((X.nonZeros() / (X.rows() * X.cols())) * (ym * yn));
  173. // Iterate over outside
  174. for (int k = 0; k < X.outerSize(); ++k)
  175. {
  176. // Iterate over inside
  177. for (typename Eigen::SparseMatrix<TX>::InnerIterator it(X, k); it; ++it)
  178. {
  179. typename std::vector<typename DerivedR::Scalar>::iterator rit;
  180. typename std::vector<typename DerivedC::Scalar>::iterator cit;
  181. for (rit = RI[it.row()].begin(); rit != RI[it.row()].end(); rit++)
  182. {
  183. for (cit = CI[it.col()].begin(); cit != CI[it.col()].end(); cit++)
  184. {
  185. dyn_Y.coeffRef(*rit, *cit) = it.value();
  186. }
  187. }
  188. }
  189. }
  190. Y = Eigen::SparseMatrix<TY>(dyn_Y);
  191. }
  192. template <
  193. typename TX,
  194. typename TY,
  195. typename DerivedR,
  196. typename DerivedC>
  197. IGL_INLINE void igl::slice(
  198. const Eigen::SparseMatrix<TX> &X,
  199. const Eigen::MatrixBase<DerivedR> &R,
  200. const Eigen::ArrayBase<DerivedC> &C,
  201. Eigen::SparseMatrix<TY> &Y)
  202. {
  203. int xm = X.rows();
  204. int xn = X.cols();
  205. int ym = R.size();
  206. int yn = C.size();
  207. // special case when R or C is empty
  208. if (ym == 0 || yn == 0)
  209. {
  210. Y.resize(ym, yn);
  211. return;
  212. }
  213. assert(R.minCoeff() >= 0);
  214. assert(R.maxCoeff() < xm);
  215. assert(C.minCoeff() >= 0);
  216. assert(C.maxCoeff() < xn);
  217. // Build reindexing maps for columns and rows, -1 means not in map
  218. std::vector<std::vector<typename DerivedR::Scalar>> RI;
  219. RI.resize(xm);
  220. for (int i = 0; i < ym; i++)
  221. {
  222. RI[R(i)].push_back(i);
  223. }
  224. std::vector<std::vector<typename DerivedC::Scalar>> CI;
  225. CI.resize(xn);
  226. // initialize to -1
  227. for (int i = 0; i < yn; i++)
  228. {
  229. CI[C(i)].push_back(i);
  230. }
  231. // Resize output
  232. Eigen::DynamicSparseMatrix<TY, Eigen::RowMajor> dyn_Y(ym, yn);
  233. // Take a guess at the number of nonzeros (this assumes uniform distribution
  234. // not banded or heavily diagonal)
  235. dyn_Y.reserve((X.nonZeros() / (X.rows() * X.cols())) * (ym * yn));
  236. // Iterate over outside
  237. for (int k = 0; k < X.outerSize(); ++k)
  238. {
  239. // Iterate over inside
  240. for (typename Eigen::SparseMatrix<TX>::InnerIterator it(X, k); it; ++it)
  241. {
  242. typename std::vector<typename DerivedR::Scalar>::iterator rit;
  243. typename std::vector<typename DerivedC::Scalar>::iterator cit;
  244. for (rit = RI[it.row()].begin(); rit != RI[it.row()].end(); rit++)
  245. {
  246. for (cit = CI[it.col()].begin(); cit != CI[it.col()].end(); cit++)
  247. {
  248. dyn_Y.coeffRef(*rit, *cit) = it.value();
  249. }
  250. }
  251. }
  252. }
  253. Y = Eigen::SparseMatrix<TY>(dyn_Y);
  254. }
  255. template <typename MatX, typename DerivedR, typename MatY>
  256. IGL_INLINE void igl::slice(
  257. const MatX &X,
  258. const Eigen::MatrixBase<DerivedR> &R,
  259. const int dim,
  260. MatY &Y)
  261. {
  262. Eigen::Matrix<typename DerivedR::Scalar, Eigen::Dynamic, 1> C;
  263. switch (dim)
  264. {
  265. case 1:
  266. // boring base case
  267. if (X.cols() == 0)
  268. {
  269. Y.resize(R.size(), 0);
  270. return;
  271. }
  272. igl::colon(0, X.cols() - 1, C);
  273. return slice(X, R, C, Y);
  274. case 2:
  275. // boring base case
  276. if (X.rows() == 0)
  277. {
  278. Y.resize(0, R.size());
  279. return;
  280. }
  281. igl::colon(0, X.rows() - 1, C);
  282. return slice(X, C, R, Y);
  283. default:
  284. assert(false && "Unsupported dimension");
  285. return;
  286. }
  287. }
  288. template <typename MatX, typename DerivedR, typename MatY>
  289. IGL_INLINE void igl::slice(
  290. const MatX &X,
  291. const Eigen::ArrayBase<DerivedR> &R,
  292. const int dim,
  293. MatY &Y)
  294. {
  295. Eigen::Matrix<typename DerivedR::Scalar, Eigen::Dynamic, 1> C;
  296. switch (dim)
  297. {
  298. case 1:
  299. // boring base case
  300. if (X.cols() == 0)
  301. {
  302. Y.resize(R.size(), 0);
  303. return;
  304. }
  305. igl::colon(0, X.cols() - 1, C);
  306. return slice(X, R, C, Y);
  307. case 2:
  308. // boring base case
  309. if (X.rows() == 0)
  310. {
  311. Y.resize(0, R.size());
  312. return;
  313. }
  314. igl::colon(0, X.rows() - 1, C);
  315. return slice(X, C, R, Y);
  316. default:
  317. assert(false && "Unsupported dimension");
  318. return;
  319. }
  320. }
  321. template <
  322. typename DerivedX,
  323. typename DerivedR,
  324. typename DerivedC,
  325. typename DerivedY>
  326. IGL_INLINE void igl::slice(
  327. const Eigen::ArrayBase<DerivedX> &X,
  328. const Eigen::MatrixBase<DerivedR> &R,
  329. const Eigen::MatrixBase<DerivedC> &C,
  330. Eigen::PlainObjectBase<DerivedY> &Y)
  331. {
  332. #ifndef NDEBUG
  333. int xm = X.rows();
  334. int xn = X.cols();
  335. #endif
  336. int ym = R.size();
  337. int yn = C.size();
  338. // special case when R or C is empty
  339. if (ym == 0 || yn == 0)
  340. {
  341. Y.resize(ym, yn);
  342. return;
  343. }
  344. assert(R.minCoeff() >= 0);
  345. assert(R.maxCoeff() < xm);
  346. assert(C.minCoeff() >= 0);
  347. assert(C.maxCoeff() < xn);
  348. // Resize output
  349. Y.resize(ym, yn);
  350. // loop over output rows, then columns
  351. for (int i = 0; i < ym; i++)
  352. {
  353. for (int j = 0; j < yn; j++)
  354. {
  355. Y(i, j) = X(R(i, 0), C(j, 0));
  356. }
  357. }
  358. }
  359. template <
  360. typename DerivedX,
  361. typename DerivedR,
  362. typename DerivedC,
  363. typename DerivedY>
  364. IGL_INLINE void igl::slice(
  365. const Eigen::MatrixBase<DerivedX> &X,
  366. const Eigen::MatrixBase<DerivedR> &R,
  367. const Eigen::MatrixBase<DerivedC> &C,
  368. Eigen::PlainObjectBase<DerivedY> &Y)
  369. {
  370. #ifndef NDEBUG
  371. int xm = X.rows();
  372. int xn = X.cols();
  373. #endif
  374. int ym = R.size();
  375. int yn = C.size();
  376. // special case when R or C is empty
  377. if (ym == 0 || yn == 0)
  378. {
  379. Y.resize(ym, yn);
  380. return;
  381. }
  382. assert(R.minCoeff() >= 0);
  383. assert(R.maxCoeff() < xm);
  384. assert(C.minCoeff() >= 0);
  385. assert(C.maxCoeff() < xn);
  386. // Resize output
  387. Y.resize(ym, yn);
  388. // loop over output rows, then columns
  389. for (int i = 0; i < ym; i++)
  390. {
  391. for (int j = 0; j < yn; j++)
  392. {
  393. Y(i, j) = X(R(i,0), C(j,0));
  394. }
  395. }
  396. }
  397. template <typename DerivedX, typename DerivedY, typename DerivedR>
  398. IGL_INLINE void igl::slice(
  399. const Eigen::MatrixBase<DerivedX> &X,
  400. const Eigen::MatrixBase<DerivedR> &R,
  401. Eigen::PlainObjectBase<DerivedY> &Y)
  402. {
  403. // phony column indices
  404. Eigen::Matrix<typename DerivedR::Scalar, Eigen::Dynamic, 1> C;
  405. C.resize(1);
  406. C(0) = 0;
  407. return igl::slice(X, R, C, Y);
  408. }
  409. template <typename DerivedX, typename DerivedR>
  410. IGL_INLINE DerivedX igl::slice(
  411. const Eigen::MatrixBase<DerivedX> &X,
  412. const Eigen::MatrixBase<DerivedR> &R)
  413. {
  414. DerivedX Y;
  415. igl::slice(X, R, Y);
  416. return Y;
  417. }
  418. template <typename DerivedX, typename DerivedR>
  419. IGL_INLINE DerivedX igl::slice(
  420. const Eigen::MatrixBase<DerivedX> &X,
  421. const Eigen::MatrixBase<DerivedR> &R,
  422. const int dim)
  423. {
  424. DerivedX Y;
  425. igl::slice(X, R, dim, Y);
  426. return Y;
  427. }
  428. #ifdef IGL_STATIC_LIBRARY
  429. // Explicit template instantiation
  430. // generated by autoexplicit.sh
  431. template void igl::slice<Eigen::Array<bool, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Array<bool, -1, 1, 0, -1, 1> >(Eigen::Array<bool, -1, 1, 0, -1, 1> const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::Array<bool, -1, 1, 0, -1, 1>&);
  432. template void igl::slice<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::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
  433. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::Matrix<double, -1, -1, 0, -1, -1> &);
  434. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::Matrix<double, -1, -1, 0, -1, -1> &);
  435. template void igl::slice<Eigen::SparseMatrix<double, 0, int>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::SparseMatrix<double, 0, int>>(Eigen::SparseMatrix<double, 0, int> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::SparseMatrix<double, 0, int> &);
  436. template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::Matrix<double, -1, -1, 0, -1, -1> &);
  437. template void igl::slice<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::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>> &);
  438. template void igl::slice<Eigen::SparseMatrix<double, 0, int>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::SparseMatrix<double, 0, int>>(Eigen::SparseMatrix<double, 0, int> const &, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>> const &, int, Eigen::SparseMatrix<double, 0, int> &);
  439. template void igl::slice<Eigen::SparseMatrix<double, 0, int>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::SparseMatrix<double, 0, int>>(Eigen::SparseMatrix<double, 0, int> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, int, Eigen::SparseMatrix<double, 0, int> &);
  440. template void igl::slice<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::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  441. template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  442. template void igl::slice<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, -1, 1, true>>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, -1, 1, true>> const &, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
  443. template Eigen::Matrix<double, -1, -1, 0, -1, -1> igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int);
  444. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3>> &);
  445. template void igl::slice<Eigen::Matrix<float, -1, 1, 0, -1, 1>, Eigen::Matrix<float, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>>(Eigen::MatrixBase<Eigen::Matrix<float, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1>> &);
  446. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  447. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3>> &);
  448. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 1, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 1, -1, -1>> &);
  449. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<long, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  450. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 1, -1, -1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 1, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  451. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  452. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3>>>(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3>> &);
  453. template void igl::slice<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 3, 1, -1, 3>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3>> &);
  454. template void igl::slice<Eigen::SparseMatrix<bool, 0, int>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::SparseMatrix<bool, 0, int>>(Eigen::SparseMatrix<bool, 0, int> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::SparseMatrix<bool, 0, int> &);
  455. template Eigen::Matrix<int, -1, -1, 0, -1, -1> igl::slice<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &);
  456. template void igl::slice<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  457. template void igl::slice<Eigen::Matrix<double, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 1, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 1, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 1, -1, -1>> &);
  458. template void igl::slice<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<float, -1, 3, 1, -1, 3>>(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3>> &);
  459. template void igl::slice<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>> &);
  460. template void igl::slice<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>> &);
  461. template void igl::slice<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::Matrix<int, -1, 1, 0, -1, 1> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::Matrix<int, -1, 1, 0, -1, 1> &);
  462. template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<long, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  463. template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  464. template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  465. template void igl::slice<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>>>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
  466. template void igl::slice<Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1>>>(Eigen::Matrix<long, -1, 1, 0, -1, 1> const &, Eigen::MatrixBase<Eigen::Matrix<long, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1>> &);
  467. template void igl::slice<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::Matrix<int, -1, -1, 0, -1, -1> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  468. #ifdef WIN32
  469. template void igl::slice<Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>>(Eigen::Matrix<__int64, -1, 1, 0, -1, 1> const &, Eigen::MatrixBase<Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
  470. template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>, Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  471. template void igl::slice<class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> >,class Eigen::Matrix<__int64,-1,1,0,-1,1>,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > >(class Eigen::MatrixBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > const &,class Eigen::MatrixBase<class Eigen::Matrix<__int64,-1,1,0,-1,1> > const &,int,class Eigen::PlainObjectBase<class Eigen::Matrix<int,-1,-1,0,-1,-1> > &);
  472. #endif
  473. #if EIGEN_VERSION_AT_LEAST(3, 3, 7)
  474. #else
  475. template void igl::slice<Eigen::MatrixBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::Matrix<double, -1, -1, 0, -1, -1> &);
  476. #endif
  477. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  478. template void igl::slice<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1>> &);
  479. template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  480. template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3>>>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3>> &);
  481. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
  482. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  483. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  484. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>>>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, int, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
  485. template void igl::slice<Eigen::SparseMatrix<double, 0, int>, Eigen::Array<int, -1, 1, 0, -1, 1>, Eigen::SparseMatrix<double, 0, int> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::ArrayBase<Eigen::Array<int, -1, 1, 0, -1, 1> > const&, int, Eigen::SparseMatrix<double, 0, int>&);
  486. template void igl::slice<Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
  487. #endif