ismember.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_ISMEMBER_H
  9. #define IGL_ISMEMBER_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Determine if elements of A exist in elements of B
  15. //
  16. // Inputs:
  17. // A ma by na matrix
  18. // B mb by nb matrix
  19. // Outputs:
  20. // IA ma by na matrix of flags whether corresponding element of A exists in
  21. // B
  22. // LOCB ma by na matrix of indices in B locating matching element (-1 if
  23. // not found), indices assume column major ordering
  24. //
  25. template <
  26. typename DerivedA,
  27. typename DerivedB,
  28. typename DerivedIA,
  29. typename DerivedLOCB>
  30. IGL_INLINE void ismember(
  31. const Eigen::PlainObjectBase<DerivedA> & A,
  32. const Eigen::PlainObjectBase<DerivedB> & B,
  33. Eigen::PlainObjectBase<DerivedIA> & IA,
  34. Eigen::PlainObjectBase<DerivedLOCB> & LOCB);
  35. }
  36. #ifndef IGL_STATIC_LIBRARY
  37. # include "ismember.cpp"
  38. #endif
  39. #endif