list_to_matrix.h 820 B

1234567891011121314151617181920212223242526272829
  1. #ifndef IGL_LIST_TO_MATRIX_H
  2. #define IGL_LIST_TO_MATRIX_H
  3. #include "igl_inline.h"
  4. #include <vector>
  5. namespace igl
  6. {
  7. // Convert a list (std::vector) of row vectors of the same length to a matrix
  8. // Template:
  9. // T type that can be safely cast to type in Mat via '='
  10. // Mat Matrix type, must implement:
  11. // .resize(m,n)
  12. // .row(i) = Row
  13. // Inputs:
  14. // V a m-long list of vectors of size n
  15. // Outputs:
  16. // M an m by n matrix
  17. // Returns true on success, false on errors
  18. template <typename T, class Mat>
  19. IGL_INLINE bool list_to_matrix(const std::vector<std::vector<T > > & V,Mat & M);
  20. // Vector wrapper
  21. template <typename T, class Mat>
  22. IGL_INLINE bool list_to_matrix(const std::vector<T > & V,Mat & M);
  23. }
  24. #ifdef IGL_HEADER_ONLY
  25. # include "list_to_matrix.cpp"
  26. #endif
  27. #endif