repmat.h 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef IGL_REPMAT_H
  2. #define IGL_REPMAT_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. // Ideally this is a super overloaded function that behaves just like
  10. // matlab's repmat
  11. // Replicate and tile a matrix
  12. //
  13. // Templates:
  14. // T should be a eigen matrix primitive type like int or double
  15. // Inputs:
  16. // A m by n input matrix
  17. // r number of row-direction copies
  18. // c number of col-direction copies
  19. // Outputs:
  20. // B r*m by c*n output matrix
  21. //
  22. template <typename DerivedA,typename DerivedB>
  23. IGL_INLINE void repmat(
  24. const Eigen::PlainObjectBase<DerivedA> & A,
  25. const int r,
  26. const int c,
  27. Eigen::PlainObjectBase<DerivedB> & B);
  28. template <typename T>
  29. IGL_INLINE void repmat(
  30. const Eigen::SparseMatrix<T> & A,
  31. const int r,
  32. const int c,
  33. Eigen::SparseMatrix<T> & B);
  34. }
  35. #ifdef IGL_HEADER_ONLY
  36. # include "repmat.cpp"
  37. #endif
  38. #endif