cumprod.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 Alec Jacobson <[email protected]>
  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_CUMPROD_H
  9. #define IGL_CUMPROD_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Computes a cumulative product of the columns of X, like matlab's `cumprod`.
  15. ///
  16. /// @tparam DerivedX Type of matrix X
  17. /// @tparam DerivedY Type of matrix Y
  18. /// @param[in] X m by n Matrix to be cumulatively multiplied.
  19. /// @param[in] dim dimension to take cumulative product (1 or 2)
  20. /// @param[out] Y m by n Matrix containing cumulative product.
  21. ///
  22. template <typename DerivedX, typename DerivedY>
  23. IGL_INLINE void cumprod(
  24. const Eigen::MatrixBase<DerivedX > & X,
  25. const int dim,
  26. Eigen::PlainObjectBase<DerivedY > & Y);
  27. //template <typename DerivedX, typename DerivedY>
  28. //IGL_INLINE void cumprod(
  29. // const Eigen::MatrixBase<DerivedX > & X,
  30. // Eigen::PlainObjectBase<DerivedY > & Y);
  31. }
  32. #ifndef IGL_STATIC_LIBRARY
  33. # include "cumprod.cpp"
  34. #endif
  35. #endif