randperm.h 543 B

1234567891011121314151617181920212223
  1. #ifndef IGL_RANDPERM_H
  2. #define IGL_RANDPERM_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Like matlab's randperm(n) but minus 1
  8. //
  9. // Inputs:
  10. // n number of elements
  11. // Outputs:
  12. // I n list of rand permutation of 0:n-1
  13. template <typename DerivedI>
  14. IGL_INLINE void randperm(
  15. const int n,
  16. Eigen::PlainObjectBase<DerivedI> & I);
  17. template <typename DerivedI>
  18. IGL_INLINE Eigen::PlainObjectBase<DerivedI> randperm( const int n);
  19. }
  20. #ifdef IGL_HEADER_ONLY
  21. # include "randperm.cpp"
  22. #endif
  23. #endif