matrix_to_list.cpp 1.0 KB

123456789101112131415161718192021222324252627
  1. #include "matrix_to_list.h"
  2. #include <Eigen/Dense>
  3. template <typename Mat, typename T>
  4. IGL_INLINE void igl::matrix_to_list(
  5. const Mat & M,
  6. std::vector<std::vector<T > > & V)
  7. {
  8. using namespace std;
  9. V.resize(M.rows(),vector<T >(M.cols()));
  10. // loop over rows
  11. for(int i = 0;i<M.rows();i++)
  12. {
  13. // loop over cols
  14. for(int j = 0;j<M.cols();j++)
  15. {
  16. V[i][j] = M(i,j);
  17. }
  18. }
  19. }
  20. #ifndef IGL_HEADER_ONLY
  21. // Explicit template specialization
  22. template void igl::matrix_to_list<Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >, int>(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
  23. template void igl::matrix_to_list<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >, double>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >&);
  24. #endif