max.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef IGL_MAX_H
  2. #define IGL_MAX_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <Eigen/Sparse>
  6. namespace igl
  7. {
  8. /// Compute the maximum 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 max
  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. ///
  18. template <typename AType, typename DerivedB, typename DerivedI>
  19. IGL_INLINE void max(
  20. const Eigen::SparseMatrix<AType> & A,
  21. const int dim,
  22. Eigen::PlainObjectBase<DerivedB> & B,
  23. Eigen::PlainObjectBase<DerivedI> & I);
  24. /// \overload
  25. template <typename DerivedX, typename DerivedY, typename DerivedI>
  26. IGL_INLINE void max(
  27. const Eigen::DenseBase<DerivedX> & X,
  28. const int dim,
  29. Eigen::PlainObjectBase<DerivedY> & Y,
  30. Eigen::PlainObjectBase<DerivedI> & I);
  31. }
  32. #ifndef IGL_STATIC_LIBRARY
  33. # include "max.cpp"
  34. #endif
  35. #endif