min.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef IGL_MIN_H
  2. #define IGL_MIN_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <Eigen/Sparse>
  6. namespace igl
  7. {
  8. /// Compute the minimum along dimension dim of a matrix X
  9. ///
  10. /// @param[in] X m by n matrix
  11. /// @param[in] dim dimension along which to take min
  12. /// @param[out] Y
  13. /// n-long vector (if dim == 1)
  14. /// Y m-long vector (if dim == 2)
  15. /// @param[out] I vector the same size as Y containing the indices along dim of minimum
  16. /// entries
  17. template <typename AType, typename DerivedB, typename DerivedI>
  18. IGL_INLINE void min(
  19. const Eigen::SparseMatrix<AType> & A,
  20. const int dim,
  21. Eigen::PlainObjectBase<DerivedB> & B,
  22. Eigen::PlainObjectBase<DerivedI> & I);
  23. /// \overload
  24. template <typename DerivedX, typename DerivedY, typename DerivedI>
  25. IGL_INLINE void min(
  26. const Eigen::DenseBase<DerivedX> & X,
  27. const int dim,
  28. Eigen::PlainObjectBase<DerivedY> & Y,
  29. Eigen::PlainObjectBase<DerivedI> & I);
  30. }
  31. #ifndef IGL_STATIC_LIBRARY
  32. # include "min.cpp"
  33. #endif
  34. #endif