matrix_to_list.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef IGL_MATRIX_TO_LIST_H
  2. #define IGL_MATRIX_TO_LIST_H
  3. #include "igl_inline.h"
  4. #include <vector>
  5. #include <Eigen/Dense>
  6. namespace igl
  7. {
  8. // Convert a matrix to a list (std::vector) of row vectors of the same size
  9. // Template:
  10. // Mat Matrix type, must implement:
  11. // .resize(m,n)
  12. // .row(i) = Row
  13. // T type that can be safely cast to type in Mat via '='
  14. // Inputs:
  15. // V a m-long list of vectors of size n
  16. // Outputs:
  17. // M an m by n matrix
  18. //
  19. // See also: list_to_matrix
  20. template <typename DerivedM>
  21. IGL_INLINE void matrix_to_list(
  22. const Eigen::MatrixBase<DerivedM> & M,
  23. std::vector<std::vector<typename DerivedM::Scalar > > & V);
  24. // For vector input
  25. template <typename DerivedM>
  26. IGL_INLINE void matrix_to_list(
  27. const Eigen::MatrixBase<DerivedM> & M,
  28. std::vector<typename DerivedM::Scalar > & V);
  29. // Return wrapper
  30. template <typename DerivedM>
  31. IGL_INLINE std::vector<typename DerivedM::Scalar > matrix_to_list(
  32. const Eigen::MatrixBase<DerivedM> & M);
  33. }
  34. #ifdef IGL_HEADER_ONLY
  35. # include "matrix_to_list.cpp"
  36. #endif
  37. #endif