speye.h 1011 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef IGL_SPEYE_H
  2. #define IGL_SPEYE_H
  3. #include "igl_inline.h"
  4. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  5. #include <Eigen/Sparse>
  6. namespace igl
  7. {
  8. // Builds an m by n sparse identity matrix like matlab's speye function
  9. // Templates:
  10. // T should be a eigen sparse matrix primitive type like int or double
  11. // Inputs:
  12. // m number of rows
  13. // n number of cols
  14. // Outputs:
  15. // I m by n sparse matrix with 1's on the main diagonal
  16. template <typename T>
  17. IGL_INLINE void speye(const int n,const int m, Eigen::SparseMatrix<T> & I);
  18. // Builds an n by n sparse identity matrix like matlab's speye function
  19. // Templates:
  20. // T should be a eigen sparse matrix primitive type like int or double
  21. // Inputs:
  22. // n number of rows and cols
  23. // Outputs:
  24. // I n by n sparse matrix with 1's on the main diagonal
  25. template <typename T>
  26. IGL_INLINE void speye(const int n, Eigen::SparseMatrix<T> & I);
  27. }
  28. #ifdef IGL_HEADER_ONLY
  29. # include "speye.cpp"
  30. #endif
  31. #endif