kronecker_product.h 950 B

12345678910111213141516171819202122232425262728293031323334
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@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_KRONECKERPRODUCT_H
  9. #define IGL_KRONECKERPRODUCT_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. // Computes the Kronecker product between sparse matrices A and B.
  16. //
  17. // Inputs:
  18. // A #M by #N sparse matrix
  19. // B #P by #Q sparse matrix
  20. // Returns #M*#P by #N*#Q sparse matrix
  21. //
  22. template <typename Scalar>
  23. IGL_INLINE Eigen::SparseMatrix<Scalar> kronecker_product(
  24. const Eigen::SparseMatrix<Scalar> & A,
  25. const Eigen::SparseMatrix<Scalar> & B);
  26. }
  27. #ifdef IGL_HEADER_ONLY
  28. # include "kronecker_product.cpp"
  29. #endif
  30. #endif