mode.h 746 B

12345678910111213141516171819202122232425262728
  1. #ifndef IGL_MODE_H
  2. #define IGL_MODE_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Dense>
  5. namespace igl
  6. {
  7. // Takes mode of coefficients in a matrix along a given dension
  8. //
  9. // Templates:
  10. // T should be a eigen matrix primitive type like int or double
  11. // Inputs:
  12. // X m by n original matrix
  13. // d dension along which to take mode, m or n
  14. // Outputs:
  15. // M vector containing mode along dension d, if d==1 then this will be a
  16. // n-long vector if d==2 then this will be a m-long vector
  17. template <typename T>
  18. IGL_INLINE void mode(
  19. const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & X,
  20. const int d,
  21. Eigen::Matrix<T,Eigen::Dynamic,1> & M);
  22. }
  23. #ifdef IGL_HEADER_ONLY
  24. # include "mode.cpp"
  25. #endif
  26. #endif