print_ijv.h 785 B

12345678910111213141516171819202122232425262728
  1. #ifndef IGL_PRINT_IJV_H
  2. #define IGL_PRINT_IJV_H
  3. #include "igl_inline.h"
  4. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  5. #include <Eigen/Dense>
  6. #include <Eigen/Sparse>
  7. namespace igl
  8. {
  9. // Prints a 3 column matrix representing [I,J,V] = find(X). That is, each
  10. // row is the row index, column index and value for each non zero entry. Each
  11. // row is printed on a new line
  12. //
  13. // Templates:
  14. // T should be a eigen sparse matrix primitive type like int or double
  15. // Input:
  16. // X m by n matrix whose entries are to be sorted
  17. // offset optional offset for I and J indices {0}
  18. template <typename T>
  19. IGL_INLINE void print_ijv(
  20. const Eigen::SparseMatrix<T>& X,
  21. const int offset=0);
  22. }
  23. #ifdef IGL_HEADER_ONLY
  24. # include "print_ijv.cpp"
  25. #endif
  26. #endif