cumsum.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_CUMSUM_H
  9. #define IGL_CUMSUM_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Computes a cumulative sum of the columns of X, like matlab's `cumsum`.
  15. //
  16. // Templates:
  17. // DerivedX Type of matrix X
  18. // DerivedY Type of matrix Y
  19. // Inputs:
  20. // X m by n Matrix to be cumulatively summed.
  21. // dim dimension to take cumulative sum (1 or 2)
  22. // Output:
  23. // Y m by n Matrix containing cumulative sum.
  24. //
  25. template <typename DerivedX, typename DerivedY>
  26. IGL_INLINE void cumsum(
  27. const Eigen::MatrixBase<DerivedX > & X,
  28. const int dim,
  29. Eigen::PlainObjectBase<DerivedY > & Y);
  30. //template <typename DerivedX, typename DerivedY>
  31. //IGL_INLINE void cumsum(
  32. // const Eigen::MatrixBase<DerivedX > & X,
  33. // Eigen::PlainObjectBase<DerivedY > & Y);
  34. }
  35. #ifndef IGL_STATIC_LIBRARY
  36. # include "cumsum.cpp"
  37. #endif
  38. #endif